Solved

Proxy arp not responding

Posted on 2004-08-26
5
1,895 Views
Last Modified: 2012-05-05
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
Comment
Question by:Znasev
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:de2Zotjes
ID: 11902151
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
 

Author Comment

by:Znasev
ID: 11910690
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
 
LVL 6

Expert Comment

by:de2Zotjes
ID: 11912898
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
 

Author Comment

by:Znasev
ID: 11919791
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
 
LVL 6

Accepted Solution

by:
de2Zotjes earned 500 total points
ID: 11920093
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now