1

I have created 2 static interfaces, eth0 and eth1. Here's how my /etc/network/interfaces file look like.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# This is an autoconfigured IPv6 interface
auto eth0
iface eth0 inet static
#iface eth0 inet static
address 192.168.2.42
netmask 255.255.252.0
gateway 192.168.0.11
dns-nameserver 192.168.1.7

auto eth1
iface eth1 inet static
address 192.168.2.44
netmask 255.255.252.0
gateway 192.168.0.11
dns-nameserver 192.168.1.7

eth0 works perfectly and I can ping on eth1's IP from another machine on the network. The problem is I can't ping to any other machine through eth1:

aneesh@worker42:~$ ping -Ieth0 -c5 192.168.1.15
PING 192.168.1.15 (192.168.1.15) from 192.168.2.42 eth0: 56(84) bytes of data.
64 bytes from 192.168.1.15: icmp_seq=1 ttl=64 time=0.140 ms
64 bytes from 192.168.1.15: icmp_seq=2 ttl=64 time=0.131 ms
64 bytes from 192.168.1.15: icmp_seq=3 ttl=64 time=0.149 ms
64 bytes from 192.168.1.15: icmp_seq=4 ttl=64 time=0.153 ms
64 bytes from 192.168.1.15: icmp_seq=5 ttl=64 time=0.152 ms

--- 192.168.1.15 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3997ms
rtt min/avg/max/mdev = 0.131/0.145/0.153/0.008 ms
aneesh@worker42:~$ ping -Ieth1 -c5 192.168.1.15
PING 192.168.1.15 (192.168.1.15) from 192.168.2.44 eth1: 56(84) bytes of data.
From 192.168.2.44 icmp_seq=1 Destination Host Unreachable
From 192.168.2.44 icmp_seq=2 Destination Host Unreachable
From 192.168.2.44 icmp_seq=3 Destination Host Unreachable
From 192.168.2.44 icmp_seq=4 Destination Host Unreachable
From 192.168.2.44 icmp_seq=5 Destination Host Unreachable

--- 192.168.1.15 ping statistics ---
5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4023ms
pipe 3

I can ping to 192.168.1.44 from 192.168.1.15:

aneesh@aneesh:~$ ping -c5 192.168.1.44
PING 192.168.1.44 (192.168.1.44) 56(84) bytes of data.
64 bytes from 192.168.1.44: icmp_seq=1 ttl=64 time=0.146 ms
64 bytes from 192.168.1.44: icmp_seq=2 ttl=64 time=0.192 ms
64 bytes from 192.168.1.44: icmp_seq=3 ttl=64 time=0.178 ms
64 bytes from 192.168.1.44: icmp_seq=4 ttl=64 time=0.177 ms
64 bytes from 192.168.1.44: icmp_seq=5 ttl=64 time=0.174 ms

--- 192.168.1.44 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3996ms
rtt min/avg/max/mdev = 0.146/0.173/0.192/0.019 ms

Here's the output of ifconfig:

aneesh@worker42:~$ ifconfig 
eth0      Link encap:Ethernet  HWaddr 08:00:27:0f:0b:38  
          inet addr:192.168.2.42  Bcast:192.168.3.255  Mask:255.255.252.0
          inet6 addr: 2001:df0:6000:0:a00:27ff:fe0f:b38/64 Scope:Global
          inet6 addr: fe80::a00:27ff:fe0f:b38/64 Scope:Link
          inet6 addr: 2001:df0:6000:0:397f:1b8f:468a:9424/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10086 errors:0 dropped:1422 overruns:0 frame:0
          TX packets:524 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1190111 (1.1 MB)  TX bytes:63594 (63.5 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:4c:fd:42  
          inet addr:192.168.2.44  Bcast:192.168.3.255  Mask:255.255.252.0
          inet6 addr: fe80::a00:27ff:fe4c:fd42/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:2448 (2.4 KB)

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:21 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2352 (2.3 KB)  TX bytes:2352 (2.3 KB)

Routing table:

aneesh@worker42:~$ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.11    0.0.0.0         UG    0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.252.0   U     0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.252.0   U     0      0        0 eth1

The machine is a virtualbox VM running Ubuntu 13.10. The VM has 2 Bridged network adaptors eth0 and eth1.

Updates:

I changed eth1's network adaptor to "host only" eth1's IP to the one of the virtualbox one's (through dhcp): 192.168.56.101. After that I was able to ping through eth1. Why am I not able to do that when eth1's a bridged adaptor with IP - 192.168.2.42?

2
  • You did not post your routing table, but I don't think your issue is related to that. What about this answer? Does that make sense?
    – TomS
    Feb 4, 2016 at 11:09
  • I have updated the post with my routing table. Feb 4, 2016 at 11:22

2 Answers 2

1

Normally, if you want multiple physical interfaces (eth0 & eth1 for example) connected to the same LAN segment (the same VLAN in a set of switches), you should use layer 2 link aggregation (in Linux, it's called bonding), and not two separate interfaces each with its own IP address.

If you want to have multiple IP addresses to the same LAN IP subnet, you should use logical IP subinterfaces (eth0, eth0:1, eth0:2, etc) on the same base interface (ethX in case of a single physical interface, or bondX in case of a link-aggregated set of interfaces).

As for your original setup, there are multiple problems with having two separate physical interfaces connected to the same VLAN and IP subnet, each with its own IP address from the same IP subnet. The basic problem is that you'd have identical IP routes for the same targets on both interfaces, but the kernel will only use one of them to send outbound packets, regardless of which source IP address you're trying to use. And which interface gets used will depend on random factors (like, which interface was brought up first/last). Also, both physical interfaces will respond to ARP reqests for both IP addresses, which again will mean the result will be random (which packet arrives first to the requestor). This randomness is usually not a good thing, and may cause problems with some networking equipment.

0

I can see that eth0 got also ipv6, but eth1 did not, therefore there is a problem with the connection, also eth1 has 0.0 B recieved. I do not know, if it is a physical machine or virtual.
For physical, I would check the cable connecting eth1. And I would also check:
cat /sys/class/net/eth1/operstate
it should be up, if it is not, than do: sudo ifup eth1

1
  • Its a virtual "bridged" adaptor, running on virtualbox. Feb 4, 2016 at 13:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .