Today we are going to learn how to fix route issues on Linux. Suppose you have 2 NIC interface (one is for public traffic - 100 GBPS Link and other one in Private interface for private communication 10 GBPS Link ).
What is the exact issue ?
Initially our customers reported that they were unable to reach internet on the box (They tried performing ping 8.8.8.8 -or- ping google.com). It was not working via both IP and domain name even tried with browser.So lets begin the troubleshooting :
Step 1 : Replicate the issue from your side, because we need to be 100% sure before deep diving.
Step 2 : We were able to replicate the same. It was 100% packet loss. So now we need to check if the public interface is up and running or not. Our public interface is eth1 so run command : ip a
This will show you if interface is UP / Down. Eth1 was up and running here.
Step 3 : Next I was interested to see how is the traffic going out - is it crossing any single hop or not , whether Gateway is reachable or not. To find that , you can use TRACE ROUTE Command.
Using traceroute helped to identify that the traffic was actually going via the private interface gateway instead of public interface. This indicates something was wrong with routing table.
Step 4 : Use netstat -rn or ip route show command to see the route. Checked the outgoing traffic 0.0.0.0 and found it was mapped to Private gateway.
Step 5 : Now as we have identified the cause, it's time to change the route to Public. Use below command :
ip route change 0.0.0.0/0 via <PublicNic Gateway IP> dev eth1
Step 6 : This helped us to fix the issue. But note this is not a persistent route i.e. if system reboots these changes will get removed. so time to make it persistent, use the below command :
vi /etc/sysconfig/network-scripts/routes-eth0
now in VI Editor just add the routes you want like below
10.86.128.0/20 via 10.25.68.1
Comments
Post a Comment