I’m doing some testing using some Ubuntu server and I wasn’t able to ping across from other server I’ve got. I checked the network and it was fine, so I can checked the server and saw that the routing on the server was acting unexpcted :/
Checked the network file /etc/network/interfaces and that was fine
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet static address 192.31.3.2 netmask 255.255.255.0 gateway 192.31.3.1
However when I checked the routing table the default gateway was going via the management subnet
[email protected]:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.1.0.1 0.0.0.0 UG 0 0 0 eth0 10.1.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.31.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 [email protected]:~$ ip route default via 10.1.0.1 dev eth0 10.1.0.0/24 dev eth0 proto kernel scope link src 10.1.0.140 192.31.3.0/24 dev eth1 proto kernel scope link src 192.31.3.2
Needed to change this, to have the default gateway as 192.31.3.1. Firstly, I had to remove the current default gateway:
[email protected]:~$ sudo route del default
Verified that the route was removed, using ip route
[email protected]:~$ ip route 10.1.0.0/24 dev eth0 proto kernel scope link src 10.1.0.140 192.31.3.0/24 via 192.31.3.1 dev eth1 192.31.3.0/24 dev eth1 proto kernel scope link src 192.31.3.2
To add the new default route, I had to run the command route add default gw {IP address}
[email protected]:~$ sudo route add default gw 192.31.3.1
Then verified with ip route again
[email protected]:~$ ip route default via 192.31.3.1 dev eth1 10.1.0.0/24 dev eth0 proto kernel scope link src 10.1.0.140 192.31.3.0/24 via 192.31.3.1 dev eth1 192.31.3.0/24 dev eth1 proto kernel scope link src 192.31.3.2
Now when I did a mtr to my other test server, routing is working as expected 🙂
My traceroute [v0.85] km-vm3 (0.0.0.0) Mon Aug 3 10:37:15 2015 Resolver: Received error response 2. (server failure)er of fields quit Packets Pings Host Loss% Snt Last Avg Best Wrst StDev 1. 192.31.3.1 0.0% 9 1.0 0.9 0.8 1.0 0.0 2. 172.31.1.2 0.0% 9 0.9 1.0 0.9 1.1 0.0 3. 192.31.1.2 0.0% 9 0.7 0.5 0.4 0.7 0.0
Throughout the troubleshooting (as I’m not a server man!) I did also figure out how to make add a static route as well! This is done by use the command: route add -net [subnet/mask] gw [IP address] dev [interface]
[email protected]:~$ sudo route add -net 192.31.3.0/24 gw 192.31.3.1 dev eth1
As you see the static route was added.
[email protected]:~$ ip route default via 10.1.0.1 dev eth0 10.1.0.0/24 dev eth0 proto kernel scope link src 10.1.0.140 192.31.3.0/24 via 192.31.3.1 dev eth1 192.31.3.0/24 dev eth1 proto kernel scope link src 192.31.3.2
Although this didn’t fix my issue, it was a useful thing to come across as it could be helpful in the future!!
Keeran Marquis
Latest posts by Keeran Marquis (see all)
- Life and Times of an Unemployed Professional Speed Dater #3 - August 5, 2018
- Life and Times of an Unemployed Professional Speed Dater #2 - August 5, 2018
- Life and Times of an Unemployed Professional Speed Dater #1 - August 5, 2018