April 25, 2009

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?

SOLUTION:

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 above '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

No comments:

Post a Comment