I have Debian virtual machine within a Hyper-V/MS Server 2008 R2 environment. The virtual Machine has two ethernet controllers. Now I want to assign them each a static IP Address. Basically I know how to configure a static IP within the interfaces config file.

My problem is, that the ports with the static IP Addresses are now assigned to the wrong virtual network controllers. What I want is that port eth0 with IP Address 192.x.x.x/24 is assigned to the network virt0 and port eth1 with IP Address 10.x.x.x/24 is assigned to the network virt1, but the opposite is the case.

I know this is not that big issue and of course I could just switch the networks within Hyper-V or switch the IP Addresses on the ethernet controllers. But it would just be beautiful for my network if it works the way I want. And I think it shouldn't be that hard to say "eth0 is the network card with hw address xx:xx:xx... and eth1 is xx:xx:xx...".

  • Not a Hyper-V expert here but I think this will not work. of course you can assign any Ip address you wish but the problem is that virtual network controller will still assign received frame to particular VLAN. In other words - the separation between virt0 and 1 will be kept regardless of IP address you chose. Solution ? Extend switching domain to the host, you should be able to connect 802.1Q tagged (aka trunk) link to your host. Then by creating particular VLAN subinterfaces you can manipulate where you would like to put your traffic.
    – MAQ
    Commented Mar 20, 2016 at 0:26
  • My issue is not with the network or hyper-v configuration. What I want is to simply tell Debian, that it should assign the placeholder eth0 to a by myself defined hardware. This might be archieved through the mac address or a UUID or whatever identifier there is for the network controller. Just as an example something like \ iface eth0 inet static \ address 192.x.x.x \ netmask \ gateway 192.x.x.x \ hwaddress xx:xx:xx:xx:xx:xx Commented Mar 20, 2016 at 0:51
  • Consistent Network Device Naming. I believe both Red Hat and Dell have whitepapers about the subject. Search for "Consistent Network Device Naming" and "biosdevname".
    – user56041
    Commented Mar 20, 2019 at 13:22

1 Answer 1


If you run Debian 8 (jessie) add net.ifnames=1 to your kernel command line and have automatically assigned persistent network device names. I also like creating /etc/systemd/network/99-default.link as


for greater uniformity, but Hyper-V may do well enough for you (at least up to two interfaces) without this.

Otherwise, adapt the following into /etc/udev/rules.d/70-persistent-net.rules and reboot:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="12:34:56:78:9a:bc", KERNEL=="eth*", NAME="vlanX"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="22:34:56:78:9a:bc", KERNEL=="eth*", NAME="vlanY"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .