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 routing table for a linux PC. (I already enabled ip_forward option)

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.0.1.0        10.0.1.11       255.255.255.0   UG        0 0          0 p1p1
10.0.1.0        *               255.255.255.0   U         0 0          0 p1p1
10.0.2.0        *               255.255.255.0   U         0 0          0 p1p2
10.0.3.0        10.0.2.1        255.255.255.0   UG        0 0          0 p1p2
192.168.1.0     *               255.255.255.0   U         0 0          0 em1
  1. what does gateway * mean? Is it the same thing as 0.0.0.0? If not, what are the differences?

  2. which gateway it will send when the pc got an packet to 10.0.2.0? I heard some people saying it will forward the packet to all available gateway. Is the statement correct? If so, how does it know which gateways are available?

  3. which routing entry will it use, when the pc got an packet to 10.0.1.0? (the first one or the second? I dont think this is an example of longest-prefix matching)

share|improve this question

migrated from stackoverflow.com Mar 30 '13 at 8:03

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 2 down vote accepted
  1. Gateway * means that the destination network is directly connected, it doesn't have to go through a router.

  2. It won't go through a gateway to get to 10.0.2.0/24, it will send directly to the destination through interface p1p2.

  3. I think it should use the directly connected routing entry for 10.0.1.0/24. Otherwise it has an infinite recursion, since the gateway to 10.0.1.0/24 is on 10.0.1.0/24.

Answering the question in your comment, 0.0.0.0/0 is the default route, used for anything without a more specific route.

share|improve this answer
    
Thanks for such a quick reply! Now I see the reason why the entries with gateway * are on the table before I added them.... Can you explain how a gateway 0.0.0.0 works too? –  Alex Mar 30 '13 at 7:40
    
sorry, I did not say the question clearly. What I mean is, if it has an entry which has destination 10.0.2.0 and Gateway 0.0.0.0, what will happen if the pc got a packet to 10.0.2.0 (assume I dont have the one with asterisk and default gateway is not set). –  Alex Mar 30 '13 at 7:50
    
I'm not sure if 0.0.0.0 is valid as a gateway. If you actually have a routing table like that, can you post it in your question? Maybe the flags will clarify/ –  Barmar Mar 30 '13 at 7:54
    
Actually, I saw the entry in the link. It has only U flag. cyberciti.biz/faq/… –  Alex Mar 30 '13 at 8:34
    
0.0.0.0 is the same as *. It just depends on whether you gave the -n option, which says to display numeric addresses instead of names. –  Barmar Mar 30 '13 at 8:36

Ad 1 Asterix (*) is printed for networks for which gateway is not needed, because they're connected directly to your computer.

Ad 2 You will send your packet over p1p2 interface.

Ad 3 I think it will folllow the * rule, so it'll send it over the interface to the destination host.

share|improve this answer
    
so, the first entry in the table does not do anything? –  Alex Mar 30 '13 at 7:42

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.