On Ubuntu 21.10, I have a cellular modem connected via USB that I need to be the primary interface on which all network traffic utilizes. However, I also need the wifi interface (in my case, wlo1) to also continue to work, and be the backup in case the ppp0 interface goes down.

ping google.com -I ppp0 -> works through ppp

ping google.com -I wlo1 -> works though wifi

ping google.com -> works through ppp (this is the difficult part)

I can get the cellular modem online just fine using pppd and corresponding scripts, and get a valid IP address. It's the routing I seem to be struggling with.

What I've tried


I first tried utilizing options in the PPP script, options like defaultroute and replacedefaultroute. defaultroute does not alter the routing table and add a default route at all. Perhaps this is because, as I've come to learn, a routing table can only have one default route. Not sure. When trying to use the replacedefaultroute option, pppd does add a default entry into the main routing table, however, this winds up breaking both interfaces and I have no internet connection whatsoever. It does not remove the existing default route for wifi, thus there exist two default routes in the main routing table.

Manually adding routes

I then played around with adding routes to the main routing table manually. Whan I run sudo ip route add {ipAddress} dev ppp0 src {ipAddress}, then both interfaces work, but wifi is still the primary interface. Attempting to add that route with a metric lower than the wifi's metric also does not make it so that the ppp interface is primary (i.e. ping google.com still goes out via wifi). I can add a second default, but it must have a metric higher than wifi, else it causes both connections to stop working.

A second routing table

Following other stack exchange posts and articles like this one, I explored the option of having two routing tables and adding a route and a default route the second routing table. While this doesn't break either connection, even using a metric lower than the wifi's metric, the ppp interface still is not the primary interface. Also, if I disconnect from wifi, then the ppp interface stops working as well, and the 2nd routing table is cleared (is this NetworkManager doing this?)


Is what I am trying to accomplish even possible? If so, what am I doing wrong? Am I fighting with NetworkManager?

Any help is greatly appreciated!

1 Answer 1


One thing to look at is your DNS servers (/etc/resolv.conf).  I had issues where I wanted to prioritize the wlan0 interface, but the two highest entries in the resolv.conf file were DNS servers provided by the 4G network.  You can reject those DNS servers by cancelling out "usepeerdns" in the provider file.  Typically, in my case, pinging eventually worked, but it took approximately 10 seconds per ping, since the device was first trying to access the first DNS servers.

Another thing that helps to determine whether you have DNS issues is pinging IP addresses (e.g.,, which is a DNS server operated by Google) directly.

I have also tried to consistently get two defaultroutes (with different metrics) in the routing table, for ppp0 and for wlan0, but haven't been able to accomplish that.

  • Why do you believe that DNS and routing are correlated?  It seems to me that they are about as closely linked as windshield wipers and tires.  Can you provide a reference to support your answer? … … … … … … … … … … … … … … … … … … … … … … Please do not respond in comments; edit your answer to make it clearer and more complete. Aug 1, 2022 at 18:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .