LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   NIC interfaces strange behaviour (Debian) (https://www.linuxquestions.org/questions/linux-newbie-8/nic-interfaces-strange-behaviour-debian-4175603689/)

fishkake 04-12-2017 07:00 AM

NIC interfaces strange behaviour (Debian)
 
Hi all

I felt like I was getting somewhere with understanding my network, but its all gone a bit strange now. Sorry if there's a bit too much going on here, but I thought it best to be thorough. First the details:

My home ISP router is 192.168.0.1

Windows PCs on WiFi and LAN on DHCP working fine.

"19KDEB" running minimalist Debian 8.7.1 (no desktop environment).

eth0 is a built in Intel gigabit, connected through a switch to my router. eth1 is a PCMCIA 10/100 ethernet connected to another offline PC. Both cards have been working previously.

I always log in as root for testing purposes.

/etc/network/interfaces:
Code:

source /etc/network/interfaces.d/*

#The loopback interface
auto lo
iface lo inet loopback

# The primary network interface
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.27.80
 netmask 255.255.255.0
 gateway 192.168.27.80

When I boot and log in, ifconfig confirms the above. And I can ping 192.168.0.1 with "-I eth0" or without "-I" at all.

Ping -I eth1 192.168.0.1 fails to ping my router, as expected.

However, ping bbc.co.uk returns:
Code:

PING bbc.co.uk (212.58.244.23) From 192.168.27.80 ... unreachable"
This is understandable, however adding "-I eth0" also doesn't work. It resolves the IP but won't ping it.

Now, if I change /etc/network/interfaces to:

Code:

source /etc/network/interfaces.d/*

#The loopback interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0 eth1
iface eth0 inet static
 address 192.168.0.80
 netmask 255.255.255.0
 gateway 192.168.0.1

(In other words, remove eth1) then I CAN ping bbc.co.uk.

Can anyone explain what is happening here?

Also, finally, and possibly related, why does ifdown eth0 return "interface eth0 not configured"?

I know I'm a bit scattergun here, but if anyone can provide any information on the above I would appreciate it. Thanks!

Shadow_7 04-12-2017 07:28 AM

The "gateway" on the other nic, being listed last is the default? There's normally only ONE gateway (per machine). Comment out (#) the other gateway and it will likely function with both interfaces configured.

fishkake 04-12-2017 08:02 AM

OK, this went a little inconsistent, so its hard to say what proves what.

However, your gateway idea makes a small amount of sense to my poor understanding of networks. And it does seem to have made things more stable.

And I suppose it would make sense that this was unstable if something was somehow uncertain which of the two specified gateways to use.

So maybe you've solved my problem. Tell you what, take a brownie point now, and I'll take it back if it turns out you were wrong. :-)

Thanks!


All times are GMT -5. The time now is 11:42 AM.