0

How do I show that a particular network route is working without that route being the default route?

Here is the situation at hand.

$ ip route
default via 192.168.2.1 dev enp0s31f6 proto dhcp metric 100
default via 10.162.141.192 dev wwp0s20f0u11i12 proto static metric 700
10.162.141.128/25 dev wwp0s20f0u11i12 proto kernel scope link src 10.162.141.191 metric 700
172.20.0.0/24 dev docker0 proto kernel scope link src 172.20.0.1 linkdown
172.20.2.0/24 dev br-8038758c8f58 proto kernel scope link src 172.20.2.1
192.168.2.0/24 dev enp0s31f6 proto kernel scope link src 192.168.2.21 metric 100

I want to show that the interface on wwp0s20f0u11i12 is working. That is I can open a connection where that interface is the source, connects to another address, and receives a response.

I thought something like curl --interface wwp0s20f0u11i12 https://www.google.com would work, but there is no response. sudo tcpdump -n -i any -s 0 'tcp port https' shows repeated requests with no response.

00:55:44.148198 IP 10.162.141.191.41853 > 172.217.6.68.443: Flags [S], seq 3546122463, win 64240, options [mss 1460,sackOK,TS val 4025092804 ecr 0,nop,wscale 10], length 0

If I make wwp0s20f0u11i12 the default route, I can successfully make the same request.

How do I make this request when wwp0s20f0u11i12 is not the default route.

(I have another system where I am unable to change an interface to be the default route and I want to be able to show if networking is operational on that interface.)

I am using Ubuntu 18.04 with NetworkManager.

  • For tcpdump why not just do 'tcpdump -n -i wwp0s20f0u11i12' – davidgo May 08 '20 at 01:13
  • Is it an option to route a specific IP over the interface and check that? – davidgo May 08 '20 at 01:14
  • Even though curl may be sending out packets on enp0s31f6, the reply packets might be coming in on enp0s31f6. By default they are dropped by the kernel. I've forgotten the name of it, but there is a kernel setting to allow the reply in. I'll see if I can locate it – hookenz May 08 '20 at 01:23
  • @davidgo, re: route a specific IP: Can you suggest how I would route a specific IP? – Duane Murphy May 08 '20 at 16:07
  • I don't get involvr d with network manager (meaning what I suggest will only work temporarily) but its as easy as a command like "IP route add 114.23.35.69/32 via 10.162.141.192 " which will tell your VM to route traffic to the IP address 114.23.35.69 through 10.162.141.192 - which is already reached through the interface you wish to test by rule 3 of your routing table. – davidgo May 08 '20 at 19:38

1 Answers1

-1

From what I understand, an interface can only use 1 default route.

If you want another interface to handle requests that specifically require the internet, then the scenarios that can be used are:

  • Assumes if there is a server-client topology, the client is another device that is connected to your server
  • From enp0s31f6 NAT rule is given to wwp0s20f0u11i12 interface
  • From the client side it is connected to the network wwp0s20f0u11i12
  • Then requests from clients can be handled by the wwp0s20f0u11i12 interface

*) Note: From the server side it won't be seen that the wwp0s20f0u11i12 interface can handled requests

Hope this will help

YonzLeon
  • 311
  • 1
  • 6
  • Although this could seem the case on a simple connection it is incorrect (at least on Linux, the is in question) - a default route does not bind to an interface (although it does, of-course go through it). It is possible to have multiple routing tables - with multiple default routes, and this is typically required for multihoming 2 or more connection from different providers. Look up "policy based routing" and "source routing". – davidgo May 08 '20 at 19:28