Red Hat Linux Static Routing Configuration

Red Hat Linux Static Routing Configuration



I've two network interface connected to two different routers as follows:
 
[a] eth0 LAN network 10.0.0.0/8 - gateway IP - 10.8.2.65
[b] eth1 ISP assigned network 202.54.22.128/28 - gateway IP - 202.54.22.129

I can only ping to public server but not to another servers inside LAN? I'm not able to route traffic via 10.8.2.65. How do I configure static routing under Red Hat Enterprise Linux 5.x or CentOS Linux 5.2?

A. Under Red Hat you need to define static routing using route command. The configuration is stored under /etc/sysconfig/network-scripts/route-eth0 for eth0 interface.

Update route using route command

Type the following command:
# route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.8.2.65 eth0
# route -n

Create static routing file

The drawback of abive 'route' command is that, when RHEL reboots it will forget static routes. So store them in configuration file:

echo '10.0.0.0/8 via 10.8.2.65' >> /etc/sysconfig/network-scripts/route-eth0

Restart networking:
 
# service network restart

Verify new changes:
 
# route -n
# ping 10.8.2.65
# ping 10.8.2.10
# ping google.com
# traceroute google.com
# traceroute 10.8.2.10

Further readings:

  • man pages ip, route command

Comments

Popular posts from this blog

[SOLVED]* Please wait for the system Event Notification service

Rebuild the initial ramdisk image in Red Hat Enterprise Linux

Python reference Interview questions