Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following routing table for a linux PC. (I already enabled ip_forward option)

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

  2. which gateway it will send when the pc got an packet to 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 (the first one or the second? I dont think this is an example of longest-prefix matching)

share|improve this question

migrated from Mar 30 '13 at 8:03

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

up vote 3 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, it will send directly to the destination through interface p1p2.

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

Answering the question in your comment, 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 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 and Gateway, what will happen if the pc got a packet to (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 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.… – Alex Mar 30 '13 at 8:34 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .