Giter Site home page Giter Site logo

multihoming about nixos-shell HOT 3 CLOSED

mic92 avatar mic92 commented on August 22, 2024
multihoming

from nixos-shell.

Comments (3)

Mic92 avatar Mic92 commented on August 22, 2024

The patch was applied to master in ce3bbd0 and c20ddde

from nixos-shell.

teto avatar teto commented on August 22, 2024

what about the multihoming issue ? it seems to work fine with the nixos/tests infrastructure. There seems to be some related code (to vlans) in nixos/lib/testing.nix but it doesn't seem called in nixos-shell

from nixos-shell.

teto avatar teto commented on August 22, 2024

I managed to come up in my vm.nix with sthg like

let
  vlans = [ 1 2];
  zeroPad = n: if n < 10 then "0${toString n}" else toString n;

  # see https://wiki.qemu.org/Documentation/Networking 's doc
  qemuNICFlags = nic: net: machine:
    [ "-device virtio-net-pci,netdev=vlan${toString nic},mac=52:54:00:12:${zeroPad net}:${zeroPad machine}"
      "-netdev user,id=vlan${toString nic}"
    ];

in
{
  virtualisation.qemu.options = with pkgs.lib; let
              m = {snd = 1;};
              interfacesNumbered = zipLists vlans (range 1 255);
              interfaces = flip map interfacesNumbered ({ fst, snd }:
                nameValuePair "eth${toString snd}" { ipv4.addresses =
                  [ { address = "192.168.${toString fst}.${toString m.snd}";
                      prefixLength = 24;
                  } ];
                });
    in
      flip map interfacesNumbered
        ({ fst, snd }: qemuNICFlags snd fst m.snd);
}

actually the doc of virtualisation.qemu.vlans is a bit misleading as it will work only with extra code (as in nixos tests). Also I wanted to run my own kernel but qemu-vm hardcodes it. Hopefully qemu uses the last parameter set on the command line so I can still override the nixpkgs one.
I might have a look at improving qemu-vm.nix. The pasted code uses SLIRP which seems to be bad for perf. maybe nixos-shell could run some VDE logic as the nixos tests. Anyway that should be good for now on my side.

from nixos-shell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.