Discussion Locked

Router Configuration in Linux 6.2

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How to configure a linux system as a router?
Try to give step by step procedure.

9 replies

by cpfeiffe

By default the server will route between its own interfaces. To allow routing from a source to an address you just need to add static routes (route add -net $source_network -netmask $netmask_of_source_network $destination). You can make this automatic by adding these lines to a startup script so you don't need to do it every time you reboot. Another method that will be easier, but less secure is to install software (like gated) that will learn routes.

by kevin anderson

Not to be flippant, but I found the MAN pages great for that. Type MAN ROUTE at the prompt. You'll get all sorts of examples for setting up a script.

I would also suggest that once you have everything working, copy it to a file, (rc.route, for example) and call it from inside rc.local. My rc.route looks like this (I'm no expert, but it works)...

/sbin/route add -net 10.128.0.0 netmask 255.255.0.0 gw 10.129.205.1
/sbin/route add -net 10.133.0.0 netmask 255.255.0.0 gw 10.129.205.253
/sbin/route add -net 10.129.190.0 netmask 255.255.255.0 gw 10.129.205.253

The first one routes anything destined for 10.128.???.??? through the 10.129.205.1 gateway.

The second and third route 10.133.???.??? and 10.129.190.??? through a gateway of 10.129.205.1
Hope that helps.
Kev.

by zbrain75

1. Enable ipforwarding in /etc/sysconfig/network with the statement:
FORWARD_IPV4="yes"
2. Set up your route table or use a dynamic routing protocol as mentioned in an earlier comment. See the following URL for more information on routing tables and how to set them up:
http://ctdp.tripod.com/os/linux/usersguide/index.html
See item 50. With Redhat you can use linuxconf or netconf from the command line to set up your routing and make your settings permanent or you can add your routes to /etc/sysconfig/static-routes.

by arg cio

I think I am having the same problem. I have enabled IP forwarding, and IP defrag, but IT STILL WON'T ROUTE! After EXTENSIVE testing, I am able to prove that the packets make it out, but never get back. I have tried routed, gated, and all the IPCHAINS commands I can find, and NONE work. I am about to go back to NT, and make it do the job, as RH linux doesn't seem to cut it. Everyone says "It will automatically route between two NICs". That is BS! I have loaded 6.2 12x, and 7.0 4x and I getthe same results! Routing doesn't "just happen", and I am pissed off! I have been fighting this for over a month now, and NO ONE seems to have a working answer! I have a question posted on here.

https://www.techrepublic.com/forumqa/thread_detail.jhtml?thread_id=44101

if you have the answer, post it, and I'll give you more points! 150 may not be worth your time, but 1500 should be.
I WILL copy the answer to sudhakaran_c@yahoo.com if I come up with one.

by arg cio

okay.. follow the LVS how-to! See IP MASQ HOW-O also

upgrade your kernel to 2.2.16-4 or above
in your rc.local file...

ipchains -P forward -j DENY
ipchains -A forward -i eth0 -j MASQ
echo 1 > /proc/sys/net/ipv4/ip_forward

then reboot, and all should be well!

This discussion is closed to new replies.