Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to build a linux router

Status
Not open for further replies.

patn

Technical User
Jun 16, 2000
5
0
0
US
How does one set up a linux box as a router? do i need to use ipchains + port
forwarding? I've got a box w/2 nics, have ip'd them properly and set up the
proper (?) routes. a box on either side of the router can ping both cards in
the router and the router can ping both boxes, but a box on one side of the
router cannot get through the router to the other.

box a 1.3.5.9<---> router((1.3.5.1-eth0)(2.4.6.1-eth1)) <--->box b 2.4.6.8
netmasks are all configured alike - 255.255.255.0

my routes are:
route add -net 1.3.5.0 dev eth0 --- all traffic to 1.3.5.0 net use eth0
route add -net 2.4.6.0 dev eth1 --- all traffic to 2.4.6.0 net use eth1
and do show in the rouing table
a ping from 1.3.5.x to 2.4.6.x fails
i commented out the gateway line in /etc/sysconfig/network expecting
my routes to handle traffic.
This is a lab setup + so there are none of the intricacies you might find in
a production situation + the router's linux install is just a clean server install
of rh7.2 Patrick Novak
pat.novak@po.state.ct.us

 
First, you need forwarding turned on: Something like

echo 1 > /proc/sys/net/ipv4/ip_forward

if you have no gui tool to turn it on with (or can't find the darn thing which is usually my problem)


Next, things on each side of the router do need to know that the router address on their lan has a route to the other lan (or just make it the default route in many situations).

So a machine on the 2. network might have its default route set to 2,4.6.8 (btw- you shouldn't be using these addresses- use 192.168, 10. or 172.16. - 172.31. for internal machines- this will save you trouble later).

Or it could just have a route to the 1. network instead of default- but it's GOT to have a route.

See if you don't understand that.
Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
hi,

The main thing you need to do to allow linux to forward packets is just to turn on forwarding by setting a flag in the /proc 'filesystem' :

echo &quot;1&quot; > /proc/sys/net/ipv4/ip_forward

Because /proc only exists as a window on kernel memory when the system is up then you have to place that command somewhere it will be executed each reboot - e.g. in /etc/rc.d/rc.local . There is also a parameter in one of the redhat config files under /etc/sysconfig that should do the same thing.

If you have the ipchains service active (/sbin/chkconfig --list ipchains) then you are running the redhat firewall and you either have to configure it to allow traffic though or disable the service if its all entirely internal and you're not worried about security. To check if it makes a difference you can (temporarily) stop the service :

/etc/rc.d/init.d/ipchains stop

and to start again....

/etc/rc.d/init.d/ipchains start

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top