Enable Proxy ARP for Public IP Addresses

From WiDirect
Jump to: navigation, search

Proxy ARP is a way of giving a user a public IP address on the same subnet as the WiDirect or WiClient. To enable the setting you will need to SSH to the WiDirect and run these commands:

su -
emacs /etc/sysctl.conf

Add the following two lines to the file:

net.ipv4.conf.eth1.proxy_arp = 1
net.ipv4.conf.eth0.proxy_arp = 1

The next step will require the MAC address of eth0. You can find the MAC address of eth0 by running the ifconfig command. Run these commands to create a script to broadcast the MAC and IP combination:

touch /root/arpAdd.sh
chmod +x /root/arpAdd.sh
emacs /root/arpAdd.sh

The contents of the file should look like this:

#!/bin/sh
/sbin/arp -i eth0 -s 74.103.39.7 00:0D:B9:1B:E4:88 pub

Save and exit by pressing control-x, control-c. The above command assumes the new public IP is 74.103.39.7, and the MAC address is 00:0D:B9:1B:E4:88. You will need to schedule the script to run at intervals by running the crontab command:

crontab -e

The contents of the file should look like this:

*/2 * * * * /root/arpAdd.sh > /dev/null 2>&1

To start inserting text in the editor press the i key first. To exit press escape followed by ":wq" keys. Then press enter. You will also need to create a route for the IP to tell the WiDirect that the IP is behind the eth1 interface. Edit the route table by running this command:

emacs /etc/sysconfig/network-scripts/route-eth1

Add a line that indicates the IP address is behind the eth1 interface:

74.103.39.7 dev eth1

After editing apply the changes with these two commands:

service network restart
sysctl -p

The IP address should then be ready to use. The end-user can put the IP on their device, and use the WiDirect's public IP as their default gateway and DNS server.