Take the 2-minute tour ×
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 0.0.0.0 means that for line 1 and 2 any packets outside of its network look at the default gateway 10.0.0.1.

Destination Gateway Genmask       Flags MSS Window  irtt    Iface
10.0.0.0    0.0.0.0  255.255.255.0  U   40  0          0    eth1
10.1.1.0    0.0.0.0  255.255.255.0  U   40  0          0    eth0
0.0.0.0     10.0.0.1    0.0.0.0     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 10.0.0.1 or if both eth0 and eth1 both route packets to 10.0.0.1 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 10.0.0.0/24 and 10.1.1.0/24, but they are reachable through the respective interfaces eth1 and eth0, respectively. So if you want to send a packet to 10.0.0.1, the packet is send out over eth1, a packet to 10.1.1.47 over eth0.

To reach »the Internet«, the destination address won't be in the networks 10.0.0.0/24 or 10.1.1.0/24 so the last line would match (0.0.0.0/0) and the kernel would know that it would have to send the packet to the given gateway (10.0.0.1). 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 192.168.1.1 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: http://stackoverflow.com/questions/8599424/understanding-routing-table-entry

share|improve this answer

in your routing table you computer know about 2 subnetwork.
1- 10.0.0.0/24
2- 10.1.1.0/24
rest traffic will be send to your gateway (10.0.0.1).

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 10.0.0.1 (gateway).

share|improve this answer

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

None of them - 10.0.0.0/8 is not globally routable as of RFC 1918. However, the third entry says that 10.0.0.1 is the default gateway (traffic to 0.0.0.0/0 goes there except for destinations at 10.0.0.0/24 and 10.1.1.0/24), 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

 
discard

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.