I'm trying to ping from a specific interface, I have a wired and a wireless connection both going into my laptop.
My wired adaptor eth0
is on the IP 172.16.109.75
My wifi adaptor wlan0
is on the IP 192.168.1.69
When I ping google with my eth0
unplugged with the following command:
conneco@mcr-pc-29334:~$ ping -I wlan0 www.google.co.uk
PING www.l.google.com (74.125.230.115) from 192.168.1.69 wlan0: 56(84) bytes of data.
64 bytes from 74.125.230.115: icmp_seq=1 ttl=51 time=32.7 ms
64 bytes from 74.125.230.115: icmp_seq=2 ttl=52 time=28.7 ms
64 bytes from 74.125.230.115: icmp_seq=3 ttl=52 time=28.9 ms
64 bytes from 74.125.230.115: icmp_seq=4 ttl=52 time=28.3 ms
It works fine as expected. I plug my eth0
cable in and run the same again:
conneco@mcr-pc-29334:~$ ping -I wlan0 www.google.co.uk
PING www.l.google.com (74.125.230.112) from 172.16.109.75 wlan0: 56(84) bytes of data.
From mcr-pc-29334.local (192.168.1.69) icmp_seq=2 Destination Host Unreachable
From mcr-pc-29334.local (192.168.1.69) icmp_seq=3 Destination Host Unreachable
From mcr-pc-29334.local (192.168.1.69) icmp_seq=4 Destination Host Unreachable
From mcr-pc-29334.local (192.168.1.69) icmp_seq=5 Destination Host Unreachable
From mcr-pc-29334.local (192.168.1.69) icmp_seq=6 Destination Host Unreachable
From mcr-pc-29334.local (192.168.1.69) icmp_seq=7 Destination Host Unreachable
By the output at the top it seems to send it from the eth0
(which at work won't be able to ping because it gets blocked), but the wifi
is another link to a separate network where I'm on the net directly and therefore sending the ping request from the wlan0
should work. What's happening? How should I fix it?