LinuxQuestions.org
Visit Jeremy's Blog.
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 01-25-2010, 12:25 AM   #1
RedLeader
LQ Newbie
 
Registered: Mar 2006
Distribution: slackware
Posts: 12

Rep: Reputation: 0
3 NIC linux router


Ok, I have a machine running linux with 3 ethernet interfaces attached.

My Ifconfig:

eth0 Link encap:Ethernet HWaddr 00:60:97:07:a6:54
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::260:97ff:fe07:a654/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:355 errors:0 dropped:0 overruns:0 frame:0
TX packets:536 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:54857 (53.5 KiB) TX bytes:198382 (193.7 KiB)
Interrupt:19 Base address:0xe880

eth1 Link encap:Ethernet HWaddr 00:1b:21:51:8c:ce
inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::21b:21ff:fe51:8cce/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:94696 errors:0 dropped:0 overruns:0 frame:0
TX packets:89850 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16686463 (15.9 MiB) TX bytes:42181953 (40.2 MiB)

eth2 Link encap:Ethernet HWaddr 00:13:d3:c8:f0:c5
inet addr:172.16.1.10 Bcast:172.16.255.255 Mask:255.255.0.0
inet6 addr: fe80::213:d3ff:fec8:f0c5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:91748 errors:0 dropped:0 overruns:0 frame:0
TX packets:93550 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:42565252 (40.5 MiB) TX bytes:17681483 (16.8 MiB)
Interrupt:22 Base address:0x8000

My route output:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
bras2-l0.stlsmo * 255.255.255.255 UH 0 0 0 ppp0
192.168.2.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
172.16.0.0 * 255.255.0.0 U 0 0 0 eth2
loopback * 255.0.0.0 U 0 0 0 lo
default * 0.0.0.0 U 0 0 0 ppp0


eth0 is attached to a laptop, eth1 is attached to a PC. eth2 is attached to a DSL modem, and the server is successfully acting as my internet gateway. The trouble is, my PC cannot see my laptop and vice versa. E.G. cannot ping, host seems down. I feel like I'm overlooking something silly, so I wouldn't mind any feedback.

Thanks in advance
 
Old 01-25-2010, 12:36 AM   #2
tacorama
Member
 
Registered: Sep 2009
Distribution: Slackware
Posts: 39

Rep: Reputation: 16
does the laptop have an IP address in the 192.168.1.0/24 network and is its interface up/enabled?

if that checks out try directing the ping to go out a specific interface...

ping -I eth0 192.168.1.X
 
Old 01-25-2010, 12:49 AM   #3
RedLeader
LQ Newbie
 
Registered: Mar 2006
Distribution: slackware
Posts: 12

Original Poster
Rep: Reputation: 0
Sorry, my post may have been misleading... from the server, I can see every machine on the network. From my PC or from the laptop, I can only see the server. What I was trying to accomplish was being able to see my laptop from my PC by routing traffic through the server, and vice verse.
The laptop and PC each only have one interface.

Thanks

Edit: The laptops IP is 192.168.1.17, with 192.168.1.1 (eth0 on the server) set as its gateway. My PCs IP is 192.168.2.2, with 192.168.2.1 (eth1 on the server) set as its gateway.

Last edited by RedLeader; 01-25-2010 at 12:51 AM.
 
Old 01-27-2010, 10:25 AM   #4
tacorama
Member
 
Registered: Sep 2009
Distribution: Slackware
Posts: 39

Rep: Reputation: 16
oh ok, so if i understand, youre looking to route traffic from laptop network 192.168.1.0/24 to pc network 192.168.2.0/24 thru the linux server.

you must ensure that the file /proc/sys/net/ipv4/ip_forward contains a 1 to enable ip forwarding, 0 is disabled(default).

then you must issue some iptables commands, since i dont know exactly how to do it off the top of my head, ill refer you to iptables man page and other examples in other threads.

i hope this gets you started.
 
Old 01-27-2010, 12:30 PM   #5
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Look:

eth0 Link encap:Ethernet HWaddr 00:60:97:07:a6:54
inet addr:192.168.1.1 Mask:255.255.255.0

eth1 Link encap:Ethernet HWaddr 00:1b:21:51:8c:ce
inet addr:192.168.2.1 Mask:255.255.255.0

PC and laptop is in different networks, they can see each other only through router/server.
So make sure you insert 1 to /proc/sys/net/ipv4/ip_forward, as it was suggested before, and you need to add:
FORWARD -i eth0 -o eth1 -j ACCEPT
FORWARD -i eth1 -o eth0 -j ACCEPT
to iptables or change default rule for FORWARD to ACCEPT.
And, of course, you need to start iptables service.
 
Old 01-27-2010, 02:36 PM   #6
RedLeader
LQ Newbie
 
Registered: Mar 2006
Distribution: slackware
Posts: 12

Original Poster
Rep: Reputation: 0
Wink

Sorry I haven't posted in a few days, writing a huge paper over here :/

I ran some tests with wireshark and found that my windows PC didn't even seem to transmit any traffic when I was trying to ping the other segment of the network. I reboot into slackware (the machine dual boots) and found that I suddenly had no trouble pinging the laptop or the laptop's gateway. Everything was working perfectly. I don't know what winXP's problem is here...
The laptop wasn't able to ping my PC or it's gateway because I'd placed some rules in my iptables rules file that prohibited that. I guess I just forgot. Upon removing these rules, the laptop was able to see the other segment without any problems.
So the problem was never with the gateway machine, this is just windows having some issue with my setup.
Thanks to all for taking some time and giving me some input.

Sorry to waste your time
 
  


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
Linux router NIC issue wr3ck3d Linux - Networking 2 07-22-2009 12:26 PM
2 External Nic, 1 Internal Nic Router Problem trevanda Linux - Networking 0 10-13-2004 01:20 AM
Multi-NIC router whirlpool78 Linux - Networking 3 09-15-2004 01:18 PM
2 nic router problem williamc Linux - Networking 2 12-04-2003 10:32 PM
Need help with 3-NIC linux router psion Linux - Networking 10 06-06-2002 06:30 PM

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

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