LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 04-26-2004, 10:08 PM   #1
xatmes
LQ Newbie
 
Registered: Jul 2003
Location: Kalamazoo, MI
Distribution: Slackware 10.2
Posts: 10

Rep: Reputation: 0
Angry Help with Subnet Routing


Ok I have a linux gateway with 3 interfaces.

eth0 -> internet
eth1 -> 192.168.1.1
eth3 -> 192.168.2.1 ( wireless card in ad-hoc mode connected to 192.168.2.2 )

Basically, all I want to be able to do is ping from behind the 192.168.1.0/24 subnet ...say, from 192.168.1.3 and be able to hit the IP behind the 192.168.2.0/24 subnet, and of course vice versa ( 192.168.2.2 -> 192.168.1.3 )

Is this a routing issue or an IPtables issue?

Any help would be greatly appreciated!

My routing table looks like this:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
67.161.232.0 * 255.255.255.128 U 0 0 0 eth0
192.168.0.0 * 255.255.0.0 U 0 0 0 eth3
192.168.0.0 * 255.255.0.0 U 0 0 0 eth1
loopback * 255.0.0.0 U 0 0 0 lo
default c-67-161-xxx-x. 0.0.0.0 UG 0 0 0 eth0

My forwarding rules look like this...

# Shut off all forwarding to the outside world
/usr/sbin/iptables -P FORWARD DROP
/usr/sbin/iptables -A FORWARD -s 192.168.1.0/24 -j ACCEPT
/usr/sbin/iptables -A FORWARD -d 192.168.1.0/24 -j ACCEPT
/usr/sbin/iptables -A FORWARD -s 192.168.2.0/24 -j ACCEPT
/usr/sbin/iptables -A FORWARD -d 192.168.2.0/24 -j ACCEPT
 
Old 04-26-2004, 10:39 PM   #2
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
got quite a similar layout (but other routing):

router setup:
eth0 takes 192.168.1.0/24 (my private) and eth1 takes a internal lan (192.168.2.0/24) with a connection to the www.

i tell my kernel/ethers how to route:
(ip) route add -net 192.168."1".0 netmask 255.255."255".0 eth0 ..
and
route add -net 192.168."2".0 netmask 255.255."255".0 eth1 ..
route add default gw 192.168.2.1 (the gate to www somewhere in the lan).

when i now say to a client (somewhere in 192.168.1/2.x) that the router is the default gateway, the client sends his packet there. the router decides where to put the packet and sends it out over the right interface. he knows, that he can reach 192.168.1.x on eth0 and 192.168.2.x on eth1.

i think you have to give the ethers other IP-ranges (like above .1.0&.2.0). netmask should be 255.255.255.0 on both eth1 and eth3.

hope i could help a bit. bye ritch.
 
Old 04-26-2004, 11:30 PM   #3
xatmes
LQ Newbie
 
Registered: Jul 2003
Location: Kalamazoo, MI
Distribution: Slackware 10.2
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for the reply...I changed the netmasks for the interfaces back to 255.255.255.0.

What I am confused about is your suggestion for default route....are you saying to add a default route for the 192.168.2.0/24 interface on the gateway? It doesn't seem to behave well with more than one default route...? Thanks
 
Old 04-27-2004, 12:03 AM   #4
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
well, "your" default route would be eth0 - everthing not matching 192.168.1.x (eth1) and not matching 192.168.2.x (eth3) will go to the internet. i don't know how to set this up if you have a dynamic IP-address, but information is somewhere out there. if it's fix ..use:

add default gw 67.161.232.x <-- this is the number you got from your isp.

else.. read the HOWTO's. ritch.
 
Old 04-27-2004, 12:16 AM   #5
xatmes
LQ Newbie
 
Registered: Jul 2003
Location: Kalamazoo, MI
Distribution: Slackware 10.2
Posts: 10

Original Poster
Rep: Reputation: 0
Well I understand about the default route to the internet...that's all set up probably. Both subnets can get to the internet but the subnets are invisible to eachother.....I look at the tcpdump of 192.168.1.0/24 interface and it gives arp requests..."arp who-has 192.168.2.2 tell 192.168.1.3"....but the interfaces don't seem to want to communicate with eachother. I know I'm missing something really simple here, any ideas? Thanks again
 
Old 04-27-2004, 12:49 AM   #6
xatmes
LQ Newbie
 
Registered: Jul 2003
Location: Kalamazoo, MI
Distribution: Slackware 10.2
Posts: 10

Original Poster
Rep: Reputation: 0
Ok....I feel like an idiot....just had to add routes to the 192.168.2.0/24 subnet via the 192.168.1.1 gw to each machine. Thanks for the help though!
 
Old 04-27-2004, 12:52 AM   #7
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
your "route -n" should say something like that:

192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
something something for internet eth0
0.0.0.0 something 0.0.0.0 UG 0 0 0 eth0

now. if i ping 192.168.2.23 from 192.168.1.55 it "should" work (i have to tell 192.168.1.55 to take the default gateway 192.168.1.1 "route add default gw 192.168.1.1" to reach the 2nd net).

your eth1 is 192.168.1.1 and eth3 is 192.168.2.1?
what's about eth2? how's your setup?
 
  


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
routing http traffic to the correct box on subnet nodine Linux - Security 1 07-15-2004 10:51 AM
routing from one subnet to another NetAX Linux - Networking 2 06-16-2004 09:10 AM
Aargh!!! Not routing to local subnet sancho5 Linux - Networking 5 02-10-2004 03:11 AM
routing problem with the same subnet nobody Linux - Newbie 1 10-03-2003 03:23 PM
NAT'd subnet routing question ealpert1 Linux - Networking 10 05-19-2003 03:07 PM


All times are GMT -5. The time now is 09:32 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