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 a pretty standard setup at home, which consists of a single subnet 192.168.240.0/24, and my DSL router sits on 192.168.240.1. Other devices occupy 192.168.240.64 onwards.

But I've now added a Linux server on 192.168.240.16, which has two NICs. One obviously sat on 192.168.240.0/24 and another sitting on 192.168.241.0/24 (192.168.241.16).

At the moment, there is nothing else on 192.168.241.0/24, but I intend to move my DSL modem onto this subnet in the near future.

I'm trying to get routing configured on the Linux box between the two interfaces, and I believe I have that working. But before I move the DSL modem, I thought I'd make sure that routing was working.

I checked the routing table on the Mac (using netstat -r) before I did anything, which (minus irrelevant entries) showed as:

Destination        Gateway           Flags        Refs      Use   Netif Expire
default            192.168.240.1     UGSc         4665        0     en0
192.168.240        link#4            UCS             8        0     en0

So I then configured a static route on the Mac as follows:

route add -net 192.168.241.0/24 192.168.240.16

Then the routing table on the Mac showed:

Destination        Gateway           Flags        Refs      Use   Netif Expire
default            192.168.240.1     UGSc         4665        0     en0
192.168.240        link#4            UCS             8        0     en0
192.168.241        192.168.240.16    UGSc            0        1     en0

When I then attempted to ping the second interface on my Linux box from the Mac, I received no reply. Checking the routing tables again, to my amazement, an extra line appeared.

Destination        Gateway           Flags        Refs      Use   Netif Expire
default            192.168.240.1     UGSc         4665        0     en0
192.168.240        link#4            UCS             8        0     en0
192.168.241        192.168.240.16    UGSc            0        1     en0
192.168.241.16     192.168.240.1     UGHDI           0       17     en0

Why did this last line appear, and why did it not honour the route I'd created previously? What do I need to do to force it to use the static route I've created?

share|improve this question
    
I need more info before I can help you with your problem, your wording is very ambiguous and it is hard to tell which machine you are performing which commands on. Can you please clarify? –  Jeff Welling May 8 '11 at 19:44
    
Good point. Question edited to hopefully clarify this. –  Bryan May 9 '11 at 7:51

2 Answers 2

up vote 1 down vote accepted

I think the D in UGHDI means dynamic. The Linux box told the Mac that it didn't know a route to that subnet and told it that it would be better to route that data to the DSL router (because that is the Linux box's default gateway and so assumed to know how to route everywhere).

This implies the Linux box isn't routing data between it's NICs. I'd check it's configuration.

share|improve this answer
    
That seems to fit, as I'm working on two Linux routers (one at home and one at work). The one at work has been configured the same way and isn't routing. Attempts to test the one I have at home have failed with the details specified in the question. Thanks, I'll investigate the Linux router instead. –  Bryan May 9 '11 at 9:36

It looks like you need to not only add the new subnet, but also add a new default route which appears to be what your doing wrong.

Anecdotally, I frequently have trouble with basic name resolution and networking on Apple devices (ssh hostname fails with "couldn't resolve host hostname" but nslookup hostname returns the IP), so this doesn't surprise me in the least.

share|improve this answer
    
I don't want to change the default route just yet, as I've not yet moved the DSL modem. For now, I just want to make sure that routing is working on the Linux box. –  Bryan May 9 '11 at 7:52

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.