LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-25-2007, 04:35 AM   #1
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Rep: Reputation: 30
networking with Three NIC's


hello All,

I am trying to setup My lan, I am having three NIC's in my Linux box as
eth0,eth1 and eth2 .
eth10: 192.168.2.2 with /24 for INternet access connected to access Point and further to adsl.
eth1: 10.0.0.1 with /24
eth2 : 172.20.0.1 with /24

So my linux box is acting as router.I am running dhcp for eth1 and eth2.My problem is i can not route the traffic from eth2 to eth1 and eth0 so no connectivity (ping )with eth1 and eth0, so as the internet.
I am able to go outside(Internet) from eth0 without any problem.

Adsl
|
linksys
|
linuxbox-
| --- eth0-pc1,pc2,pc3...so on
|
| --- eth1-pc1,pc2....
|
| --- rth2---pc1,pc2.pc3....


Thanks

Last edited by soroccoheaven; 08-25-2007 at 04:37 AM.
 
Old 08-25-2007, 08:46 AM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Most likely you have not ip forwarding enabled. As it seems, the Linksys acts as a firewall so you might not need a firewall in your Linux box.

If you have multiple NIC and you want to route traffic between them, you should make *this* machine default gateway, and set up routing tables in this machine to route traffic from one network to the other.

These two article might be of interest, although a bit detailed.

http://www.linuxhomenetworking.com/w...Using_iptables

http://www.brennan.id.au/06-Firewall_Concepts.html

You might try and Google for "linux networking routing firewall forwarding howto" for more basic articles. Since you installed 3 NIC's in you machine I assume you are willing to spend some time to discover the more powerful aspects of Linux networking -- and that needs some time and effort.

jlinkels
 
Old 08-25-2007, 10:22 AM   #3
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Original Poster
Rep: Reputation: 30
thanks jlin.
ip forwarding is enabled, and yes linksys is acting as firewall but i will go for linux firewall/iptable (To learn about it ) in future not now.
will you pls tell me what will be the default gateway of eth0 eth1.and eth2 ? (as they all are different networks )

so what will be DG for eth1 , eth2:
because 192.168.2.2 is set 192.168.2.1 connected to linksys.
and what about eth1 & eth2 ?

whenever i try to ping eth1 or eth2 it goes to wan side means towards dsl ..
 
Old 08-25-2007, 11:38 AM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
For the NIC with IP=192.168.2.2 in Linux box de DG is the IP address of the Linksys (Could that be 192.168.2.1?)

The two other nic's in your Linux box do *not* have a DG in the NIC specification. I repeat: the two other nic's in your Linux box do *not* have a DG in the NIC specification

The machines connected to the 10.0.0.0/24 subnet must have 10.0.0.1 as DG

The machines connected to the 172.20.0.0/24 subnet must have 172.20.0.1/24 as DG

The trick is that if 10.0.0.1 tries to ping 172.20.0.1, it sends the packet to 192.168.2.2 because that is his DG. The Linux machine knows it has a NIC on 172.20.0.1 subnet, so it sends the packet to 172.20.0.1 right away.

However, if 10.0.0.1 tries to ping www.google.com, it sends the request to the DG anyway (your Linux box) but that box doesn't have a direct route to google either, so it forwards the packet to the Linksys.

If packets do not come thru, use traceroute to see where they get stuck. If all else fails, do a route -n on each machine (linux box and 10.0.0.1 and 172.20.0.1) and post it.

Why do you want to use 3 NICs and 2 different subnets BTW? If you have all those troubles to get from one subnet to the other, why did you separate them in the first place?

jlinkels
 
Old 08-26-2007, 06:10 AM   #5
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Original Poster
Rep: Reputation: 30
Thanks jlinkels,

Problem solved i have created the route in linksys for 172.20.0. and 10.0.0.0 now i think everything is working..
one more think can i Put different gateway on eth2 and eth1..because whenever i do this the default gateway of eth0 also get changed same as eth2 or eth1 ..so packets dont go outside.
Can you explain this.

thank you very much

Last edited by soroccoheaven; 08-26-2007 at 06:21 AM.
 
Old 08-26-2007, 06:14 AM   #6
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Original Poster
Rep: Reputation: 30
Thanks jlinkels,

(I am trying to setup this network to understand the Networking basics only.)

Problem solved i have created the static routes in linksys for 172.20.0.X and 10.0.0.X now i think everything is working..
one more think can i Put different gateway on eth2 and eth1 ?..because whenever i do this the default gateway of eth0 also get changed same as eth2 or eth1 ..so packets dont go outside.
Can you explain this.

thank you very much

Last edited by soroccoheaven; 08-26-2007 at 06:20 AM.
 
Old 08-26-2007, 06:31 AM   #7
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Why do yo need different GW for eth1 and eth2?

jlinkels
 
Old 08-26-2007, 10:01 AM   #8
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Original Poster
Rep: Reputation: 30
just wanted to know Is it possible ? or not ..
can i use my eth1 or eth2 instead of eth0 as default gateway ?

Last edited by soroccoheaven; 08-26-2007 at 10:04 AM.
 
Old 08-26-2007, 01:09 PM   #9
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
There is only one route out to the internet, it could be connected to any of the 3 cards, but only to one of them. If two cards have direct internet access (through separate gateways), you're opening a large can of worms.

Yes, you could connect the internet to eth1 instead of eth0, and just redo the setup behind it. Same as currently, the 2 interfaces that are not connected to the internet router do not get gateways on the linux box. That way any traffic hitting that card gets forwarded to the card that has internet access.

Peace,
JimBass
 
Old 08-26-2007, 01:45 PM   #10
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Original Poster
Rep: Reputation: 30
Thanks jim,

PHP Code:
If two cards have direct internet access (through separate gateways), you're opening a large can of worms. 
will you pls make it little clear ?
 
Old 08-26-2007, 02:48 PM   #11
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
Ok, if you have two (or more) network cards with direct internet access, how does the computer know which one to use? If you open a browser and go to linuxquestions.org, does it go out eth0 or eth1? You need to setup iptables or some routing scripts telling it how to deal with traffic.

When you have a simple network (meaning only one way to the internet), everything has to go through that path (which should be the default gateway). When you have 2 paths that can lead to the net, through 2 separate routers, you need to decide what path your data will take.

In short, you can't do a complex multi-gateway network at home, unless you have a router that has at least 2 WAN ports. If you had two connections, say both a cable modem and a DSL, you'd need something to tie them into a redundant network, so if one goes down, the machines behind it don't know. That isn't possible with a linksys router, you need to move up to enterprise class stuff, which is more expensive by at least a factor of 10.

So in your current network, the 3 NIC linux box only has one default gateway, because anything going to the net needs to go out eth0 to the router. When a machine (other than the linux box) needs a default gateway, it has to be the linux box's address on the interface it sees. If the computer is 10.0.0.3/24, then it needs to have a default gateway within its subnet mask, because it can't reach anything outside of that subnet without the help of a gateway. The LAN computer gets 10.0.0.1 as its gateway, so its traffic goes to the linux box, then the linux box knows anything headed to the internet needs to go out eth0, and does the necessary routing to send the data out, and is prepared to accept the reply.

I don't know of any way to have multiple gateways functional on a single computer. I could be wrong about this, but my understanding is even if you have 10 NICs, you can only have 1 with a functional gateway. The computer can't use more than one path to the net without some software controlling it.

Peace,
JimBass
 
Old 08-26-2007, 03:03 PM   #12
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
As JimBass inficated I think the subject is now going a little bit beyond what can be explained easily in the forum.

The best guide to the meaning of routing and everything is Linux Advcanced Routing and Traffic control howto. This page contains virtually everything you ever need to know about routing including split WAN traffic.

jlinkels
 
Old 08-27-2007, 06:49 AM   #13
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Original Poster
Rep: Reputation: 30
Thanks again Jim,

i am agree with you that there should be only one gateway ..
but let me explain what i found .
1.)I gave 192.168.2.2/24 to ETH0 connected with dsl modem/router.

2.) 10.0.0.1/24 to ETH0 and 172.20.0.1/24 to ETH1

now configured DHCP server for 10.0.0.0/24 and 172.20.0.0/24 and connected my VOIP device (Gizmo)(got ip 172.20.0.2 from dhcp server) to eth1.
Now when i ping 172.20.0.2 (voip) device from lin box i was getting repply.
but i was not getting repply from other winxp pc with IP 192.168.2.3 ..because it was giong outside through linksys.
so i defined a staic route for 172.20.0.2 with default gateway as 172.20.0.1 and after that it was pinging from 192.168.2.3 and within minutes voip gizmo got sync (Dialtone)...
so what do you think about this.

regards
 
Old 08-27-2007, 07:05 AM   #14
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
That is exactly as it should be. Any device on the 172.20.0.0/24 needs 172.20.0.1 as its gateway, and any device on 10.0.0.0/24 needs 10.0.0.1 as its gateway. Remember, the only machine that can reach those networks without gateways is the linux box itself, because it has a card on each network. How is something on 10.0.0.0/24 supposed to know how to reach 172.20.0.0/24? The only way traffic can reach data on another subnet is through a gateway, and the gateway must be on the same subnet as the device itself. The issue is that the linux box (and only the linux box) should only have the 192.168.2.1 default gateway, as from the linux box, the 10.0.0.1 address can only get to the net through 192.168.2.X interface.

Peace,
JimBass
 
Old 08-27-2007, 07:26 AM   #15
soroccoheaven
Member
 
Registered: Jul 2007
Distribution: mandrake Mandriva Redhat CentOS Slackware
Posts: 221

Original Poster
Rep: Reputation: 30
Solved

thanks Jim.
 
  


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
two NIC's one IP mijohnst Linux - Networking 4 06-12-2007 11:08 AM
networking with multiple nic's Mandle Linux - Networking 6 11-13-2006 10:27 AM
1 IP for 2 NIC's turbo_acura Linux - Networking 4 10-10-2005 04:33 PM
Two NIC's Meatball1337 Linux - Hardware 4 11-10-2004 09:14 PM
TWO NIC's bhughesiii Linux - Networking 8 09-23-2004 09:48 AM

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

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