An explanation of my "route -n" output.
Hi guys and gals,
A wet and windy Sunday afternoon here so I'm playing about on my linux box wondering about which silly questions I need answering. I've always been a bit puzzled about the output of the route command. My linux machine ( from which I issue the route command) has IP of 192.168.0.11 and is connected to a gateway machine ( from which I share a net connection) with IP 192.168.0.1. Here is the output of route -n Code:
Destination Gateway Genmask Flags Metric Ref Use Iface Thanks again ! Uncle ps: Gateway Machine has two NICs installed. |
The route command is used to work with the kernels routing table. Simply put, this is where the kernel goes to decide where to send a IP packet. It is like an address book of connections, moving the IP packet to its next router, toward its destination.
Your system is a host, and belongs to sub-net 192.168.0.x. If you want to route packets to yourself, notice you have an entry 127.0.0.0 sub-net. So if you were to ping 127.0.0.1, the kernel sees 127.0.0.0 in the routing table, and forwards the packet to interface 'lo' ( your system ). What is not so easy to understand is on a system with a single interface, why do you need it? Where else can it go you ask? It is set up so you can have many interfaces, connecting to many networks. You can if you want turn your system into a router, with several interfaces. Then it would make more sense to us humans, go look in the routing table to figure out which interface to send out any specific packet on. BTW, its snowing here too, just cleaned out the driveway... |
The first line is for the route to your LAN. Your lan has a network address of 192.168.0.0/24.
The second line is a link-local route. It is intended for use only by the local networks data-link network layer only. Apple uses it for zero-conf. In Linux, avahi understands zero-conf and other similar protocols. The third line is the route for local-host. Which I'm sure you know about. The last line is for the default gateway. Notice the G under the flag. The G is for gateway. Note the 0.0.0.0 for the netmask. --- edit We got several inches ourselves. I'm going to collect a few buckets of snow latter to melt for plant water. |
Thanks a lot ! A clear and succinct explanation as usual.
Could we have some of your snow ? We have been longing for a white Christmas in London for decades ! Regards, Uncle |
The snow has turned to freezing rain in the last two hours. You can have that too....
|
All times are GMT -5. The time now is 11:51 AM. |