Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have the following zebra.conf on my router box "A":

hostname nuclear-router
password password
enable password password

interface eth0
ip address 192.168.2.1/24
multicast
no shutdown

interface wlan0
ip address 192.168.1.2/24
multicast
no shutdown

#ip route 0.0.0.0/0 wlan0 # Does not work. 
ip route 0.0.0.0/0 192.168.1.1 # Works beautifully

eth0 is connected to a switch and contains the 192.168.2.0/24 range, and A is connected to my WRT54GL "B" (with IP 192.168.1.1, containing 192.168.1.0/24 range, DHCP serves IPs above .100) wirelessly. B is connected directly to my DSL modem.

The problem is that when I specify the default route using the interface name, I can't connect to the internet from A or any hosts behind it - I'm always hit with a "no route to host" error. Name lookup and pinging any local host (even in a different range) or the DSL modem works fine - it's only when going beyond the modem that things stop working. However, when I use the IP of B as the gateway, it works fine. I noticed that route output on A when the default route was specified using the interface alone had only an asterisk in the gateway column. I was under the impression that these approaches should be identical in practice, so though I got it working, I'd like to know what I'm misunderstanding (and/or misconfiguring). Why didn't the default route work when specified using just the interface?

All routers and the modem too have RIP (version 2) enabled, and of course the password isn't really the word "password".

share|improve this question

2 Answers 2

up vote 2 down vote accepted

While a default route might work in the desired manner when the destination is a point-to-point layer-2 link, it assuredly won't work to a broadcast interface like ethernet or wlan. Configurable routes are at OSI Layer 3 (IP numbers), and ought not to require MAC addresses (Layer 2), interface names (layer 1), or port numbers or packet types (layer 4+). Once the right destination IP number is provided for a route, the router will handle what MAC address to forward packets towards, and which interface that MAC is connected.

In summary, setting your default route to an interface name doesn't work because its not supposed to... If you don't know what IP address is supposed to handle forwarding of non-local traffic, then it's best not to have a default route set.

share|improve this answer
    
Default routes on some devices can point to interfaces and not IP's. It's generally not recommended, but is technically possible. –  cpt_fink Apr 7 '13 at 5:34
    
I completely forgot to consider that there are other machines receiving in the same subnet, now in this light it's all obvious (d'oh) –  jaymmer Apr 7 '13 at 7:26
    
Yeah, one can point default route to a serial interface or other point-to-point routes; I don't think it works very well on broadcast interfaces, however. –  Nevin Williams Apr 11 '13 at 8:25

Seems to me you are confusing the hostname with the interface name. The name wlan0 is the name of the interface. The hostname is stored in the DNS and is what the lookup returns.

Most likely, what is happening is DNS is looking up the host wlan0 and coming up with the error no host found.

share|improve this answer
    
Who do you think this? It doesn't make any sense to me... why would the DNS be looking up "wlan0"? –  jaymmer Apr 5 '13 at 21:34
    
Consider: the the command ip route 0.0.0.0/0 wlan0 fails, but the command ip route 0.0.0.0/0 192.168.1.1 works. The only way to get from wlan0 to 192.168.1.1 is via the DNS system somewhere. –  Mei Apr 15 '13 at 22:30
    
But why would the interface name be looked up through DNS? The zebra.conf manpage says that the ip route command takes either IP address or the interface name, not a domain name or anything that should ever touch the DNS. –  jaymmer Apr 17 '13 at 2:09
    
I was considering the ip(8) command - and I'm pretty sure that you would need the keyword dev before a device name. Also, being able to use a name or IP in the same slot is standard practice. Perhaps the configuration file is different - though if you can use a device name or IP, that sounds like it complicates the use of DNS host names. –  Mei Apr 17 '13 at 19:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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