Share your knowledge at the LQ Wiki.
Go Back > Blogs > Skaperen
User Name


Rate this Entry

Static network config not based on interface name or MAC address

Posted 04-08-2012 at 04:57 PM by Skaperen

Traditionally, static configurations of IP addresses were made based on the interface names, which were always constant. When the kernel started doing device probes in a way that interface names would vary from time to time even on the exact same set of NICs, then we needed udev to keep things orderly. Turns out even udev can be fool when you change NICs, or when moving system hard drives to a new machine. New MAC addresses mean the old interface names are unavailable. So network configurations fail and you can't reach the machine to "ssh in". Gotta go to the console (too bad if the machine is remote).

The idea I have, which I will eventually try to craft into a solution, is to base network configurations on what network each interface/NIC is physically connected to. The methods available include sniffing the network for ARP broadcasts to identify the subnet, or requesting an address via DHCP and using that to detect the subnet. The configuration would then be referring to the subnet, rather than an interface name or MAC address. So if you change NICs and/or plug NICs into different subnets, just restart the network and the static IPs follow where the subnets go to.
Posted in Uncategorized
Views 12951 Comments 3
« Prev     Main     Next »
Total Comments 3


  1. Old Comment
    So you want a netbios network.
    Posted 04-09-2012 at 07:38 AM by amilo amilo is offline
  2. Old Comment
    Originally Posted by amilo View Comment
    So you want a netbios network.
    No, I want IP. I just want the system to configure the correct addresses with the correct interface more often than it currently does.
    Posted 04-09-2012 at 07:57 AM by Skaperen Skaperen is offline
  3. Old Comment
    One of the methods suggested should be fairly simple to deploy. You just need to have a DHCP server on each LAN segment the machines(s) need to do other IP addresses on. A new script to set up the addresses will do DHCP on each interface to get an address from the DHCP server. Since it gets the addresses from the DHCP server it can reach, these addresses will correspond to whatever network the NIC port is connected to. Once the address is obtained, then it can be given back and not even used. It is just sufficient to identify the network that interface and port is connected to. Of course, each LAN's DHCP server will need a separate subnet for it's dynamic allocation pool to make this work right. Or, just make a larger pool and don't worry about giving the addresses back to DHCP.

    The network part of the address obtained from DHCP will identify which network. A table can then map subnets to subnets so you know addition subnets the LAN might have. Then a list of addresses (including from server configs like Apache) can be obtained. For each address, see which interface(s) have the subnet that address is in, and bind that address to that interface.

    Then you can change NICs, change where cables are plugged in, and the kernel can have different probe orders with different interface names, and this will still bind the correct IP addresses to the correct interface.
    Posted 04-09-2012 at 05:41 PM by Skaperen Skaperen is offline


All times are GMT -5. The time now is 12:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration