Linux - Only first virtual interface can ping external gateway
- by husvar
I created 3 virtual interfaces with different mac addresses all linked to the same physical interface. I see that they successfully arp for the gw and they can ping (the request is coming in the packet capture in wireshark). However the ping utility does not count the responses. Does anyone knows the issue? I am running Ubuntu 14.04 in a VmWare.
root@ubuntu:~# ip link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
root@ubuntu:~# ip addr sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
inet6 fe80::20c:29ff:febc:fc8b/64 scope link
valid_lft forever preferred_lft forever
root@ubuntu:~# ip route sh
root@ubuntu:~# ip link add link eth0 eth0.1 addr 00:00:00:00:00:11 type macvlan
root@ubuntu:~# ip link add link eth0 eth0.2 addr 00:00:00:00:00:22 type macvlan
root@ubuntu:~# ip link add link eth0 eth0.3 addr 00:00:00:00:00:33 type macvlan
root@ubuntu:~# ip -4 link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
18: eth0.1@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether 00:00:00:00:00:11 brd ff:ff:ff:ff:ff:ff
19: eth0.2@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether 00:00:00:00:00:22 brd ff:ff:ff:ff:ff:ff
20: eth0.3@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default
link/ether 00:00:00:00:00:33 brd ff:ff:ff:ff:ff:ff
root@ubuntu:~# ip -4 addr sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
root@ubuntu:~# ip -4 route sh
root@ubuntu:~# dhclient -v eth0.1
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0.1/00:00:00:00:00:11
Sending on LPF/eth0.1/00:00:00:00:00:11
Sending on Socket/fallback
DHCPDISCOVER on eth0.1 to 255.255.255.255 port 67 interval 3 (xid=0x568eac05)
DHCPREQUEST of 192.168.1.145 on eth0.1 to 255.255.255.255 port 67 (xid=0x568eac05)
DHCPOFFER of 192.168.1.145 from 192.168.1.254
DHCPACK of 192.168.1.145 from 192.168.1.254
bound to 192.168.1.145 -- renewal in 1473 seconds.
root@ubuntu:~# dhclient -v eth0.2
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0.2/00:00:00:00:00:22
Sending on LPF/eth0.2/00:00:00:00:00:22
Sending on Socket/fallback
DHCPDISCOVER on eth0.2 to 255.255.255.255 port 67 interval 3 (xid=0x21e3114e)
DHCPREQUEST of 192.168.1.146 on eth0.2 to 255.255.255.255 port 67 (xid=0x21e3114e)
DHCPOFFER of 192.168.1.146 from 192.168.1.254
DHCPACK of 192.168.1.146 from 192.168.1.254
bound to 192.168.1.146 -- renewal in 1366 seconds.
root@ubuntu:~# dhclient -v eth0.3
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0.3/00:00:00:00:00:33
Sending on LPF/eth0.3/00:00:00:00:00:33
Sending on Socket/fallback
DHCPDISCOVER on eth0.3 to 255.255.255.255 port 67 interval 3 (xid=0x11dc5f03)
DHCPREQUEST of 192.168.1.147 on eth0.3 to 255.255.255.255 port 67 (xid=0x11dc5f03)
DHCPOFFER of 192.168.1.147 from 192.168.1.254
DHCPACK of 192.168.1.147 from 192.168.1.254
bound to 192.168.1.147 -- renewal in 1657 seconds.
root@ubuntu:~# ip -4 link sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:bc:fc:8b brd ff:ff:ff:ff:ff:ff
18: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/ether 00:00:00:00:00:11 brd ff:ff:ff:ff:ff:ff
19: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/ether 00:00:00:00:00:22 brd ff:ff:ff:ff:ff:ff
20: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/ether 00:00:00:00:00:33 brd ff:ff:ff:ff:ff:ff
root@ubuntu:~# ip -4 addr sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
18: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
inet 192.168.1.145/24 brd 192.168.1.255 scope global eth0.1
valid_lft forever preferred_lft forever
19: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
inet 192.168.1.146/24 brd 192.168.1.255 scope global eth0.2
valid_lft forever preferred_lft forever
20: eth0.3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
inet 192.168.1.147/24 brd 192.168.1.255 scope global eth0.3
valid_lft forever preferred_lft forever
root@ubuntu:~# ip -4 route sh
default via 192.168.1.254 dev eth0.1
192.168.1.0/24 dev eth0.1 proto kernel scope link src 192.168.1.145
192.168.1.0/24 dev eth0.2 proto kernel scope link src 192.168.1.146
192.168.1.0/24 dev eth0.3 proto kernel scope link src 192.168.1.147
root@ubuntu:~# arping -c 5 -I eth0.1 192.168.1.254
ARPING 192.168.1.254 from 192.168.1.145 eth0.1
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 6.936ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.986ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 0.654ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 5.137ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.426ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)
root@ubuntu:~# arping -c 5 -I eth0.2 192.168.1.254
ARPING 192.168.1.254 from 192.168.1.146 eth0.2
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 5.665ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 3.753ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 16.500ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 3.287ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 32.438ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)
root@ubuntu:~# arping -c 5 -I eth0.3 192.168.1.254
ARPING 192.168.1.254 from 192.168.1.147 eth0.3
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 4.422ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.429ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.321ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 40.423ms
Unicast reply from 192.168.1.254 [58:98:35:57:a0:70] 2.268ms
Sent 5 probes (1 broadcast(s))
Received 5 response(s)
root@ubuntu:~# tcpdump -n -i eth0.1 -v &
[1] 5317
root@ubuntu:~# ping -c5 -q -I eth0.1 192.168.1.254
PING 192.168.1.254 (192.168.1.254) from 192.168.1.145 eth0.1: 56(84) bytes of data.
tcpdump: listening on eth0.1, link-type EN10MB (Ethernet), capture size 65535 bytes
13:18:37.612558 IP (tos 0x0, ttl 64, id 2595, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 2, length 64
13:18:37.618864 IP (tos 0x68, ttl 64, id 14493, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 2, length 64
13:18:37.743650 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:38.134997 IP (tos 0x0, ttl 128, id 23547, offset 0, flags [none], proto UDP (17), length 229)
192.168.1.86.138 > 192.168.1.255.138: NBT UDP PACKET(138)
13:18:38.614580 IP (tos 0x0, ttl 64, id 2596, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 3, length 64
13:18:38.793479 IP (tos 0x68, ttl 64, id 14495, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 3, length 64
13:18:39.151282 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:39.615612 IP (tos 0x0, ttl 64, id 2597, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.145 > 192.168.1.254: ICMP echo request, id 5318, seq 4, length 64
13:18:39.746981 IP (tos 0x68, ttl 64, id 14496, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.145: ICMP echo reply, id 5318, seq 4, length 64
--- 192.168.1.254 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4008ms
rtt min/avg/max/mdev = 2.793/67.810/178.934/73.108 ms
root@ubuntu:~# killall tcpdump >> /dev/null 2>&1
9 packets captured
12 packets received by filter
0 packets dropped by kernel
[1]+ Done tcpdump -n -i eth0.1 -v
root@ubuntu:~# tcpdump -n -i eth0.2 -v &
[1] 5320
root@ubuntu:~# ping -c5 -q -I eth0.2 192.168.1.254
PING 192.168.1.254 (192.168.1.254) from 192.168.1.146 eth0.2: 56(84) bytes of data.
tcpdump: listening on eth0.2, link-type EN10MB (Ethernet), capture size 65535 bytes
13:18:41.536874 ARP, Ethernet (len 6), IPv4 (len 4), Reply 192.168.1.254 is-at 58:98:35:57:a0:70, length 46
13:18:41.536933 IP (tos 0x0, ttl 64, id 2599, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 1, length 64
13:18:41.539255 IP (tos 0x68, ttl 64, id 14507, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 1, length 64
13:18:42.127715 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:42.511725 IP (tos 0x0, ttl 64, id 2600, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 2, length 64
13:18:42.514385 IP (tos 0x68, ttl 64, id 14527, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 2, length 64
13:18:42.743856 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:43.511727 IP (tos 0x0, ttl 64, id 2601, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 3, length 64
13:18:43.513768 IP (tos 0x68, ttl 64, id 14528, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 3, length 64
13:18:43.637598 IP (tos 0x0, ttl 128, id 23551, offset 0, flags [none], proto UDP (17), length 225)
192.168.1.86.17500 > 255.255.255.255.17500: UDP, length 197
13:18:43.641185 IP (tos 0x0, ttl 128, id 23552, offset 0, flags [none], proto UDP (17), length 225)
192.168.1.86.17500 > 192.168.1.255.17500: UDP, length 197
13:18:43.641201 IP (tos 0x0, ttl 128, id 23553, offset 0, flags [none], proto UDP (17), length 225)
192.168.1.86.17500 > 255.255.255.255.17500: UDP, length 197
13:18:43.743890 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
13:18:44.510758 IP (tos 0x0, ttl 64, id 2602, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 4, length 64
13:18:44.512892 IP (tos 0x68, ttl 64, id 14538, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 4, length 64
13:18:45.510794 IP (tos 0x0, ttl 64, id 2603, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.1.146 > 192.168.1.254: ICMP echo request, id 5321, seq 5, length 64
13:18:45.519701 IP (tos 0x68, ttl 64, id 14539, offset 0, flags [none], proto ICMP (1), length 84)
192.168.1.254 > 192.168.1.146: ICMP echo reply, id 5321, seq 5, length 64
13:18:49.287554 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:50.013463 IP (tos 0x0, ttl 255, id 50737, offset 0, flags [DF], proto UDP (17), length 73)
192.168.1.146.5353 > 224.0.0.251.5353: 0 [2q] PTR (QM)? _ipps._tcp.local. PTR (QM)? _ipp._tcp.local. (45)
13:18:50.218874 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:51.129961 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:52.197074 IP6 (hlim 255, next-header UDP (17) payload length: 53) 2001:818:d812:da00:200:ff:fe00:22.5353 > ff02::fb.5353: [udp sum ok] 0 [2q] PTR (QM)? _ipps._tcp.local. PTR (QM)? _ipp._tcp.local. (45)
13:18:54.128240 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
--- 192.168.1.254 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4000ms
root@ubuntu:~# killall tcpdump >> /dev/null 2>&1
13:18:54.657731 IP6 (class 0x68, hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5a98:35ff:fe57:e070 > ff02::1:ff6b:e9b4: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2001:818:d812:da00:8ae3:abff:fe6b:e9b4
source link-address option (1), length 8 (1): 58:98:35:57:a0:70
13:18:54.743174 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.87 tell 192.168.1.86, length 46
25 packets captured
26 packets received by filter
0 packets dropped by kernel
[1]+ Done tcpdump -n -i eth0.2 -v
root@ubuntu:~# tcpdump -n -i eth0.3 icmp &
[1] 5324
root@ubuntu:~# ping -c5 -q -I eth0.3 192.168.1.254
PING 192.168.1.254 (192.168.1.254) from 192.168.1.147 eth0.3: 56(84) bytes of data.
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0.3, link-type EN10MB (Ethernet), capture size 65535 bytes
13:18:56.373434 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 1, length 64
13:18:57.372116 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 2, length 64
13:18:57.381263 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 2, length 64
13:18:58.371141 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 3, length 64
13:18:58.373275 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 3, length 64
13:18:59.371165 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 4, length 64
13:18:59.373259 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 4, length 64
13:19:00.371211 IP 192.168.1.147 > 192.168.1.254: ICMP echo request, id 5325, seq 5, length 64
13:19:00.373278 IP 192.168.1.254 > 192.168.1.147: ICMP echo reply, id 5325, seq 5, length 64
--- 192.168.1.254 ping statistics ---
5 packets transmitted, 1 received, 80% packet loss, time 4001ms
rtt min/avg/max/mdev = 13.666/13.666/13.666/0.000 ms
root@ubuntu:~# killall tcpdump >> /dev/null 2>&1
9 packets captured
10 packets received by filter
0 packets dropped by kernel
[1]+ Done tcpdump -n -i eth0.3 icmp
root@ubuntu:~# arp -n
Address HWtype HWaddress Flags Mask Iface
192.168.1.254 ether 58:98:35:57:a0:70 C eth0.1
192.168.1.254 ether 58:98:35:57:a0:70 C eth0.2
192.168.1.254 ether 58:98:35:57:a0:70 C eth0.3