On 14 Jun 2006, in the Usenet newsgroup comp.os.linux.networking, in article
<(E-Mail Removed) .com>,
(E-Mail Removed) wrote:
>Unruh wrote:
>> (E-Mail Removed) writes:
>>> how can i make the default gatewat to be the localloopback?
>> Why would you want that?
>i am writing a server that listens to packets on the lo.
Packets that arrive on the lo interface will have one of two types of IP
address for both source and destination - either 127.0.0.0 through
127.255.255.255 (the "localhost" network) or the IP address of one of the
real interfaces of "this" computer. To _reply_ to these packets, the kernel
knows to use the loopback interface.
>i have other route rule for traffic to go out of the machine.
That's great, but the local IP address, or localhost is not reachable
by going outside of the computer. Try this - enter the commands
/sbin/ifconfig -a
ping -c 10 IP.ADD.RE.SS <-- try 127.0.0.1 AND the address of eth0
/sbin/ifconfig -a
Now look at the 'TX packets' and 'RX packets' counts - and note that the
packets used the loopback interface, even if you tried to ping the address
of the Ethernet interface. Why? Because the kernel knows the IP address
translates to itself, and when talking to yourself there is not need to
clutter up the wires with needless noise.
Old guy