1

For a LAN, instead of a switch, I have built a topology where each machine is connected to a router. Each host is assigned an IP address from 10/8. Here are the interface details:

http://i45.tinypic.com/2vuc0f5.png

Lets say I ping 10.16.0.3 from this host. The routing table of 10.16.0.2 has been configured to use the router (10.16.0.1) as the default gateway. But since the destination IP address (10.16.0.3) is in the same subnet it sends out an ARP broadcast. I want to disable this behavior of sending an ARP broadcast and instead force it to use the routing table. How do I accomplish this?

1
  • Why are you changing ARP's behavior? How is this useful? Jun 18, 2012 at 4:07

1 Answer 1

3

There are two ways to achieve this. The first is very abnormal and likely to cause weirdness, so the second is better.

Method 1 (NOT recommended)

The typical routing table looks something like this:

% ip route
10.23.11.0/24 dev wlan0  proto kernel  scope link  src 10.23.11.209
default via 10.23.11.1 dev wlan0  proto static 

Which tells the kernel that destinations in 10.23.11.0/24 are directly connected to wlan0, and everything else must go via the router at 10.23.11.1. It's this first route which tells the kernel to do an ARP request and send the packet directly. If you remove it then everything should go via the router. This route is configured by default though, so you'll need to explicitly remove it somewhere. Your eventual routing table should look something like this:

% ip route
default via 10.23.11.1 dev wlan0  proto static 

Method 2 (recommended)

The better method is to place each machine on its own subnet, so that each subnet is an Ethernet domain (as it usually should be). You would do this by allocating each machine a /30 subnet, with the router taking one of those IPs. Your network would look something like this:

(machine1) 10.0.0.2/30   <------->  10.0.0.1/30 (router) 10.0.0.5/30  <-------->  10.0.0.6/30 (machine2)
5
  • +1 on this - there's no good reason to put all of these hosts onto a single router with overlapping subnets. Use /30's or set up bridging.
    – rnxrx
    Jun 18, 2012 at 1:08
  • @mgorven: I had removed the first route from the kernel routing table but the host machine still sends a broadcast.
    – Bruce
    Jun 18, 2012 at 1:16
  • @Bruce As I said, it's likely to cause weirdness. Use the second method.
    – mgorven
    Jun 18, 2012 at 1:26
  • 2
    I would not even mention option 1. RFC-792: If G2 and the host identified by the internet source address of the datagram are on the same network, a redirect message is sent to the host. The redirect message advises the host to send its traffic for network X directly to gateway G2 as this is a shorter path to the destination.
    – phemmer
    Jun 18, 2012 at 1:30
  • @Patrick That's specifically about to ICMP redirects, so I don't see why it's directly relevant?
    – mgorven
    Jun 18, 2012 at 2:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .