LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-23-2011, 05:31 PM   #1
YaMaHaBoB
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 - 10.0.0.1 (router)
Computer2: eth0 - 10.0.0.100
eth0:0 - 10.0.0.101 (alias)
Computer3: 192.168.1.100

Computer3 has a route that directs it to 10.0.0.1 for answers.

If you have a route set in place, say

Destination Mask Gateway
10.0.0.0 255.0.0.0 1.2.3.4
10.0.0.100 255.255.255.255 10.0.0.1

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

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

From my testing results, this isn't the case. The router starts querying for who have 10.0.0.101 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
Robhogg
Member
 
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 10.0.0.0/8 network is not reachable for computer 3. 1.2.3.4 is not in the same network as 192.168.1.100 (unless, of course, the network mask is set to 0.0.0.0). 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
kbp
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
baldy3105
Member
 
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 10.0.0.1 255.255.255.0 on an interface the router implicitly aquires a direct route 10.0.0.0 255.255.255.0 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 10.1.0.0 255.255.255.0 less explicit, 10.0.0.0 255.0.0.0 or default 0.0.0.0 0.0.0.0.

A router should, on being given a packet to route, look for the longest match route. If a packet is destined for 10.1.0.3, 10.0.0.0 255.0.0.0 is a match, but 10.1.0.0 255.255.255.0 will be the preferred route because it is the longest, or most explicit, match. 10.2.0.1 will match 10.0.0.0 255.0.0.0 because its a longer match than 0.0.0.0. 11.0.0.1 does not match anything except 0.0.0.0 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 10.0.0.0 255.0.0.0 1.2.3.4 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 10.0.0.1 255.255.255.0 and 10.0.0.100 255.255.255.0 then they both have a direct route of 10.0.0.0 255.255.255.0. If you ask them to ping 10.0.0.101 the longest match is 10.0.0.0 255.255.255.0 via eth, therefore the CP will ARP for 10.0.0.101.

If you ping 10.2.1.1 the router will match this to 10.0.0.0 255.0.0.0. It will then, if it supports recursive routing, do a route lookup for 1.2.3.4. 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.

Cheers

Pete
 
2 members found this post helpful.
Old 07-15-2011, 04:56 PM   #5
YaMaHaBoB
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 10.0.0.0/8 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.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:52 PM.

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