You are not logged in.

#1 2018-10-05 11:39:45

javiervgd878
Member
Registered: 2018-10-05
Posts: 3

ping -I <interface> not working

Hi everybody,

Just to say that I have been using Arch for 3 years now (in this computer) and I always have loved it. I always could solve issues by searching through the wiki or through the forum, but this time I have not found anything. So I registered and got to be another member of the family smile

The problem

I have two interfaces connected to the internet on my computer and I would like to send a ping over the non-default one. So I have my wifi and a modem connected to Arch and although I am using my wifi I would like to send a ping over the modem interface.

Here you see my two interfaces (ppp0 - modem, wlp0s20u1 - wifi)

[javier@archy] ~ $ ip route
default via 192.168.2.1 dev wlp0s20u1 proto dhcp metric 600 
10.64.64.64 dev ppp0 proto kernel scope link src 10.50.131.24 
192.168.2.0/24 dev wlp0s20u1 proto kernel scope link src 192.168.2.157 metric 600 

If I send a ping to google over the wifi (default via or gateway) it works. However, if I send it over the ppp0 interface it hangs:

[javier@archy] ~ $ ip route
PING www.google.com (172.217.168.164) 56(84) bytes of data.
64 bytes from mad07s10-in-f4.1e100.net (172.217.168.164): icmp_seq=1 ttl=53 time=10.3 ms

--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 10.340/10.340/10.340/0.000 ms

[javier@archy] ~ $ ping -I ppp0 -c 1 www.google.es
PING www.google.es (216.58.201.163) from 10.50.131.24 ppp0: 56(84) bytes of data.
^C
--- www.google.es ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

To make sure both interfaces have internet I change the routing table and set the modem to be the default gateway:

[javier@archy] ~ $ sudo ip route delete default via 192.168.2.1 dev wlp0s20u1
[javier@archy] ~ $ sudo ip route add default via 10.64.64.64 dev ppp0
[javier@archy] ~ $ ip route
default via 10.64.64.64 dev ppp0 
10.64.64.64 dev ppp0 proto kernel scope link src 10.50.131.24 
192.168.2.0/24 dev wlp0s20u1 proto kernel scope link src 192.168.2.157 metric 600 

Then I try to send a ping over the ppp0 (default interface) and over the secondary interface (wifi), with the opposite result. I can send over ppp0 but not over wifi.:

[javier@archy] ~ $ ping -c 1 www.google.com
PING www.google.com (216.58.212.68) 56(84) bytes of data.
64 bytes from lhr35s05-in-f4.1e100.net (216.58.212.68): icmp_seq=1 ttl=46 time=110 ms

--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 109.774/109.774/109.774/0.000 ms

[javier@archy] ~ $ ping -I wlp0s20u1 -c 1 www.google.es
PING www.google.es (216.58.198.163) from 192.168.2.157 wlp0s20u1: 56(84) bytes of data.
^C
--- www.google.es ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

You can see how this is using the modem also in the delay, over Wifi is time=10.3 ms and over 4G is time=110 ms.

So, why is this happening? Should not just send a ping over the secondary interface without problems? I found this issue because I am developing code to be run on a raspi and the "ping -I" command works as I expected on Raspian. But then I wanted to do some development on my Arch (raspi can be slow sometimes) and found this problem.

Does anybody know why this is happening? and does anybody knows how to solve this? smile)

Offline

#2 2018-10-05 13:47:53

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: ping -I <interface> not working

this implies ping parsed your request correctly and does what it needs to do:

PING www.google.es (216.58.198.163) from 192.168.2.157 wlp0s20u1: 56(84) bytes of data.

Can you post output from tcpdump -ni wlp0s20u1 icmp when you attempt to ping?

Offline

#3 2018-10-08 09:07:18

javiervgd878
Member
Registered: 2018-10-05
Posts: 3

Re: ping -I <interface> not working

Hi, thank you for your answer. I could not answer before cause I had all the stuff at work (the modem basically).

So, I configured:

  1. wlp0s20u1 (wifi) as primary interface
  2. ppp0 (gsm) as secondary interface

And then send a ping over the GSM modem (ppp0) and started to trace the packets on that interface.

[javier@archy] ~ $ ip route
default via 192.168.2.1 dev wlp0s20u1 proto dhcp metric 600 
10.64.64.64 dev ppp0 proto kernel scope link src 10.50.82.101 
192.168.2.0/24 dev wlp0s20u1 proto kernel scope link src 192.168.2.157 metric 600 

[javier@archy] ~ $ ping -I ppp0 www.google.es
PING www.google.es (172.217.16.227) from 10.50.82.101 ppp0: 56(84) bytes of data.
^C
--- www.google.es ping statistics ---
11 packets transmitted, 0 received, 100% packet loss, time 153ms

And look what I found! The ICMP packets are actually being sent and ACKed. 

[javier@archy] ~ $ sudo tcpdump -ni ppp0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ppp0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
10:48:47.720431 IP 10.50.82.101 > 172.217.16.227: ICMP echo request, id 11355, seq 1, length 64
10:48:48.428674 IP 172.217.16.227 > 10.50.82.101: ICMP echo reply, id 11355, seq 1, length 64
10:48:48.743244 IP 10.50.82.101 > 172.217.16.227: ICMP echo request, id 11355, seq 2, length 64
10:48:48.876578 IP 172.217.16.227 > 10.50.82.101: ICMP echo reply, id 11355, seq 2, length 64
10:48:49.756589 IP 10.50.82.101 > 172.217.16.227: ICMP echo request, id 11355, seq 3, length 64
10:48:49.874762 IP 172.217.16.227 > 10.50.82.101: ICMP echo reply, id 11355, seq 3, length 64
10:48:50.769933 IP 10.50.82.101 > 172.217.16.227: ICMP echo request, id 11355, seq 4, length 64
10:48:50.886738 IP 172.217.16.227 > 10.50.82.101: ICMP echo reply, id 11355, seq 4, length 64

However, as you can see in the first code paste, the ping command is not aware of those packets being answered. What can be happening?

Last edited by javiervgd878 (2018-10-08 09:07:42)

Offline

#4 2018-10-11 09:25:11

javiervgd878
Member
Registered: 2018-10-05
Posts: 3

Re: ping -I <interface> not working

Any help with this, please?? I would really like to get to the bottom of the issue smile)

Offline

#5 2018-10-12 01:49:38

djgera
Developer
From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 723
Website

Re: ping -I <interface> not working

set rp_filter to loose (2) instead of strict (1) [default-in-arch]

https://git.kernel.org/pub/scm/linux/ke … .txt#n1150

Offline

Board footer

Powered by FluxBB