Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
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.
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 ..
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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?
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.
(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.
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.
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.