Understanding my route table
this isn't programming at all, but I've seen related topics so I thought why not.
I am using ubuntu and currently trying to learn basic networking. I read a lot of theory, so I understand the terms (gateway, netmask etc...) but I can't seem to understand my own network at home. I have a router that serves my laptop (wireless) and my desktop computer (ethernet).
When I run route
in my desktop computer this is the output:
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 * 255.255.255.0 U 1 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default RTA1025W.home 0.0.0.0 UG 0 0 0 eth0
I can't understand it. I know the table specifies routing rules, I just can't understand those rules. An example would be highly appreciated: if I send a datagram to another computer on my home network, the first rule should match right? What column specifies where the datagram is redirected to?
Also, just to make sure, if I am trying to reach a website then all datagrams are directed to my router, right?
Also, what is link-local
? It is defined in my /etc/networks
file, I just don't know what that is.
I hope I was clear with what I am trying to understand, if not it's only because I'm a complete novice. Thanks anyway!
EDIT: to make it clear, I did read man route
. As far as I understand: Destination
refers to the destination of the datagram currently being routed. The same goes for Gatway
and Genmas
.
That's great but what I don't understand is where will it be routed to? That's what I am trying to understand
Yotam
Solution 1:
For a quick overview of route
command (or any commands that you might not fully understand just yet) you can type man route
in a terminal and that will give you an overview of the command.
You can also search for man route
in google and that will return you the man page for route for online viewing.
Have a look here, the output in your case is pretty straight forwards.
About the link-local
entry it is normal as you can see here.
About your current entries in your route table:
First entry tell you the following:
- Any traffic with destination 10.0.0.0 will not be using a gateway (thats the
*
on the line), will be using a 255.255.255.0 net mask, route is UP (that's the meaning of theU
) and which interface the route uses. If you doifconfig -a
you will probably see that your eth0 IP address is within the 10.0.0.0 range, so this is you local network route.
Third entry tells you the following:
- If any traffic does not fit the traffic defined on any other rules then use this route. Imagine you want to visit www.yahoo.com. The address will be translated (I don't know what the exact result, but it won't be in the 10.0.0.0 range for sure). Since it won't fit on the 1st or the 2nd route, it will be routed using the RTA1025W.home gateway. The metric will not matter and it will be using the interface defined on the default route line.