0

I have a notebook that has both a Wired (enxa0cec80070b7) and a WiFi adapter (wlp1s0)

I use my router’s reserved address feature to assign a DHCP address to each device

172.16.68.13: wlp1s0
172.16.68.14: enxa0cec80070b7

This machine will be moved back and forth to a different network (and others) that will have 172.16.71.1 as its gateway.

In /etc/bash.bashrc I have this snippet which will set an environment variable called SERVER_IP which is used by various services.

IP="$(ip addr show enxa0cec80070b7 | awk '$1 == "inet" { print $2 }' | cut -d/ -f1)"
export SERVER_IP=${IP}

Assume I use the router to always assign .13 and .14, regardless of what network the machine is on.

I would always like to be able to use the .14 IP address, even if it’s not connected —- and if it’s not to use the .13 as backup, which should always be connected.

Is this possible?

1
  • 1
    This sounds like an XY problem. What makes you think that device bonding is the right solution (hint: it isn't). How is the default route (what you call "gateway") relevant anyway? What are the netmasks of the two networks?
    – JayEye
    Jul 25, 2019 at 3:00

1 Answer 1

1

No, this is not possible with bonding: bonding will use both adapters at all time and bond their separate addresses together into one (different) IP address.

Furthermore: if the machine does not have any statically linked IP addresses, but reserved DHCP IP addresses only, you'd have to configure all the networks you'd ever connect to to make this work in a reliable way.

So I'm going to tell you what I told the Finance Director of some company I worked for 20 years ago:

No, we cannot change all of our servers in the large server room by a bunch of laptops stacked together one on top of the other in a broom closet. There is a reason that servers are more expensive than a laptop.

Sorry! ¯\_(ツ)_/¯

You must log in to answer this question.

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