I am wondering what/if there is any configuration that enables arp replies.
I have an Ubuntu machine with two interfaces - one is ethernet to a non-public LAN, the other is Wifi which connects to the public internet. I need internet access on the private LAN for one computer temporarily, so I set an SNAT so that the address on the private LAN is mapped to the WiFi network LAN.
EDIT: I failed to mention that I also have a DNAT set to translate the address back.
Sending a ping outbounds to 220.127.116.11 hits, but on return my WiFi router doesn't know "who has" this natted address (192.168.7.33) so it sends an arp request.
sudo arp -v -i wlp1s0 -s 192.168.7.33 84:7b:eb:35:a4:e0, where the hw addr is the hw addr associated with the ethernet link(I also ran the same command followed by 'pub' and it still didn't send). Here it is now in my arp table...:
Address HWtype HWaddress Flags Mask Iface 192.168.7.33 ether 84:7b:eb:35:a4:e0 CM wlp1s0
However, the Ubuntu box still never replies to arps -
19:26:59.542278 IP 192.168.7.33 > google-public-dns-a.google.com: 19:27:51.477054 IP 192.168.7.33 > 18.104.22.168: ICMP echo request, id 3312, seq 2692, length 64 19:27:51.493773 ARP, Request who-has 192.168.7.33 tell 192.168.7.254, length 46
The first message is the ping on the way to google, the second is the router looking for 192.168.7.33.
Referencing this post, Linux does not reply to ARP request messages if requested IP address is associated with another (disabled) interface, I checked my kernel's Ip routing tables:
sudo ip route show table local broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1 local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1 local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1 broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1 broadcast 192.168.3.0 dev enp0s31f6 proto kernel scope link src 192.168.3.12 local 192.168.3.12 dev enp0s31f6 proto kernel scope host src 192.168.3.12 broadcast 192.168.3.255 dev enp0s31f6 proto kernel scope link src 192.168.3.12 broadcast 192.168.7.0 dev wlp1s0 proto kernel scope link src 192.168.7.117 local 192.168.7.117 dev wlp1s0 proto kernel scope host src 192.168.7.117 broadcast 192.168.7.255 dev wlp1s0 proto kernel scope link src 192.168.7.117
In this question, the user had a route set for reaching the address(unlike my NAT), so I went ahead and added a route as well, and it still did not ARP:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.7.254 0.0.0.0 UG 600 0 0 wlp1s0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlp1s0 192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s31f6 192.168.7.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp1s0 192.168.7.33 192.168.3.10 255.255.255.255 UGH 0 0 0 enp0s31f6
Is there a setting on Ubuntu that I can change so that my machine will reply to ARP requests? If not, where is the next place to look to see why we're not responding?
EDIT 2: Here is how I set up the NAT:
sudo iptables -t nat -A POSTROUTING -s 192.168.3.10 -j SNAT --to-source 192.168.7.33 sudo iptables -t nat -A PREROUTING -d 192.168.7.33 -j DNAT --to-dest 192.168.3.10
EDIT 3: Changing to masquerading from DNAT/SNAT worked, and is far easier/more scalable.