LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-29-2003, 08:29 AM   #1
lathspel
LQ Newbie
 
Registered: Sep 2003
Location: Cape Town, South Africa
Distribution: Redhat 9
Posts: 10

Rep: Reputation: 0
Setting RH9 box up to route


I am having a issue getting my RH9 box to pass packets from 192.168.0.4 (W2K box) to 192.168.0.3 (2nd RH9 box ). The RH9 box is set up with 2 NICS (192.168.0.1/2)

Should the W2K box be using 192.168.0.1 as its gateway while the 2nd RH9 box uses 192.168.0.2 as its gateway.

How should the routing table be set?

Thanks for the help in advance.
 
Old 09-29-2003, 08:51 AM   #2
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789

Rep: Reputation: 30


Are any of the computers attached to the internet? It seems strange that you would be trying to use the RH9 box to pass packets to computers that are both on the same Subnet. I think a Hub (or router if connected to the Inet) would make your life much easier.

That being said, yes, it can be done. Check out the HOWTO for iptables and you can set it up so that the RH9 box in the middle will forward all packets from 192.168.0.3 to 192.168.0.4, and from 192.168.0.4 to 192.168.0.3.

slight
 
Old 09-29-2003, 09:02 AM   #3
lathspel
LQ Newbie
 
Registered: Sep 2003
Location: Cape Town, South Africa
Distribution: Redhat 9
Posts: 10

Original Poster
Rep: Reputation: 0
Sounds easy enough

Yip...the Linux box is connected to the internet. This is more a experiment to help me understand Linux Routing etc. I've actually set the RH9 box up as a fileserver so my buddy (W2K) can play MP3's from it while I (RH9 #2) can pull other files from it. The next step is to allow RH9 #2 and W2K to access the inet going through RH9 #1.

How tough is this.

Thanks for the quick response.
 
Old 09-29-2003, 10:16 AM   #4
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789

Rep: Reputation: 30
Shouldn't be too tough, once you get the sytax for Iptables down.

Does the RH9 box have 3 NICs in it then? One connected to each client and one connected to the Inet? If so, then just think of what route the packets will need to take to make it to their destination.

Packets coming from the Win2k box (which will have it's DG pointing to the NIC on the RH9 'router' that it is connected to) will need 2 rules. If the destination is internal, then the packets will be forwarded to the RH9 client. If the destination is external then the packets will be forwarded to the Inet.

slight
 
Old 09-29-2003, 01:05 PM   #5
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
a few things you must to to setup a Linux router:

1. allow forwaring

edit the fllowing file: /etc/sysctl.conf

change the line that reads:

net.ipv4.ip_forward=0

to

net.ipv4.ip_forward=1

that turns on IP forwarding.

also do this to turn it on without rebooting:
# echo 1 > /proc/sys/net/ipv4/ip_forward


If you Linux box is getting an internet connection, do not edit it's gateway.


Another thing you need to know about routing and what not is that 192.168.X.X ip addresses cannot be seen on the internet. They are not internet routable. What you have to do is use your external IP address as a MASK (MASQ) for you 192.168 address. (MASQUERADE).

to do this, you'll have to use iptables (as suggested by slightcrazed).

/sbin/iptables -A POSTROUTIN -t nat -s 192.168.0.0/24 -d ! 192.168.0.0/24 -j MASQUERADE

that will alter the ip of you XP box so that anything leaving the router from the XP box will look like it came directly from the router. Linux automatically handles the packets comming back and knows to send replies back to the XP box.

You'll also want to setup the DNS servers on your XP box so that it will be able to resolve hostnames.

so if your internal ip on the linux box is 192.168.0.1....the XP should have its gateway as 192.168.0.1
it's subnet mask as 255.255.255.0 it's ip as something like 192.168.0.X (where X is not 1 or 255) and the DNS servers should be set to whatever your ISPs DNS servers are (they may be listed in /etc/resolv.conf on the Linux box)

you'll want to use more iptables rules for security also by the way. (you can do stuff like block ports outgoing and incomming, block certain ip addresses, block certain MAC addresses on your network from getting a connection, block all kinds of other stuff...).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up Static Route for two Networks ctrylace Linux - Networking 2 07-23-2004 03:18 AM
XP Box won't connect to internet thru RH9 Box (firewall/dhcpd), it can only ping fire Rhapsodic Linux - Networking 4 07-10-2004 03:02 PM
How to route email through RH9 kbrian38 Linux - Networking 3 06-11-2004 04:25 AM
how do you set up your Linux box to route secure wifi? richard3403 Linux - Wireless Networking 0 11-15-2003 02:40 PM
Why does 12.170.16.134 route to the wrong box?? registering Linux - Networking 3 09-24-2003 10:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration