I've got a couple of systems that both act the same way. Each has an interface on two different subnets, each of which has internet access, but I can only use ping -I successfully on one of the interfaces. For instance, a Linux box running Debian 8.11
# The primary network interface allow-hotplug eth0 iface eth0 inet static address 192.168.0.94 netmask 255.255.255.0 gateway 192.168.0.1 # VLAN 782 'PUB', Public auto eth0.782 iface eth0.782 inet static address 192.168.2.94 netmask 255.255.255.0
and my routing table:
netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0.782
root@pbx3:~# ping google.com PING google.com (184.108.40.206) 56(84) bytes of data. 64 bytes from mia09s01-in-f14.1e100.net (220.127.116.11): icmp_seq=1 ttl=48 time=63.6 ms
ping -I eth0 google.com PING google.com (18.104.22.168) from 192.168.0.94 eth0: 56(84) bytes of data. 64 bytes from ord08s13-in-f14.1e100.net (22.214.171.124): icmp_seq=1 ttl=48 time=70.2 ms
but I can't:
ping -I eth0.782 google.com PING google.com (126.96.36.199) from 192.168.2.94 eth0.782: 56(84) bytes of data. From 192.168.2.94 icmp_seq=1 Destination Host Unreachable
Though I can nmap and ping devices on that subnet:
ping -I eth0.782 192.168.2.1 PING 192.168.2.1 (192.168.2.1) from 192.168.2.94 eth0.782: 56(84) bytes of data. 64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=0.385 ms
(same problem with another system, Centos 6.8 using eth0 and eth1)
My good friend Google seems to hint that this has something to do with my routing table, but I can't seem to discover exactly what's wrong, or exactly how to fix it. I've tried adding the 192.168.2.1 gateway to the eth0.782 network, but then the eth0 network disappears, so clearly there can be only one gateway...
Thanks in advance for any hints!