Hello I have an unusual situation. I am implementing a system on a number of MicroTCA chassis. I have a number of Single Board Computers for those chassis. Each SBC has three Ethernet interfaces and associated MAC addresses. I am running Ubuntu Desktop 16.04 LTS.

I want to have a single SSD image that I can deploy on all the chassis. I want that SSD image to know what static IP address to assign to any of the MAC addresses it sees. That way I can plug any of the SBC into any of the chassis and get the right IP addresses.

I have found that the graphical networking tool in Ubuntu lets me assign static IP by MAC but I do not know where it stores that info. I don't want to click through that tool to make all those assignments for each of the three interfaces on all those SBC.

I have looked at editing /etc/network/interfaces but it assigns static IP addresses by interface name, ie. eth0, enp13s0. I don't know if these names will be the same on all SBC. On my machines I generally see "enp11s0", "enp12s0" and "enp13s0".

I cannot use an external DHCP server to hand out IP addresses.

Is there a file I can edit to define the mapping of static IP address to MAC address?

Any advice is greatly appreciated.

  • Why can't you use DHCP? This is exactly the scenario where DCHP is designed for. – jawtheshark Sep 8 '16 at 16:54
  • 2
    The situation you're talking about is common when using lots of virtualization. The file that holds the MAC to virtual interface info is /etc/udev/rules.d/70-persistent-net.rules. With SBCs, it makes a lot more sense to use DHCP reservations. – RobotHumans Sep 8 '16 at 17:21
  • I think you can do this with systemd (see man 5 systemd.network), but I won't be able to test/answer until tomorrow or Sunday.. – Seth Sep 8 '16 at 17:26
  • Oh but you're on 14.04.. so likely not running systemd. – Seth Sep 8 '16 at 17:26
  • Woops! I am running 16.04 LTS. Sorry Seth. I edited my question. – Pedro_Uno Sep 8 '16 at 17:50

you could have a script stored on the SSD that contains the mapping of MAC address to ip and sets it using nmcli

nmcli connection add ifname ifname [con-name name] [autoconnect {yes | no}] [save {yes | no}] [master master] [slave-type type]
   [type type] [ARGUMENTS...] [ip4 addr] [gw4 addr] [ip6 addr] [gw6 addr] [-- [+|-]setting.property value ...]

for more details on those params

man nmcli 

around line 140

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.