Networking Forums

Networking Forums > Computer Networking > Linux Networking > how to interpret route command

Reply
Thread Tools Display Modes

how to interpret route command

 
 
Charles
Guest
Posts: n/a

 
      03-16-2005, 11:49 PM
I am trying to understand what this means...

[charles@host ~]$ /sbin/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
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0
eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0
eth0
[charles@host ~]$

The first number, 192.168.1.0, is not a real address. So how can it be
a destination for anything.

The 0.0.0.0 for Gateway make no sense

The 169.254.0.0 means absolutely nothing to me. I do not believe
I have anything associated with that number.

The one number that makes sense is 192.168.1.1. That *IS* my gateway.

Where can I read more about how to interpret the output
of the route command?

Tnx,
Charles


 
Reply With Quote
 
 
 
 
Jim Berwick
Guest
Posts: n/a

 
      03-17-2005, 12:23 AM
Charles <(E-Mail Removed)> wrote in news:4238D41E.98BED4E0
@dunjas.com:

> The first number, 192.168.1.0, is not a real address. So how can it be
> a destination for anything.


the first line means:
To get to network 192.168.1.0 with a netmask of 255.255.255.0
(192.168.1.0/24), use a gateway of 0.0.0.0 (which means you are directly
connected to that network).

> The 0.0.0.0 for Gateway make no sense


0.0.0.0 means there is no need to use a gateway, it is directly connected
to you.

> The 169.254.0.0 means absolutely nothing to me. I do not believe
> I have anything associated with that number.


169.254.0.0/16 is used for APIPA. DHCP clients that can not find a DHCP
server randomly assign themselves one of these addresses so they can
communicate with each other while the server is down.

> The one number that makes sense is 192.168.1.1. That *IS* my gateway.


Right. The last line says to get to 0.0.0.0/0 (anywhere I have not
already given a route to) send it to 192.168.1.1 and they will know where
to put it next.

 
Reply With Quote
 
Paul Colquhoun
Guest
Posts: n/a

 
      03-17-2005, 12:40 AM
On Wed, 16 Mar 2005 18:49:34 -0600, Charles <(E-Mail Removed)> wrote:
| I am trying to understand what this means...
|
| [charles@host ~]$ /sbin/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
| 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
| 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0


| [charles@host ~]$
|
| The first number, 192.168.1.0, is not a real address. So how can it be
| a destination for anything.
|
| The 0.0.0.0 for Gateway make no sense
|
| The 169.254.0.0 means absolutely nothing to me. I do not believe
| I have anything associated with that number.
|
| The one number that makes sense is 192.168.1.1. That *IS* my gateway.
|
| Where can I read more about how to interpret the output
| of the route command?


I'm not sure where this is all written down, but here is my stab at it.

Column 1 (Destination) is where you want to get. This needs to be read
in conjunction with column 3 (Genmask). The 0.0.0.0 entry (with mask
0.0.0.0) matches anything and is called the "default" route.

Column 2 (Gateway) is where packets that match Columns 1 & 3 are sent.
An entry of 0.0.0.0 here means that matching packets can be sent directly
to their destination, generally because it is on the same network segment
as the sender. The network will be attached to the interface in Column 8.

Columns 4, 5, 6 & 7 contain information about where the route came from,
what preference it has in case of multiple routes, and how often it has
been used.

I hope this helps.


--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
Asking for technical help in newsgroups? Read this first:
http://catb.org/~esr/faqs/smart-questions.html#intro
 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      03-17-2005, 12:50 AM
On Wed, 16 Mar 2005 18:49:34 -0600, Charles <(E-Mail Removed)> wrote:
> I am trying to understand what this means...
>
> [charles@host ~]$ /sbin/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
> 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0
> eth0
> 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0
> eth0
> [charles@host ~]$
>
> The first number, 192.168.1.0, is not a real address. So how can it be
> a destination for anything.


That IP along with 255.255.255.0 netmask defines a network, where
192.168.1.0 is the network, 192.168.1.255 is broadcast address, and
anything between that is a valid IP in that network.

> The 0.0.0.0 for Gateway make no sense


Sure it does, it means that the network is local, can be reached with arp
without any gateway (ie, local LAN). A gateway other than 0.0.0.0 would
be a router that leads to another network.

> The 169.254.0.0 means absolutely nothing to me. I do not believe
> I have anything associated with that number.


Sounds like default IP range Windows assigns when DHCP fails.

> The one number that makes sense is 192.168.1.1. That *IS* my gateway.


That is your default gateway, but in order to use it as a gateway, there
has to first be a route to that IP, which is the first route in the table
(showing how to reach 192.168.1.0/255.255.255.0 network).

> Where can I read more about how to interpret the output
> of the route command?


'man route' is a start. Although, most people do not need to know much
more than what is a local route, and what is a default gateway (which
would usually only lead to the internet), which is usually mostly
automatic if you use DHCP or you configure an interface IP/netmask.
However, if you set static IP/netmask, you typically need to set a default
gateway that leads to internet. Typically you would NOT set a default
gateway if using ppp or pppoe for internet connection (so ppp can
negotiate defaultroute).

For learning about networks and netmasks, do a web search for 'calculate
netmask' (there are web forms that can figure out network IP and network
range based on an IP/netmask, etc.).
 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      03-17-2005, 03:52 AM
Charles <(E-Mail Removed)> wrote:
>I am trying to understand what this means...
>
>[charles@host ~]$ /sbin/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
>169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0
>eth0
>0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0
>eth0
>[charles@host ~]$
>
>The first number, 192.168.1.0, is not a real address. So how can it be
>a destination for anything.


The /ifconfig/ command deals with setting or printing the
network interface configuration for *receiving* data packets.
It deals with the IP addresses for network interfaces, not the
IP addresses in data packets. As such it has no effect on
outgoing packets. Incoming packets depend on the IP assigned by
/ifconfig/ to know which interface is the right one.

The /route/ command deals with setting or printing the
configuration for *sending* data packets. It deals with the IP
addresses in packets, not those of the network interfaces. As
such it has no effect on incoming packets. Outgoing packets
depend on the routes assigned by /route/ to know which interface
is the right one.

So when we look at a route table, do not expect to see anything
to do with the IP addresses of your host. In fact, the only
actual IP address you'll see is that of a gateway, and then only
on a route that says we not only send it to a specific network
interface, but we send it to an IP address that it is not
addressed to.

So... all of those entries in the route table are basically
*subnetting*, because you have multiple networks and it is
necessary to decide on a per packet basis which network gets
which packets. There are three basic fields used to decide
that, and if they match, that line is what determines the
routing. If they don't match, the next line is examined.

The process used is to take the packet's destination address,
mask it with the "Genmask" field, and then compare that to the
"Destination" field. If they compare true, that line selects
the interface to use.

Hence, the first line of your route table, which looked like
this (with some editing to delete fields we are ignoring),

Destination Gateway Genmask ... Iface
192.168.1.0 0.0.0.0 255.255.255.0 eth0

If we send a packet to address 192.168.2.20, when masked with 255.255.255.0
we get 192.168.2.0, which does *not* match the Destination field, 192.168.1.0,
so that line does not determine where the packet is sent.

If the next line looked like this,

192.168.2.0 0.0.0.0 255.255.255.0 eth1

The IP packet addressed to 192.168.2.20, when masked, does match
the Destinations field, and that packet would go to interface
eth1.

Now, consider sending a packet to 127.1.2.3 (something you will want to
try, just to verify that this works). Not shown in your route table, but
no doubt actually there, is a line like this

127.0.0.0 0.0.0.0 255.0.0.0 lo

So if we mask 127.1.2.3 with 255.0.0.0, we get 127.0.0.0 which
matches the destination field and the packet goes to the lo
interface. The point being that while "localhost" is assigned
127.0.0.1 and that is commonly used as a loopback, the route
table is actually set up so that you have thousands of IP
addresses that are a loopback. Any address with 127.x.x.x will
be sent to the lo interface.

Some ethernet configuration tools use the address 169.254.0.0 as
a bogus route for an unconfigured network, and hence that shows
up and is confusing.

If the "Destination" or the "Genmask" fields have 0.0.0.0, the result
is a mask/compare operation which will yield true for any address, and
hence it provides a default for any otherwise unrouted packet.

The same 0.0.0.0 is a bogus address when placed into the Gateway
field as an indication that no gateway exists. A gateway is
necessary when the packet is addressed to an IP address not
available on a directly connected network. The packet is sent
to a host that is on a connected network, which necessarily must
be able to forward the message to either addressed host or to
another gateway.

The above tells you how to read a route table, but it doesn't explain
how to set routes in the table. Setting routes is worth an entire
post all by itself, so I'll not bore you with it unless you ask.

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
Charles
Guest
Posts: n/a

 
      03-18-2005, 12:07 AM
Jim Berwick wrote:

> Charles <(E-Mail Removed)> wrote in news:4238D41E.98BED4E0
> @dunjas.com:
>
> c> The 169.254.0.0 means absolutely nothing to me. I do not believe
> c> I have anything associated with that number.
>
> 169.254.0.0/16 is used for APIPA. DHCP clients that can not find a DHCP
> server randomly assign themselves one of these addresses so they can
> communicate with each other while the server is down.
>


Is there a Linux command to determine if there is a DHCP server on the local
net?
I thought my router was suppose to function as DHCP server. Perhaps not?
Tnx,
Charles


 
Reply With Quote
 
no@damnspam.ca
Guest
Posts: n/a

 
      03-18-2005, 02:18 PM

Thursday March 17 2005 19:07, Charles wrote to All:

C> Is there a Linux command to determine if there is a DHCP server on
C> the
C> local net? I thought my router was suppose to function as DHCP
C> server.
C> Perhaps not? Tnx, Charles

Ask your sysadmin!

Kari Suomela

KARICO Business Services
Toronto, ON Canada
http://www.karico.ca - http://www.damnspam.ca

 
Reply With Quote
 
Moe Trin
Guest
Posts: n/a

 
      03-19-2005, 01:09 AM
In article <(E-Mail Removed)>, Charles wrote:

>Jim Berwick wrote:


>> 169.254.0.0/16 is used for APIPA. DHCP clients that can not find a DHCP
>> server randomly assign themselves one of these addresses so they can
>> communicate with each other while the server is down.


I've noticed posts relating to this route from users of Red Hat/Fedora, and
SuSE. I believe this is only to prevent the log message about 'martian
source' packets.

In the case of Red Hat/Fedora, this route is set up in the script
/etc/sysconfig/network-scripts/ifup:

# Add Zeroconf route.
if [ -z "${NOZEROCONF}" -a "${ISALIAS}" = "no" ]; then
ip route replace 169.254.0.0/16 dev ${REALDEVICE}
fi

so if you set the variable 'NOZEROCONF' the /etc/sysconfig/network
configuration file, this "feature" will be disabled. As the test above
merely looks to see if the string is zero length, setting ti to 'no' or
'blue' or anything else will do the job.

>Is there a Linux command to determine if there is a DHCP server on the
>local net? I thought my router was suppose to function as DHCP server.
>Perhaps not?


Not really relevant to the route entry. We don't use DCHP here, but you
could look for UDP packets from port 67 on the DHCP server. These are
normally not _broadcast_ so they won't be seen on a switched network
unless the _unicast_ packet is directed at the listener or you are on
a monitor port (which gets everything).

Old guy.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About the route command Neroku Linux Networking 3 04-25-2007 03:41 PM
How To Add a route command joe Windows Networking 2 11-14-2006 10:35 PM
Route-Command =?ISO-8859-15?Q?Heinrich_L=F6prich?= Linux Networking 3 08-29-2005 11:28 AM
Route Command Pete Windows Networking 2 04-12-2004 05:25 AM
ROUTE command =?iso-8859-1?Q?Utopic=AE?= Windows Networking 1 02-25-2004 02:09 PM



1 2 3 4 5 6 7 8 9 10 11