LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-06-2002, 10:28 PM   #1
cauchy
LQ Newbie
 
Registered: Aug 2001
Distribution: Slackware 7.2
Posts: 13

Rep: Reputation: 0
Odd network configuration


I've got two boxes, one running Slackware 8.0 on the 2.4.5 kernel and one running Slackware 8.1 on the 2.4.18 kernel, and am trying to configure the first (which we'll call A) to be a gateway to the second (B). Box A is connected to a router on eth0 and to B on eth1; B uses its own eth0 to connect to A.

I've set up the proper routing tables for both so that they may access each other, as well as the outside world, as expected, with B using A as its default gateway. All is well, except for one problem: I've given the router the IP address 192.168.1.1, and all others on the network have 192.168.1.* addresses as well. Box A's address is 192.168.1.254 (since it's a gateway) and B's is 192.168.1.25. Box C, another Linux machine connected directly to the router, has IP address 192.168.1.100. However, apparently box B thinks the entire 192.168.1.* network is connected to interface eth1 on A, and no amount of playing with iptables seems to be able to get it to find a route to C. Their routing tables are configured as follows:

Box A (192.168.1.254):
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
route add default gw 192.168.1.1
route add host 192.168.1.25 dev eth1

Box B (192.168.1.25):
route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
route add default gw 192.168.1.254

I know this setup may seem odd, but it's necessary due mainly to a lack of Ethernet ports around my house. I'm not sure exactly what else I need to do to get box B to find box C or the rest of the 192.168.1.0/24 network; can someone tell me what I might be missing (either in routing or in iptables)?

Thanks,
cauchy
 
Old 07-07-2002, 10:37 AM   #2
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 332

Rep: Reputation: 32
I don't think you can get by with just one subnet (192.168.1.1) here.

Your router to the internet is .1.1
your box A is 1.254 on eth0.
box b is 1.25, that means that box A's eth1 must be on 1.x as well.
You tell B that a whole subnet 192.168.1.0/255.255.255.0 is connected to its eth0, and that's what you say is the symptom, but that is clearly not what your setup is.

You must assign a different subnet to eth1 on A, and eth0 on B, say, call eth1 on A 192.168.2.1 and eth0 on B .2.2. A must then be setup to masquerade or route traffic to 2.x, so you have two routers in your setup.

Then tell B that 192.169.2.1 is its gateway. If B requests 192.168.1.1 (say, to go out to the internet) it will see that .1.1 is not within its own netmask range, and go to the gateway (A) which receives that request on eth1and sends it to 1.1 on eth0.

Once more: you cannot have the same netmask range on BOTH sides of a router (your box A)

Set up masquerading. Then you have to explicitly allow ip forwarding in A's kernel.

Lots of work to save 30 bucks for a switch...

Martin
 
Old 07-07-2002, 12:05 PM   #3
cauchy
LQ Newbie
 
Registered: Aug 2001
Distribution: Slackware 7.2
Posts: 13

Original Poster
Rep: Reputation: 0
Almost there...

Thanks for the advice about moving B to a new subnet; I set up a 192.168.2.0/24 subnet, moved it there, and updated the appropriate routing tables and hosts files, and now it can access everything without any trouble whatsoever. However, there are two odd problems remaining:

1) Box A often pauses for a few seconds before giving me a prompt, as if it's hanging on something. This only happens when eth1 is up.

2) I can directly access box C (192.168.1.100) from B, but not the other way around, and C thinks I'm actually coming from A when I do so. I told my router to use box A as the gateway for the 192.168.2.0/24 subnet, but it's still not working, so I think I don't have the IP masquerading properly configured. I set up iptables on box A with the following commands:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT

I'm probably missing something, though, since my knowledge of iptables is at best sketchy. What else do I need to do to make box C find B?
 
Old 07-07-2002, 04:38 PM   #4
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 332

Rep: Reputation: 32
Well, I'm an ipchains kind of guy guy - one day I'll learn iptables, but I had too many surprises, and people being paid to know that stuff are getting surprises as well.

That said, the -o eth0 syntax sounds funny. My entries to masquerade to a VmWare network (.22) to my Sharp Zaurus in its cradle (.129.201) and to let them cross-talk, in ipchains-speak, read
Code:
-A forward -s 192.168.22.0/24 -d 0/0 -j MASQ
-A forward -s 192.168.129.201 -d 0/0 -j MASQ
-A forward -s 192.168.22.0/24 -d 192.168.129.201 -j MASQ
strictly with IP's and not interfaces. Dunno.

As usual, post some netstat -rn outputs, watch the /var/log/messages log file.

Martin
 
Old 07-09-2002, 08:42 PM   #5
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Rep: Reputation: 30
Have you thought about bridging? 2.4.x kernels support it.
Then you could keep it all on one subnet.

http://bridge.sourceforge.net/

-Bob
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Slackware 10 network configuration. Problem with 8139 network card drivers ! Padmakiran Linux - Networking 8 03-27-2007 07:48 AM
Odd sound during network activity Vgui Linux - General 5 08-30-2005 02:51 PM
Network Configuration Hanging in FC4 After Using Wireless Network Wizard Trip in VA Linux - Wireless Networking 2 07-18-2005 09:32 AM
very odd network problem (haven't seen it asked yet) the bishop Mandriva 6 06-22-2004 04:38 PM
Odd Network Setup problem Rekna Linux - Networking 2 03-30-2004 12:16 AM


All times are GMT -5. The time now is 01:33 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration