Operating System - Linux
1833467 Members
2553 Online
110052 Solutions
New Discussion

Configuring static routing in redhat linux 4

 
SOLVED
Go to solution
Karthikeyan.j
Frequent Advisor

Configuring static routing in redhat linux 4

Hi All

I have a system with two ips confgiured one private and one public ip
Need to know how to setup static routing between them

Public ip : 170.86.131.X configured with eth0
Private ip : 192.168.0.X configured with eth1

my routing table is as follows
4 REPLIES 4
Ivan Ferreira
Honored Contributor

Re: Configuring static routing in redhat linux 4

>>> static routing between them

If you want to allow packets from one subnet to another, you have to configure ip_forwarding:

Edit the file /etc/sysctl.conf

net.ipv4.ip_forward = 1

Then run "sysctl -p"

For static routes, please see:

http://www.cementhorizon.com/wiki/index.php/Static_Persistent_Routes_under_Red_Hat_Enterprise_Linux_3_RHEL_3
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
dirk dierickx
Honored Contributor
Solution

Re: Configuring static routing in redhat linux 4

that's not what he wants to do.

you can add routes to a network interface like this:

route add -net netmask dev

for your case, i guess you want to route traffix to the private ip and the default gw in set on the public ip, you will need to use the following command:

route add -net 192.168.0.0 netmask 255.255.255.0 dev eth1

however, it appears there is a more advanced way to do routing now (i always used above command) with lartc tool.

more info in the manpage (man ip) or from the project page: http://lartc.org/

Karthikeyan.j
Frequent Advisor

Re: Configuring static routing in redhat linux 4

Hi All

Thank u all for the help

I had set route add -net 192.168.0.0/24 dev eth1 and checked

we are able to ping from 192.168.0.X to 192.168.0.X but from the scan device ip 192.168.0.X whihch is in connected thru vpn when we try to ping to public ip 170.86.X ping is failing.

Actually the device to work they needs the communication between private ip thru public ip .


Any suggestions Pls help

Thanks
Karthik
dirk dierickx
Honored Contributor

Re: Configuring static routing in redhat linux 4

in that case, you have to do what the first post suggested, because you want packets to go from one network to the other.