|
||||||||
|
|
#1
|
|
I've a doubt with route. I get this output when I run "route -n" :
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo Shouldn't be the flag UH instead?, since localhost is a host, isn't it? TIA Neroku |
|
#2
|
|||
|
|||
|
On 22 Apr 2007 06:26:36 -0700, Neroku
<(E-Mail Removed)> wrote: > > > I've a doubt with route. I get this output when I run "route -n" : > > Kernel IP routing table > Destination Gateway Genmask Flags Metric Ref > Use Iface > 127.0.0.0 0.0.0.0 255.0.0.0 U > 0 0 0 lo > > Shouldn't be the flag UH instead?, since localhost is a host, isn't > it? > TIA > 127.0.0.0 is the loopback network. The host address would be 127.0.0.1. (You can use any address in 127.0.0.0/8, but they are all the same machine.) -- "One Architecture, One OS" also translates as "One Egg, One Basket". |
|
#3
|
|||
|
|||
|
On 22 Apr 2007, in the Usenet newsgroup comp.os.linux.networking, in article
<(E-Mail Removed). com>, Neroku wrote: >I've a doubt with route. I get this output when I run "route -n" : > >Kernel IP routing table >Destination Gateway Genmask Flags Metric Ref Use Iface >127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo OK - pretty standard >Shouldn't be the flag UH instead?, since localhost is a host, isn't >it? 'localhost' (or more accurately, the loopback) is a slightly different in that any address in the range 127.0.0.0 to 127.255.255.255 is "this" computer. The loopback interface is a memory location with two names - 'loopback transmit' and 'loopback receive', and any packet put into the transmit queue appears (at the same time) in the receive queue. The _name_ localhost is defined in /etc/hosts (but is also hardcoded in some aspects of the networking code) and if you want to be exact then localhost is 127.0.0.1. But that's not what the routing table is showing you. Try the same command without the -n, and you'll get the same display unless you've identified th 127.0.0.0/8 _network_ in one of the configuration files. But you can prove that the network route is correct by trying to ping addresses in that range: [compton ~]$ ping -c1 127.0.0.0 PING 127.0.0.0 (127.0.0.0): 56 data bytes 64 bytes from 127.0.0.0: icmp_seq=0 ttl=64 time=0.4 ms --- 127.0.0.0 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 0.4/0.4/0.4 ms [compton ~]$ ping -c1 127.255.255.255 PING 127.255.255.255 (127.255.255.255): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.4 ms --- 127.255.255.255 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 0.4/0.4/0.4 ms [compton ~]$ Assuming you have a server of some kind listening to localhost... telnet is a simple ony to use as a demonstration, you can then telnet to _any_ IP address in that 127.0.0.0/8 range and get the same results. Now, the H Flag is set based on the supplied network mask information, and as the mask is not 255.255.255.255, this is not a Host route. Another thing to look at is the output of the '/sbin/ifconfig' command. Look at the 'packets' count for transmit and receive, and they will be equal. The counts will also show that any packets going to "this" computer _from_ "this" computer will use the loopback interface even if you have an Ethernet interface that is "up". If your 'eth0' interface is 192.168.1.1, then when you 'ping' that address, the packets will use the loopback interface - why clutter up the wires when you are only "talking" to yourself? The kernel knows all IP addresses of "this" computer, and does the routing automagically. Old guy |
|
#4
|
|||
|
|||
|
On Apr 22, 6:26 am, Neroku <n37...@gmail.com> wrote:
> I've a doubt with route. I get this output when I run "route -n" : > > Kernel IP routing table > Destination Gateway Genmask Flags Metric Ref > Use Iface > 127.0.0.0 0.0.0.0 255.0.0.0 U > 0 0 0 lo > > Shouldn't be the flag UH instead?, since localhost is a host, isn't > it? > TIA You are confusing 127.0.0.1 (localhost) with 127.0.0.0/8 (localnet). Localhost is a host, but this is localnet, which is a network. DS |
![]() |
| Tags |
| command, route |
| Thread Tools | |
| Display Modes | |
|
|