LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2017, 12:32 PM   #1
fishkake
LQ Newbie
 
Registered: Dec 2006
Posts: 15

Rep: Reputation: 0
Two NICs on Debian connectivity confusion


Hi all, thanks for reading my post.

I have a fairly minimalist Debian (8.7) setup, basically the DVD install with no additional packages. Trying to learn from the ground up.

I have two ethernet cards eth0 and eth1, both connected to the same switch and to the internet. If it matters, one is internal/PCI, one is PCMCIA. I also have a PCI WLAN card but it is not in use in this scenario.

If I set them to static, my interfaces file is like this:

Code:
iface lo inet loopback
allow-hotplug eth0 eth1
iface eth0 inet static
 address 192.168.0.80
 netmask 255.255.255.0
 gateway 192.168.0.1
iface eth1 inet static
 address 192.168.0.90
 netmask 255.255.255.0
 gateway 192.168.0.1
With this setup, the following happens:

ping 192.168.0.1 WORKS
ping 192.168.0.1 -I eth0 WORKS
ping 192.168.0.1 -I eth1 WORKS

ping bbc.co.uk WORKS
ping bbc.co.uk -I eth0 WORKS
ping bbc.co.uk -I eth1 DOESN'T WORK*

*In this case, the resolution did work, it tried to ping 212.58.244.23 (bbc.co.uk) and failed.

So question 1 - why can I not ping the internet from eth1 in this instance?

The part below this might be irrelevant depending on the answer to the above.

When I set them to dynamic, my interfaces file is as follows:

Code:
iface lo inet loopback
allow-hotplug eth0 eth1
iface eth0 inet dhcp
iface eth1 inet dhcp
Now I have a slightly different situation. They pickup 192.168.0.13 and 0.14 addresses, and everything that works above still works, but now I can only ping bbc.co.uk from eth0 UNLESS eth0 is not connected at boot, in which case I can only ping bbc.co.uk from eth1.

It seems I can only ping "the internet" from one NIC - in the static version, this is eth0, and in the dynamic version it is eth0 if both are connected, or eth1 if only eth1 is connected.

This is probably a really complicated way of asking a much simpler question, but I thought it best to be thorough. Any help is much appreciated, thank you!
 
Old 04-06-2017, 02:31 PM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
what is the output of the "ip route" command, I am betting that the gateway is bound to eth0 only. I get the feeling that it would be best if the two ports were on different ranges and actually, I fail to see any tangible benefit from this. If you want to nics on the same network, then they should use network bonding or teaming.
 
1 members found this post helpful.
Old 04-06-2017, 11:32 PM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
There can only be one default route, perhaps that's what is stopping it from working as you expect. You can ifup and ifdown the interfaces to force routes. And if you're going to have more than one interface, it helps to have them on separate subnets so routing is less quirky.

$ sudo ip route show
$ sudo ip route add default via 192.168.0.1 dev eth0

The older variant you might be familiar with:

$ sudo route -n
$ sudo route add default gw 192.168.0.1 dev eth0
 
Old 04-07-2017, 03:15 AM   #4
fishkake
LQ Newbie
 
Registered: Dec 2006
Posts: 15

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by r3sistance View Post
I fail to see any tangible benefit from this.
You are quite right to fail to do so :-)

This was merely me experimenting. My ultimate aim is to run this machine as a router, connecting 192.168.0 to 192.168.100 or 172.16 or something else. I was merely starting from the ground up and trying to understand how networks function a little better than I do.

As usual, the community has taken an idiot's question and provided some very useful information in response. So thank you!

Now I'm off to learn what the heck "IPTABLES" is all about :-)

Last edited by fishkake; 04-07-2017 at 03:16 AM.
 
Old 04-07-2017, 03:37 AM   #5
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by fishkake View Post
Now I'm off to learn what the heck "IPTABLES" is all about :-)
then you may wish to go to https://www.netfilter.org/
 
  


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
Two NICs in Debian 8 platypo Linux - Hardware 18 12-08-2015 05:32 AM
RHEL4 ES, Is there a way to Bond two NICs for Redundancy for upstream connectivity? jtollack Linux - Networking 3 07-18-2010 12:20 PM
Problem getting 2 NICs Configured on Debian brycesteinhoff Linux - Networking 7 09-13-2009 10:58 PM
Resolutions, sound, network connectivity, and confusion lgtrean Linux - Newbie 8 03-02-2007 06:03 PM
Linux setup as router / DHCP w/3+ NICs, separate but shared connectivity - question MetaTechi3 Linux - Networking 3 11-17-2006 11:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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