Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
losing default route (desperately need a work around)
losing default route (desperately need a work around)
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
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
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: losing default route (desperately need a work around)
*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:The conf files contain the correct information, static IP GW, etc.
And again, show us what you tried and explain more fully what exactly went wrong.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
deadbang
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: losing default route (desperately need a work around)
What do you mean exactly by "disconnect" and "reconnect" ?rsc179 wrote:I disconnect (NOT REMOVE) the virtual network connection, and then 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.
Re: losing default route (desperately need a work around)
I tried all of these with the same resultsHead_on_a_Stick wrote:*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:The conf files contain the correct information, static IP GW, etc.
And again, show us what you tried and explain more fully what exactly went wrong.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
/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.
Re: losing default route (desperately need a work around)
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.p.H wrote:What do you mean exactly by "disconnect" and "reconnect" ?rsc179 wrote:I disconnect (NOT REMOVE) the virtual network connection, and then 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.
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: losing default route (desperately need a work around)
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 ?
Is ifplugd istalled ?
Re: losing default route (desperately need a work around)
That did it. Installed ifplugd configured it for the interface, and it keeps the route.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 ?
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.
Re: losing default route (desperately need a work around)
looks like I spoke too soon, it's back to the same problem but with ifplugd installed and configured
Re: losing default route (desperately need a work around)
I posted all the different network configurations I tried above.
-
- Posts: 5
- Joined: 2021-09-28 01:59
Re: losing default route (desperately need a work around)
Did you resolve this? I am a 30 year IT career support person, with over 15 years experience with VMware, not to mention Hyper-V, KVM, etc. And I just built a Debian 11 based VM using VMware Player 16 on Windows 10, and it has no default gateway configured, even though I am using a valid DHCP server that is sending the gateway 'router' information request back to the VM. The physical NIC is in bridged mode, not using NAT, I have built 100s if not 1000s of VMs over the years, with various OSes, and this issue is driving me nuts... It is not common but not exactly in frequent, that Linux OS based VMs have some odd quirks at times. But this issue is being really stubborn to resolve.
Here is the VM Network configuration:
Here is the bridging configuration applicable to the above illustrated configuration:
Linux OS, Debian 11, configuration of NIC:
# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.154 netmask 255.255.255.0 broadcast 192.168.1.255
ether 00:0c:29:f5:40:3a txqueuelen 1000 (Ethernet)
RX packets 52602 bytes 63536259 (60.5 MiB)
RX errors 0 dropped 3 overruns 0 frame 0
TX packets 8465 bytes 616235 (601.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 46 bytes 3914 (3.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 46 bytes 3914 (3.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Root issue, no pun, if lack of a default route...
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
root@Test:~# ping www.google.com
ping: connect: Network is unreachable
Running Raspbian OS on Pi, which is Debian Buster, using the same DHCP server that the above device/configuration is using, receives the correct DHCP configuration including the default (gateway) route. As shown below.
Pi...
# ifconfig
enxb827ebc5e65c: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
ether b8:27:eb:c5:e6:5c txqueuelen 1000 (Ethernet)
RX packets 893849 bytes 78340061 (74.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 760326 bytes 74150969 (70.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 743133 bytes 39014627 (37.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 743133 bytes 39014627 (37.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@infrastructure:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 enxb827ebc5e65c
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 enxb827ebc5e65c
So the question remains... why Debian 11 in a VMware VM is not getting a default gateway. So, as a validation test, I installed Debian 11 on true hardware, not in a VM, and sure enough the default gateway route from the common DHCP server, is present. So the issue is VMware Player on Windows 10 and specific to Debian 11, at least for the VM above. Time to create another VM and see if the issue is consistent.
Here is the VM Network configuration:
Here is the bridging configuration applicable to the above illustrated configuration:
Linux OS, Debian 11, configuration of NIC:
# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.154 netmask 255.255.255.0 broadcast 192.168.1.255
ether 00:0c:29:f5:40:3a txqueuelen 1000 (Ethernet)
RX packets 52602 bytes 63536259 (60.5 MiB)
RX errors 0 dropped 3 overruns 0 frame 0
TX packets 8465 bytes 616235 (601.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 46 bytes 3914 (3.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 46 bytes 3914 (3.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Root issue, no pun, if lack of a default route...
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
root@Test:~# ping www.google.com
ping: connect: Network is unreachable
Running Raspbian OS on Pi, which is Debian Buster, using the same DHCP server that the above device/configuration is using, receives the correct DHCP configuration including the default (gateway) route. As shown below.
Pi...
# ifconfig
enxb827ebc5e65c: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
ether b8:27:eb:c5:e6:5c txqueuelen 1000 (Ethernet)
RX packets 893849 bytes 78340061 (74.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 760326 bytes 74150969 (70.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 743133 bytes 39014627 (37.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 743133 bytes 39014627 (37.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@infrastructure:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 enxb827ebc5e65c
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 enxb827ebc5e65c
So the question remains... why Debian 11 in a VMware VM is not getting a default gateway. So, as a validation test, I installed Debian 11 on true hardware, not in a VM, and sure enough the default gateway route from the common DHCP server, is present. So the issue is VMware Player on Windows 10 and specific to Debian 11, at least for the VM above. Time to create another VM and see if the issue is consistent.