Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1963
  • Last Modified:

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 ?
0
Znasev
Asked:
Znasev
  • 3
  • 2
1 Solution
 
de2ZotjesCommented:
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.
0
 
ZnasevAuthor Commented:
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.
0
 
de2ZotjesCommented:
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
0
 
ZnasevAuthor Commented:
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.
0
 
de2ZotjesCommented:
1 exactly
2 exactly
3 exactly, you will have to filter the packets based on related/established-state, but I suppose you know how to do that.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now