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?