Sample Header Ad - 728x90

How to add arp entry for an entire subnet (/16)?

3 votes
2 answers
2544 views
I would like to add ARP entry for an entire subnet (10.50.0.0/16). I tried : arp -v -i p4p1 -s 10.50.0.0 MAC_OF_P4P2 netmask 255.255.0.0 pub But the command returns: arp: SIOCSARP() SIOCSARP: Invalid argument No problem if I add one by one: arp -v -i p4p1 -s 10.50.0.1 MAC_OF_P4P2 Is there any way to do what I want ? Something like: arp -v -i p4p1 -s 10.50.0.0/16 MAC_OF_P4P2 # **Story:** I have 3 interfaces: eth0, p4p1 and p4p2. p2p1 and p2p2 are connected through a device but let's say like a wire. We have multiple servers with A.B.x.x in the network that is connected to Eth0. ### From the system, I would like to access to A.B.x.x: 1. Through Eth0 directly: ping A.B.X.X **no problem**, it does automatically enter image description here 2. Through p2p1 -> external device/wire -> p2p2 and then redirect to Eth0 : ping 10.50.X.X enter image description here In that case, I need to create virtual IPs 10.50.0.0/16 that will be same as A.B.0.0/16 but through the p4p* interfaces. Packets need to keep 10.50.x.x as IP source/destination, only when it reaches eth0, the IP will be translated to A.B.X.X. Let's do it step by step. 1. I route 10.50.0.0/16 to my interface p4p1: ip route add 10.50.0.0/16 dev p2p1. ## => p4p1 doesn't know Who has 10.50.0.152? Tell 10.0.0.1 ### I need to set an ARP entry to link 10.50.0.0/16 to p4p2.
Asked by 無名前 (729 rep)
Feb 20, 2018, 03:38 AM
Last activity: Oct 31, 2021, 06:07 AM