nat - How can I get SNAT to work with ARP requests using iptables? -


problem statement
have 2 nodes (n1 , n2) on separate networks. both connect separate interfaces on common node (nc). need ping n1 n2.

reference:
n1: ip address 172.1.1.96/24
n2: ip address 10.1.1.33/24
nc: lan1 10.1.1.1/24
      lan2 172.1.1.1/24

______________________________________________________________
|                                              /          nc         \                                                     |
| n1 <------>| switch1 |<-------> | lan2 <--> lan1 | <-------> | switch2 | <-------> n2 |
| _______________________\___________/__________________________ |

attempts

i've added routing rule n1 send 10.1.1.0/24 packets 172.1.1.1 (nc), , following iptables rule nc:

iptables -t nat -a postrouting -s 172.1.1.96 -o lan1 -j snat --to 10.1.1.79 

i send ping n2 n1. n2 receives ping , sends arp request. arp not answered nc causing n2 not respond ping.

question
how can nc answer arp request?

note

i can not use masquerading. once figure out, start adding more complex translation rules don't think possible using masquerading.

proxy arp solution. setting proxy_arp or proxy_arp_pvlan flag (see serverfault post explanation use), linux respond arp requests n2 in behalf of n1.


Popular posts from this blog