Unable to talk to network after configuring a second NIC.
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.
Unable to talk to network after configuring a second NIC.
Hi:
I am trying to set up a router on a small LAN, that actually connects directly to a gateway router (1. pure learning exercise... 2.I do not have physical access to the gateway router).
My machine will connect a few PCs to the gateway.
So firstly I can connect fine with one NIC, (receives info from DHCP server fine), but the second NIC doesn't have direct access to the DHCP server yet, so I try and assign it a static information (making sure that the IP is not already in use on the network of course), as soon as I assign the IP to my second NIC, I can't ping the gateway router, or any other machine on the network, I can only talk to each NICs.
I've tested both NICs and the cables etc, they work fine independently.
ifconfig: (eth1 is the NIC that I assigned static information)
You cannot have 2 ethernet cards in the same box on the same subnet; you have eth1 address=192.168.1.69 and eth2 address=192.168.1.64; subnet is 192.168.1.X
One of them must be on a different subnet like; 192.168.0.2. If you are going to have boxes connected to this to go through it for some purpose like internet sharing then they must be on this second subnet.
Oh right, so that's simply, because if i'm trying to set up a router, I'm supposed to be moving data between two physical or logical networks? Where as I've tried to route data from one network to the same network, which doesn't really make sense? Does the kernel just see the same network address when it comes to forwarding and say: forget it ?
Oh right, so that's simply, because if i'm trying to set up a router, I'm supposed to be moving data between two physical or logical networks? Where as I've tried to route data from one network to the same network, which doesn't really make sense? Does the kernel just see the same network address when it comes to forwarding and say: forget it ?
Yup; system gets confused because the origin is the same system and not another node.
Okay, so I have a separate subnet 192.168.2.x, a box on this subnet can talk to eth0 (gateway for this subnet) and it can also talk to eth1 192.168.1.x which is connected to the gateway for the internet, however the box on 192.168.2.x can't talk to the gateway that eth1 is connected to in order to access the internet, even though I've enabled ip forwarding.
The boxes on the lan need to use the ip address of the card they are connected to as the gateway address. In the box with the 2 cards you need to specify the gateway as the ip address to which it is attached.
You have a network box with address 192.168.2.3 which is connected to 192.168.2.1 (the new router box). The gateway for 192.168.2.3 is 192.168.2.1.
The router box with ip address 192.168.1.2 is connected to a router with an address of 192.168.1.1. The gateway for the router box is 192.168.1.1
Ideally you protect the router box and boxes behind with a basic iptables firewall and do ip-masquerading.
Hmm, Okay here's the settings: I'm pretty sure I've done what you have described above (apologies if I've missed something)
Two subnets, A(192.168.1.x) and B(192.168.2.x), A contains the router that connects to the Internet. My IP for eth2 is 192.168.1.67 and I have 192.168.1.254 as the default gateway. eth1 has the IP 192.168.2.10 and a machine on subnet B has the IP 192.168.2.40, with the default gateway of 192.168.2.10.
Now, I can ping from 192.168.2.40 => 192.168.2.10 (default gw), 192.168.1.67 all fine, but not 192.168.1.254 the default gateway for that network card :S
I have always used iptables based forwarding with ip-masq and this has always been successful.
All the info and scripts are available The Linux Document Project [TLDP]. There are also lots of ready made scripts and firewall scripts out there that do the same thing. I use an old one; MonMotha Firewall. Basically set the script up make it ready to run put it into /etc/init.d/ and update the rc.X files and it takes effect on boot.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.