Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I'm trying to learn Linux routing tables and ran into bit of snag. In the example below I'm not sure what is happening. My understanding is means that for line 1 and 2 any packets outside of its network look at the default gateway

Destination Gateway Genmask       Flags MSS Window  irtt    Iface  U   40  0          0    eth1  U   40  0          0    eth0     UG  40  0           0   eth1

So my question is this, which interface is closer to the Internet? Im not sure if packets immediate leave eth0 and eth1 sends packets to the gateway or if both eth0 and eth1 both route packets to for the Internet.

share|improve this question

4 Answers 4

You don't get it completely right. The first two lines tell you that there is no »gateway« for reaching networks and, but they are reachable through the respective interfaces eth1 and eth0, respectively. So if you want to send a packet to, the packet is send out over eth1, a packet to over eth0.

To reach »the Internet«, the destination address won't be in the networks or so the last line would match ( and the kernel would know that it would have to send the packet to the given gateway ( A dependent routing decision would be made to decide how to reach this gateway and as mentioned earlier, this would be made possible by sending the packet out over interface eth1.

share|improve this answer

Economic routers, have 2 IP addresses

  1. LAN, 99% is and we can (should) change it.
  2. WAN. It is assigned automatically by ISP

The Gateway is the address to which packet are destinated, in each computer it is setted using DHCP (most times), if gateway is not setted computers in your LAN can communicate, but can't send packets outside.

Here you can find the answer well explained:

share|improve this answer

in your routing table you computer know about 2 subnetwork.
rest traffic will be send to your gateway (

what does mean? if you send packet to addres from subnet 1, then your computer try send it via eth1.

Answer to your question is that eth1 is nearest "internet", because each ask to internet will go thru (gateway).

share|improve this answer

So my question is this, which interface is closer to the Internet?

None of them - is not globally routable as of RFC 1918. However, the third entry says that is the default gateway (traffic to goes there except for destinations at and, which may have a route (using NAT) to the Internet. In this case eth1 is "closer" to the Internet (in a suitable sense).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.