4

I have a raspberry Pi with three interfaces eth0 (Ethernet), wlan0 (WiFi), and wwan0 (via a GSM modem)

How can I test if an Internet connection is available via a certain interface? e.g. is my GSM(wwan0) modem connected to the Internet?

If I attempt to run ping www.google.com - How do I know what interface is being used?

How can I force connectivity via a certain interface if more than one exist?

4

Check your Routing Table

route -n

The results will show you which precedence-order the interfaces are configured to Receive/Transmit and to what addresses these operations take. The routes on the top are the ones that get used force. Two rules for the same interface mean that the one on top is the one used.

Try running your ping or traceroute command while viewing the output of iftop.

iftop -i $iface
  • [-i] specifies which interface (i.e., tap0, lun0, eth0, wlan0, as specified by output of ifconfig.

This will show you the statistics for a particular interface.

iftop -f $IP/$NETMASK
  • [-f specifies network,netmask (i.e. 192.168.1.0/24)

This will show you the statistics for a particular subnet.

|improve this answer|||||
4

How can I test if an Internet connection is available via a certain interface? e.g. is my GSM(wwan0) modem connected to the Internet? If I attempt to run ping www.google.com - How do I know what interface is being used?

You could specify the interface.

ping -I $INTERFACE $DOMAIN_OR_IP_ADDRESS

e.g:

ping -I wwan0 8.8.4.4

Using a known IP address will eliminate any potential DNS issues while troubleshooting.

How can I force connectivity via a certain interface if more than one exist?

You can set the default route. Static addressing with Debian, right? Open /etc/network/interfaces with a text editor. Find the desired network interface and add the option gateway x.x.x.x, where x.x.x.x is the gateway. Save and restart networking:

/etc/init.d/networking restart

Otherwise, I believe one would need to use more advanced policy-based routing for this.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.