Re: Static bidirectional static NAT for duplicate IP devices using iptables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 16, 2025 at 4:40 AM Adam Nielsen <a.nielsen@xxxxxxxxxxx> wrote:
>
> > Summary: I am trying to access two devices with the same IP address
> > connected locally to a Linux computer, each resides in its own VLAN.
> >
> > I made yet another progress, I use arptables to mangle the ARP request
> > of the host side, but I am still missing ARP response to the device.
>
> Isn't arptables the wrong approach here?  If you're using NAT then by
> definition you're mapping IPs to the target subnet, so then there
> should be no need to mess with ARP as the packets leaving the machine
> are already on the right IP for the subnet?
>
> I am by no means an expert but I would've thought that all you're
> trying to do is to convert a 192.x address into the same target IP, and
> just control which interface the packet goes out on based on whatever
> the original IP address was.
>
> Is ARP mangling needed at all for this?

Hello Adam,

What I am looking for is a static NAT to have 1:1 replacement of
addresses from one subnet to another subnet.
For example having 192.168.0.X <-> 10.0.0.X in both directions, so
that 192.168.0.1 == 10.0.0.1, 192.168.0.2 == 10.0.0.2 and so on.
The NAT is in reverse so that it does not NAT incoming but outgoing
communications.
And to make it more difficult, two interfaces share the same
destination address, so that we need to assign them with different
virtual addresses.
In my example I proposed two conversions: 192.168.110.X <-> 10.0.0.X
and 192.168.168.111 <-> 10.0.0.X.
The 10.0.0.X is the device network which cannot be modified.

Do you know of a NAT configuration that can digest this?
For now the only solution I could come up with is filter hooks + arptables.

Thanks,
Alon





[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux