Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 06-23-2011, 05:31 PM   #1
LQ Newbie
Registered: Aug 2006
Posts: 24

Rep: Reputation: 0
ARP table or routing table consulted first?

Here's the overview of the configuration: 3 computers on a switch. Computer1 has DNS/DHCP/router (routers) in place. Computer2 receives static DHCP from Computer1. Computer3 has a staticIP with a different subnet than that of Computer1.

Computer1: eth0 - (router)
Computer2: eth0 -
eth0:0 - (alias)

Computer3 has a route that directs it to for answers.

If you have a route set in place, say

Destination Mask Gateway

And someone tries to ping At the time the only entries in ARP cache (of is : at 00:11:22:33:44:55 on en0 at 11:22:33:44:55:66 on en0

What I would expect is that since isn't in ARP's cache and since there is a route saying if it fits the format, direct it to the gateway

From my testing results, this isn't the case. The router starts querying for who have and Computer2 responds.
Why is this?
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-23-2011, 06:04 PM   #2
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
I believe it would be because the gateway defined for the network is not reachable for computer 3. is not in the same network as (unless, of course, the network mask is set to However, as ARP works at the physical (TCP/IP model) or data link (OSI model) level (i.e. doesn't care about networks and subnets), then its broadcast will reach computer 2, so long as they're attached to the same switch.
Old 06-23-2011, 06:07 PM   #3
Senior Member
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
The routing table also contains an entry for each network you have a nic attached to with no gateway(next hop) set. As there is no gateway the machine then knows that it needs to send an arp request to find the target as it's directly connected.
Old 07-14-2011, 02:20 PM   #4
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
There are two type of routes - direct (or connected) and indirect. If you configure on an interface the router implicitly aquires a direct route via eth0. The router then needs to be given indirect routes (static configured routes or a routing protocol) that directs any traffic that does not belong to directly connected networks. These routes can be more explicit less explicit, or default

A router should, on being given a packet to route, look for the longest match route. If a packet is destined for, is a match, but will be the preferred route because it is the longest, or most explicit, match. will match because its a longer match than does not match anything except so will follow the default route.

Any packet that gets directed along an indirect route will require a gateway that is a member of a shared directly connected network to use as a next hop. Your route will not work as you have no interface configured with 1.2.3.x.

Any packet that matched a direct route will be sent to the interface. If the interface is a multi acces network such as ethernet or token ring you run into a problem, there are lots of peer devices on that interface so you need to work out which one is the actual destination. So ARP is invoked to work out which host on the shared network owns the next hop address.

So if I assume that your PC's are configured as and then they both have a direct route of If you ask them to ping the longest match is via eth, therefore the CP will ARP for

If you ping the router will match this to It will then, if it supports recursive routing, do a route lookup for If it doesn't it will immediately fail due to having no interface as a member of this network. Either way when it doesn't find the next hop it will discard the packet and send an ICMP network unreachable message to the PC.


2 members found this post helpful.
Old 07-15-2011, 04:56 PM   #5
LQ Newbie
Registered: Aug 2006
Posts: 24

Original Poster
Rep: Reputation: 0
Thanks for the input. I managed to solve my problems. At the time I had routes set up poorly so every computer on could talk directly to each other instead of using the router. I was also intentionally trying to route to a NULL gateway in hopes of getting the packets to drop (I had to do a workaround for it to even accept the fake gw). All is well now, and I have since furthered my knowledge on routes.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ARP table ddomiray Linux - Software 3 10-26-2009 01:52 PM
Arp table poisoning cristian1983 Linux - Security 2 12-28-2007 01:31 PM
how to modify ARP table canci Programming 1 08-22-2006 10:31 PM
ARP table 98steve600 Linux - General 1 03-28-2005 03:25 AM
How to create an proxyarp entry in arp table by using arp command? himalayas Linux - Networking 0 06-04-2003 04:14 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:40 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration