1

I am running Ubuntu Server 16.04 with two on-board NICs. Ubuntu sees both cards, but both eth0 and eth1 will only pass traffic out of one physical interface, although they are configured separately (I think). Information is below:

lshw -C network
*-network
       description: Ethernet interface
       product: 82579LM Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: eth0
       version: 04
       serial: 54:be:f7:65:9a:9b
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.13-4 ip=172.22.1.112 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:26 memory:f7e00000-f7e1ffff memory:f7e39000-f7e39fff ioport:f080(size=32)
  *-network
       description: Ethernet interface
       product: 82574L Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: eth1
       version: 00
       serial: 54:be:f7:65:9a:9c
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=2.1-3 ip=172.22.1.113 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:18 memory:f7d00000-f7d1ffff ioport:e000(size=32) memory:f7d20000-f7d23fff

/etc/network/interfaces:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

# The secondary network interface
auto eth1
iface eth1 inet dhcp

Thank you for any help!

ifconfig:

eth0      Link encap:Ethernet  HWaddr 54:be:f7:65:9a:9b
          inet addr:172.22.1.112  Bcast:172.22.1.255  Mask:255.255.255.0
          inet6 addr: fe80::56be:f7ff:fe65:9a9b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:61 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5880 (5.8 KB)  TX bytes:1436 (1.4 KB)
          Interrupt:20 Memory:f7e00000-f7e20000

eth1      Link encap:Ethernet  HWaddr 54:be:f7:65:9a:9c
          inet addr:172.22.1.113  Bcast:172.22.1.255  Mask:255.255.255.0
          inet6 addr: fe80::56be:f7ff:fe65:9a9c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1093 errors:0 dropped:0 overruns:0 frame:0
          TX packets:575 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:88205 (88.2 KB)  TX bytes:42753 (42.7 KB)
          Interrupt:18 Memory:f7d00000-f7d20000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)

route -n:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.22.1.1      0.0.0.0         UG    0      0        0 eth1
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0

route -n with eth0 unplugged. Cannot access either ip address.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.22.1.1      0.0.0.0         UG    0      0        0 eth0
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
Script with eth0 disconnected

eth0      Link encap:Ethernet  HWaddr 54:be:f7:65:9a:9b
          inet addr:172.22.1.112  Bcast:172.22.1.255  Mask:255.255.255.0
          inet6 addr: fe80::56be:f7ff:fe65:9a9b/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:28527 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2202058 (2.2 MB)  TX bytes:1372 (1.3 KB)
          Interrupt:20 Memory:f7e00000-f7e20000

eth1      Link encap:Ethernet  HWaddr 54:be:f7:65:9a:9c
          inet addr:172.22.1.113  Bcast:172.22.1.255  Mask:255.255.255.0
          inet6 addr: fe80::56be:f7ff:fe65:9a9c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:31516 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1730 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6125004 (6.1 MB)  TX bytes:155950 (155.9 KB)
          Interrupt:18 Memory:f7d00000-f7d20000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.22.1.1      0.0.0.0         UG    0      0        0 eth1
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=27.4 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=58 time=25.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=58 time=27.8 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=58 time=26.6 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=58 time=26.6 ms

--- 8.8.8.8 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 25.818/26.897/27.860/0.733 ms


Script with eth1 disconnected

eth0      Link encap:Ethernet  HWaddr 54:be:f7:65:9a:9b
          inet addr:172.22.1.112  Bcast:172.22.1.255  Mask:255.255.255.0
          inet6 addr: fe80::56be:f7ff:fe65:9a9b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28540 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2202968 (2.2 MB)  TX bytes:1372 (1.3 KB)
          Interrupt:20 Memory:f7e00000-f7e20000

eth1      Link encap:Ethernet  HWaddr 54:be:f7:65:9a:9c
          inet addr:172.22.1.113  Bcast:172.22.1.255  Mask:255.255.255.0
          inet6 addr: fe80::56be:f7ff:fe65:9a9c/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:31528 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1735 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6125988 (6.1 MB)  TX bytes:156460 (156.4 KB)
          Interrupt:18 Memory:f7d00000-f7d20000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.22.1.1      0.0.0.0         UG    0      0        0 eth1
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
172.22.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

--- 8.8.8.8 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4031ms
  • Will you add the output of ifconfig to your question? – L. D. James Mar 17 '17 at 17:32
  • eth0 Link encap:Ethernet HWaddr 54:be:f7:65:9a:9b inet addr:172.22.1.112 Bcast:172.22.1.255 Mask:255.255.255.0 inet6 addr: fe80::56be:f7ff:fe65:9a9b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:61 errors:0 dropped:0 overruns:0 frame:0 TX packets:11 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:5880 (5.8 KB) TX bytes:1436 (1.4 KB) Interrupt:20 Memory:f7e00000-f7e20000 – Anthony Rivera Mar 17 '17 at 17:41
  • eth1 Link encap:Ethernet HWaddr 54:be:f7:65:9a:9c inet addr:172.22.1.113 Bcast:172.22.1.255 Mask:255.255.255.0 inet6 addr: fe80::56be:f7ff:fe65:9a9c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1093 errors:0 dropped:0 overruns:0 frame:0 TX packets:575 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:88205 (88.2 KB) TX bytes:42753 (42.7 KB) Interrupt:18 Memory:f7d00000-f7d20000 – Anthony Rivera Mar 17 '17 at 17:41
  • lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:160 errors:0 dropped:0 overruns:0 frame:0 TX packets:160 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB) – Anthony Rivera Mar 17 '17 at 17:42
  • I can't make out the content you are showing. If you paste it to your questions here I'll be able to see it better. – L. D. James Mar 17 '17 at 17:46
-1

Both your NICs are working. One of them have they have the individual IP addresses of:

eth0: 172.22.1.112
    and
etho1: 172.22.1.113

You can verify that both of them are working by pinging either IP address:

$ ping -c10 172.22.1.112
$ ping -c10 172.22.1.113

If you have another computer in your network you can also access your computer from either IP address.

If you set up a web server on your machine, you would be able to access the web server by using either of the IP addresses:

http://172.22.1.112
http://172.22.1.113

The access (output you see with either of those examples is verification that they both are working. Also, the fact that your dhcp server was able to access them and assign IP addresses is another verification that they both are working.

Run this script to test the NIC's separate:

Copy and paste the script below. You can name it: testnic.sh. Run the script individually while each nic is plugged into the computer and the router/modem.

testnic.sh:

#!/bin/bash

ifconfig
route -n
sudo route del default gw 172.22.1.1
sudo route add default gw 172.22.1.1
ping -c5 8.8.8.8

Run the command as:

$ ./testnic.sh

Show both the command and the output.

Update:

Your previous output shows indicates the problem as mentioned is in the route. You have to delete the previous root when you remove that nic, then create another route in it's place.

Below is an example script to help you with that task. The script will have to be tested and fine tuned for your environment. But the answer to your question is specific, that both nics are working. The difference you are seeing is the result of how you have them configured.

When removing one NIC, change your network configuration to use the routing of the one remining.

This is another script example to make it easy to change configurations when you switch the NICs.

#!/bin/bash

currentroute=$(route -n | awk '/UG/{print $NF}')
available="none"

route="0"
available="none"
find /sys/class/net/en* -exec echo "{}/operstate" \; | while read line; do
    # echo "[$line]"    
    IFS='/' read -r -a array <<< "$line"
    device="${array[4]}"
    state="$(cat $line)"
    thisdevice="$device:$state"
    if [[ "$thisdevice" == "$currentroute:down" ]] ; then
        route="0"
    fi
    if [[ "$state" == "up" ]]
    then
        echo "The device $device is available"
        echo "$device" > /tmp/available             
    fi 
done
read -r available </tmp/available
if [[ "$route" == "0" ]]; then
    route del default gw 172.22.1.1 $currentdevice
    route add default gw 172.22.1.1 $available
fi

echo "[$route/$available]"
  • I can ping both, but if I unplug one of the cables I lose both interfaces. If I unplug the other, I don't lose any. I can still ping both. – Anthony Rivera Mar 17 '17 at 18:02
  • Will you add the output of route -n to your question? – L. D. James Mar 17 '17 at 18:06
  • @ L.D. James Added – Anthony Rivera Mar 17 '17 at 18:12
  • Your gateway is on eth1. It is 172.22.1.1. When you remove that NIC you are removing your gateway. You'll have to assign a gateway to the eth0 device after removing the eth1 device. You can add a new default gateway with this commaind: sudo route add default gw 172.22.1.1 – L. D. James Mar 17 '17 at 18:18
  • Stepped out for a meeting. I'll try that when I'm done. Thanks! – Anthony Rivera Mar 17 '17 at 18:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.