Link to home
Start Free TrialLog in
Avatar of Znasev
ZnasevFlag for North Macedonia

asked on

Proxy arp not responding

I have a LAN with private IP addresses that I need to route to two ISP's for redundancy and load balancing.


                                                                                      ------x.x.x.34 HOST
                                                                                    /
                                                       /eth1----------SWITCH --- wireless x.x.x.x/27 public addresses (SNAT --to x.x.x.35-x.x.x.62)
 192.168.0.0 LAN ---eth0--linux----|
                                                       \ppp0 ---------ADSL (masquerade with this interface)

For the traffic going through wireless interface, I would like to use a range of ip addresses.

ip forwarding - on
proxy arp for eth1 - on

iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/27 -j SNAT --to x.x.x.35-x.x.x.62
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

If I use MASQUERADE or SNAT to interface's real address, everything is OK, but I can't make eth1 advertise x.x.x.35-x.x.x.62 range for ARP.
If I try to ping from 192.168.0.2 to x.x.x.34, on x.x.x.34 host, I receive ICMP request, but it can't reply because eth1 is not replying for ARP requests for x.x.x.35-62.

Any suggestion ?
Avatar of de2Zotjes
de2Zotjes
Flag of Netherlands image

You need to tell your box to respond to the arp requests (in /proc.., switching on proxy arp) and with which address to respond to the arp-requests:

arp -i eth1 -Ds x.x.x.35 eth1 pub

there is a possibility to supply a network mask, but you could also just stick lines for .35 to .62 in script file.
Avatar of Znasev

ASKER

That's what I am doing, but it is not working.

The script:

#! /bin/bash

#eth0 = 192.168.0.1
#eth1 = x.x.x.60
#eth2 = 10.0.0.1

iptables --flush
iptables -t nat --flush
iptables -t mangle --flush
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/24 -j SNAT --to x.x.x.36-x.x.x.59
arp -i eth1 -Ds x.x.x.36 eth1 pub
arp -i eth1 -Ds x.x.x.37 eth1 pub
arp -i eth1 -Ds x.x.x.38 eth1 pub
arp -i eth1 -Ds x.x.x.39 eth1 pub
arp -i eth1 -Ds x.x.x.40 eth1 pub
arp -i eth1 -Ds x.x.x.41 eth1 pub
arp -i eth1 -Ds x.x.x.42 eth1 pub
arp -i eth1 -Ds x.x.x.43 eth1 pub
arp -i eth1 -Ds x.x.x.44 eth1 pub
arp -i eth1 -Ds x.x.x.45 eth1 pub
arp -i eth1 -Ds x.x.x.46 eth1 pub
arp -i eth1 -Ds x.x.x.47 eth1 pub
arp -i eth1 -Ds x.x.x.48 eth1 pub
arp -i eth1 -Ds x.x.x.49 eth1 pub
arp -i eth1 -Ds x.x.x.50 eth1 pub
arp -i eth1 -Ds x.x.x.51 eth1 pub
arp -i eth1 -Ds x.x.x.52 eth1 pub
arp -i eth1 -Ds x.x.x.53 eth1 pub
arp -i eth1 -Ds x.x.x.54 eth1 pub
arp -i eth1 -Ds x.x.x.55 eth1 pub
arp -i eth1 -Ds x.x.x.56 eth1 pub
arp -i eth1 -Ds x.x.x.57 eth1 pub
arp -i eth1 -Ds x.x.x.58 eth1 pub
arp -i eth1 -Ds x.x.x.59 eth1 pub
echo 1 > /proc/sys/net/ipv4/conf/eth1/proxy_arp
echo 1 > /proc/sys/net/ipv4/ip_forward
# end of script

-------------------------------------------
Now pinging from 192.168.0.2:
ping x.x.x.34
-------------------------------------------

tcpdump on x.x.x.34 host:
tcpdump -i eth0 -nt 'icmp or arp'

listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
IP x.x.x.50 > x.x.x.34: icmp 40: echo request seq 12544
arp who-has x.x.x.50 tell x.x.x.34
arp who-has x.x.x.50 tell x.x.x.34
IP x.x.x.50 > x.x.x.34: icmp 40: echo request seq 12800
arp who-has x.x.x.50 tell x.x.x.34
IP x.x.x.50 > x.x.x.34: icmp 40: echo request seq 13056
IP x.x.x.50 > x.x.x.34: icmp 40: echo request seq 13312
arp who-has x.x.x.50 tell x.x.x.34
arp who-has x.x.x.50 tell x.x.x.34
arp who-has x.x.x.50 tell x.x.x.34

As you can see there is no arp reply.
I am using Julian Atanasov's patches if they are making any difference in replying.
Oops,

Just read up on proxy arp (didn't use it since the 2.0 kernels...) You can't use it for this purpose, you can only use it to reply to arp queries that are directed at other ip-networks. So in this particular case you should just assign extra ip's to your interface:

ip addr add x.x.x.35 dev eth1

That should do the trick :-)
You can switch off proxy arp off course
Avatar of Znasev

ASKER

Ok this is working :-)
Just to make sure that I understand what's going on, please correct me if I am wrong:

1. The packets originating from 192.168.0.0/24 network while passing POSTROUTING chain are SNAT-ed with one address of x.x.x.36-59 range and computer keeps track of SNAT-ed adresses and established connections.
2. When a packet from internet arrives on eth1 with destination x.x.x.36-59 and this packet is a part of  previously established connection with 192.168.0.0/24      host, it will be DNAT-ed to correct address and forwarded to 192.168.0.0 network..
3.When a packet from internet arrives on eth1 with destination x.x.x.36-59 and this packet is not a part of  previously established connection with 192.168.0.0/24 host, it will be destined to a local computer, and filtering this traffic in the INPUT chain would prevent any connection to local computer.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of de2Zotjes
de2Zotjes
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial