losing default route (desperately need a work around)

New to Debian (Or Linux in general)? Ask your questions here!

losing default route (desperately need a work around)

Postby rsc179 » 2020-06-18 14:25

I've done a little with Linux, by no means am I an expert, I occasionally struggle with some basic stuff.
My use of any Linux is limited to appliance type devices, so often times I'm limited in what I can do to things that won't violate support agreements.
I mention this because it's very possible the problem was fixed in an update, but I can't apply updates until/unless they are vetted by the appliance creator.

What I see happening:
Debian 9 virtual machine on esxi 6.7
At boot everything is good.
The conf files contain the correct information, static IP GW, etc.
I disconnect (NOT REMOVE) the virtual network connection, and then reconnect.
I can reach the local IP, and it can connect to anything local. But the default gateway is gone from the active routes.
The config is all still there and good, and rebooting brings it back.
But I need this to recover when the NIC is reconnected.

Like I said, I'm limited in what I can do because of the support agreement, so I was thinking a script that runs when the interface comes up that reapplies the default gateway. I tried doing this unassisted and, well, someplace I did something wrong. So now I'm back to a clean install.

If anyone can help with a Dummies guide to doing this it would be greatly appreciated.
Thanks
rsc179
 
Posts: 5
Joined: 2020-06-18 11:48

Re: losing default route (desperately need a work around)

Postby Head_on_a_Stick » 2020-06-18 14:55

rsc179 wrote:The conf files contain the correct information, static IP GW, etc.

*What* configuration files? How are you connecting? You should show us the actual content of these mysterious configuration files, you may have made a mistake.

rsc179 wrote:I was thinking a script that runs when the interface comes up that reapplies the default gateway. I tried doing this unassisted and, well, someplace I did something wrong

And again, show us what you tried and explain more fully what exactly went wrong.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12159
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: losing default route (desperately need a work around)

Postby p.H » 2020-06-18 15:19

rsc179 wrote:I disconnect (NOT REMOVE) the virtual network connection, and then reconnect.

What do you mean exactly by "disconnect" and "reconnect" ?
Set the interface down and up with ifconfig or ip link ? Setting an interface down deletes all its associated routes, and setting it up again restores only direct subnet routes related to assigned IP addresses.
p.H
 
Posts: 1365
Joined: 2017-09-17 07:12

Re: losing default route (desperately need a work around)

Postby rsc179 » 2020-06-18 15:49

Head_on_a_Stick wrote:
rsc179 wrote:The conf files contain the correct information, static IP GW, etc.

*What* configuration files? How are you connecting? You should show us the actual content of these mysterious configuration files, you may have made a mistake.

rsc179 wrote:I was thinking a script that runs when the interface comes up that reapplies the default gateway. I tried doing this unassisted and, well, someplace I did something wrong

And again, show us what you tried and explain more fully what exactly went wrong.

I tried all of these with the same results
/etc/network/interfaces

# The primary network interface
allow-hotplug ens192
iface ens192 inet dhcp

# The primary network interface
allow-hotplug ens192
iface ens192 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.1


# The primary network interface
auto ens192
iface ens192 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.1

# The primary network interface
allow-hotplug ens192
iface ens192 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
up route add default gw 192.168.10.1


# The primary network interface
auto ens192
iface ens192 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
up route add default gw 192.168.10.1


Then tried this
/etc/network/if-up.d/reloadgw

#!/bin/sh
route add default gw xxx.xxx.xxx.1 ens192

and this
#!/bin/sh

ip route add default via xxx.xxx.xxx.1 dev end192


But I'm not sure reloadgw is even running. I know the permissions are right and I added the path to /etc/login.defs ENV_PATH which I'm not sure is the right place to do this.

After that I was just throwing stuff at the wall, no logic to it and I didn't keep track, eventually this ended with the networking not working at all.
rsc179
 
Posts: 5
Joined: 2020-06-18 11:48

Re: losing default route (desperately need a work around)

Postby rsc179 » 2020-06-18 15:52

p.H wrote:
rsc179 wrote:I disconnect (NOT REMOVE) the virtual network connection, and then reconnect.

What do you mean exactly by "disconnect" and "reconnect" ?
Set the interface down and up with ifconfig or ip link ? Setting an interface down deletes all its associated routes, and setting it up again restores only direct subnet routes related to assigned IP addresses.

In vmware the virtual machine settings, the check box to "connect" the virtual NIC. Essentially the OS will see this as I unplugged the network cable. This accurately simulates a layer 2 loss of connectivity.
rsc179
 
Posts: 5
Joined: 2020-06-18 11:48

Re: losing default route (desperately need a work around)

Postby p.H » 2020-06-18 20:56

Weird. AFAIK, and I just checked again, the link state does not have any effect on static IPv4 routes associated to an interface configured by /etc/network/interfaces.

Is ifplugd istalled ?
p.H
 
Posts: 1365
Joined: 2017-09-17 07:12

Re: losing default route (desperately need a work around)

Postby rsc179 » 2020-06-19 19:37

p.H wrote:Weird. AFAIK, and I just checked again, the link state does not have any effect on static IPv4 routes associated to an interface configured by /etc/network/interfaces.

Is ifplugd istalled ?

That did it. Installed ifplugd configured it for the interface, and it keeps the route.
Awesome :-)

A little background if anyone is interested.
It's a pair of Debian 9 boxes running the 3CX SBC as an HA pair. There is a heartbeat between them and when the primary fails the secondary brings up the "virtual" IP address and starts the SBC service. When the primary comes back on line there is a delay and then the process reverses. The problem was that if it fails over due to the network connection dropping (an L2 drop, like a switch being rebooted), it would lose the default route, but local traffic would be ok. So the heartbeat would be good and the primary would come back online. BUT the PBX they have to connect to is in the cloud, and there would be no route back to it on the primary. And that takes the site offline.

I don't know why they haven't fixed it. I'm not a Linux dev, but with you help I got it fixed.
rsc179
 
Posts: 5
Joined: 2020-06-18 11:48

Re: losing default route (desperately need a work around)

Postby rsc179 » 2020-06-22 12:22

looks like I spoke too soon, it's back to the same problem but with ifplugd installed and configured
rsc179
 
Posts: 5
Joined: 2020-06-18 11:48

Re: losing default route (desperately need a work around)

Postby p.H » 2020-06-22 12:58

Can you post the current network configuration files ?
p.H
 
Posts: 1365
Joined: 2017-09-17 07:12


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 13 guests

fashionable