I am running Ubuntu 12.04.

I have a HSDPA USB Modem, with which I can successfully dial in. It works fine as well when I set the default gateway (remote IP address) in the main routing table. But I would like to use this modem in parallel to my WLAN, which will be the main interface, and therefore occupy the default gateway in the main table.

I want to send packets through the modem only from sockets on the local IP address assigned by dialing. Thus I introduced a new rule in the IP rule table from x.x.x.x lookup table 1, where I used the local IP address. Then in the table I simply added the default via x.x.x.x dev ppp0 where I used the remote IP address provided by the dialing process.

Now, if I turn of my WLAN and remove the default rule in the main table, I cannot resolve any host. I can however use traceroute to trace a path to the primary DNS server (Address also supplied by the dialing). If I add the default rule back to the main table, everything works fine again.

So, I suspected that the IP from rule would do its job, but somehow somewhere packets are apparently dropping. Can anyone suggest or hint to a solution to my problem?


By adding the primary (and secondary if you like) nameserver to the ip rule list of to address, from all to x.x.x.x lookup table 1, I can actually retrieve host information, i.e. I can e.g. run host google.com successfully. But even by forcing ping to use the ppp0 interface, ping google.com -I ppp0, I cannot reach it, Network is unreachable.

1 Answer 1


The DNS server is determined by /etc/resolv.conf (Ubuntu has annoying "helpers" the write to this file) To have the IP be the nameserver used for name lookups, have /etc/resolv.conf look like this:


A DNS setup where one nameserver resolves some IPs and another nameserver resolves other IPs is more complicated, but I have one documented here:


  • I had noticed that file, yes. For the wlan there is a nameserver as well as a dns-search entry. For the ppp0 interface there are two nameserver entries (primary and secondary addresses). When the wlan goes down, the latter two remain there. So I think that works properly.
    – Oxidator
    Jan 31, 2014 at 8:17
  • When you have multiple nameserver entries in /etc/resolv.conf, it just uses one of the nameservers at random.
    – samiam
    Jan 31, 2014 at 21:24
  • @samiam no, not at random. The documentation says: "If there are multiple servers, the resolver library queries them in the order listed.". Except if you have options rotate, in which case it will do a round-robing walk from the list (so still not random) Mar 11, 2017 at 20:20

You must log in to answer this question.

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