I need to add a secondary IP address (static) on an ethernet interface where primary IP address is received from a DHCP server.
Hi, thanks for your message. Could you please extend a bit more on your use case? What do you mean by primary and secondary IP addresses? An ethernet interface can only have one IP addressed assigned, be it DHCP or statically assigned.
Thank you for your response. In general, actually it is possible to give an IP address to an interface and add IP alias on the same interface which makes it possible to access to different networks using the same network interface.
Hey there, have you tried creating an alias with the ipconfig command manually first? It will be lost on reboot but it might be a good way to verify you get the behaviour you are looking for before making the changes persist between boots.
ifconfig eth0:0 192.168.5.12 netmask 255.255.255.0 up
If this works for you, then you could try to persist those changes with a new connection profile, or by running your container as privileged with network: host and create the alias on app startup.
Thank you for your response. I’m actually doing it this way for now but need to provide persistance. I can add static IP addresses with the below configuration but what I need is to set address1 as auto (from dhcp). Thanks for your time :
Hi there, have you tried creating a new connection (e.g.
my-ethernet) as per this doc and placing it into the resin-boot/system-conections folder in the balenaOS .img file? This is a FAT partition and can be mounted on most desktop operating systems. If you then flash that image to the device, your custom ethernet profile should become the default.