Forcing destination MAC addresses / overriding ARP behavior for non-local subnets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to simulate some strange behavior on Linux for testing.

Machine A and machine B are on different subnets. On A, the gateway to B's
subnet is is through gateway G.  So, if I send a packet on A to B, then on
the A<->G link, the packets have a destination MAC address of Ethernet(G).

I would like to force this destination MAC address to something other than
G's MAC address.

Concrete example:  Machine A's address is 10.3.3.54, machine B's address
is 10.2.2.32.  A has a route entry specifying that the 10.2/16 network is
reachable through Gateway G, at 10.3.3.40.  I want to change the
destination MAC address used for packets sent from A to B.

I tried using the 'arp' utility (this is on a Redhat 8 box):
MachineA # arp -s 10.2.2.41 a1:a1:a1:a1:a1:a1
SIOCSARP: Network is unreachable

I tried using 'ip neigh add', which _did_ create a permanent arp entry to
be created.  But, pinging 10.2.2.41 shows that the "a1:a1:a1:a1:a1:a1" MAC
address is not being used.


So is this possible?  If so, how?


The context here:  I'm testing a transparent proxy setup.  When the tproxy
communicates with a server, the tproxy NAT's its IP addresses to match the
client, but leaves its Ethernet addresses alone.  But - when the tests run
against a Celera, it replies back to the proxied, non-local IP address
with the MAC address of the tproxy, and _not_ of the proper gateway.
This revealed a bug in the tproxy code.  But I'd like to recreate this
scenario, if possible, and without the Celera.


Thanks,
Al




-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux