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.

My home network is configured as follows:

Computer -- Route -- Internet

If I run route on my computer, I see

~ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0

My question is that since all packets matching 192.168.1.0 will be directed to 0.0.0.0, why is the first entry needed? Would removing the entry cause any problem?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The entry doesn't point to 0.0.0.0; rather, it points to the eth0 interface. Without it, the system wouldn't know which interface to use when sending packets to 192.168.1.1 and other computers in the same subnetwork.

Remember also that computers in 192.168.1.0 are not behind the gateway; they can be reached directly.

share|improve this answer
    
But when I remove the first entry, I can still ping google.com. Why is this happening? –  Wei Shi Oct 19 '11 at 1:07
    
@Usavich: Because the first entry doesn't match Google's address and wouldn't have been used anyway. It is only for communications with 192.168.1.*. –  grawity Oct 19 '11 at 9:25
add comment

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.