DHCP - Force No Default Route?

Discussion in 'Tomato Firmware' started by quihong, Feb 20, 2013.

  1. quihong

    quihong Networkin' Nut Member

    I have a unique situation where I want to connect my iPhone to a TomatoUSB router Access Point, but I don't want my internet traffic routed through it. Anyone have an ideas on how to do this?

    When setting the Default Route to "", DHCP ends up serving up the router's IP as the default route. I can set a static IP without a default route and it works, but I'm trying to avoid having to use a static IP.

  2. koitsu

    koitsu Network Guru Member

    Important: the OP is talking about the DHCP server for his LAN, not the DHCP negotiation on the WAN side (i.e. DHCP client) with his ISP.

    The dnsmasq documentation explains clearly how to do this. The value is "magical", and always refers to the IP address of the machine running dnsmasq (this is stated in the documentation). Thus, add the following to Advanced -> DHCP/DNS -> Dnsmasq Custom Configuration:


    Where 192.168.x.x is the IP address of the iPhone. You will need to give it a static IP address viaBasic -> DHCP/ARP/BW and use the IP address you enter there. This will tell the iPhone, during DHCP negotiation, that the default route it should use is its own IP, i.e. packets not on the same network segment will be attempted to be forwarded to itself (not really but in effect this is what it does), which means the device won't have Internet access.

    Alternately you could try setting the advertised default route via the above to an IP address you don't use, such as (do not use the network address (0) or broadcast address (255)), however this will probably cause the iPhone to stall/lag for a little while before determining it can't talk to the Internet (vs. immediately saying it can't) since ARP will be attempted to figure out who is, have to wait for a timeout, etc...

    Be aware this change will affect any client on your LAN doing DHCP with your router. If you want only the iPhone to get this modified default route, you will need to remove the static IP entry for the iPhone from DHCP/ARP/BW and instead use the dhcp-host feature of dnsmasq to formulate the static IP entry for that MAC, and specifically making use of the set:<tag> feature, e.g. something like: dhcp-host=00:11:22:33:44:55,set:iphone, Then, in your dhcp-option statement, you would do something like dhcp-option=tag:iphone,option:router,192.168.x.x. Make sense?
  3. quihong

    quihong Networkin' Nut Member

    Thanks Koitus for the response.

    It doesn't seem like there is a "dhcp-option=option:router,<null>"? Basically, don't provide a default route?

    Let me describe in more detail what I'm trying to accomplish so you can help tell me if any of the above suggested solution will work.

    I have this idea to build a "Portable Wireless Speaker System" similar to the Boominator, except I'll be adding a TomatoUSB router with Apple AirPlay support for wireless music streaming from iOS devices. However, since my TomatoUSB router won't have internet access, but my iPhone will, I need internet traffic to be routed through the iPhone's LTE/3G/4G connection so I can play Pandora and other internet radio stations. I can accomplish this now, but I need to use a Static IP on the iPhone, which works fine for the typical use case where I'll be playing music from my iPhone. However, it would be nice to be able to say to my family and friends, "go ahead and connect to "AirPlay" (my SSID) and AirPlay Pandora or whatever you have on your iPhone" versus "oh wait, you want to play Pandora?, give me your phone, I need to set a static IP address"


    [Edit - I might have found my answer]



    This will disable the sending of option 3 (default router) and 6 (dns server)
    I don't see this mentioned in the man page though.
  4. koitsu

    koitsu Network Guru Member

    The information you've found on that forum is false/wrong, and doesn't make any sense anyway. They're trying to describe the dhcp-option feature, which is documented.

    There is no way to disable inclusion of a default route via DHCP in dnsmasq. You will need use the method I already described.
  5. rhester72

    rhester72 Network Guru Member

    Actually, I've used something like this for some time to prevent the inclusion of a default route over DHCP (this was in concert with OpenVPN TAP):


    Works fine.

  6. koitsu

    koitsu Network Guru Member

    Interesting. The use of a word without tag: in front of it must induce the tagging behaviour. But more importantly, not specifying a value for a DHCP option somehow disables sending the option? That doesn't appear to be documented either. Hrmf. *shakes head* ISC dhcpd is so much easier to comprehend, heh. :)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice