I have a problem with the NAT Rules in OpenWrt on Raspberry PI 4.
I want to connect two devices to two Interfaces (USB network adapter) that are in a different IP-range. The first device have the IP-adress 192.168.100.x and the second one have the IP-Adress 192.168.101.x. Now i want to use NAT to translate the packages from 100.x to 101.x and back. See my settings:
Both interfaces are in LAN firewall zone, so, if you didn't change it, the intralan forward is allowed.
Both PCs must either use DHCP to get the settings or, if you use static, to configure the gateway for them as well. That is the IP of the OpenWrt in each network, e.g 192.168.101.1 and 192.168.100.1
The default setting of the firewall that is part of Windows will cause the Windows machine to not answer pings. Also the Windows Firewall can be configured to reject foreign RFC1981 ("private IP") LAN IPs but I don't know if that is the default.
Thats my problem. So how can I use NAT when I have a Device with IP x.x.101.250 to Gateway101 (only the name of the USB-Interface) and want to ping the device with x.x.100.250 to Gateway100 ?
Do you know where can be the problem?
That's not how NAT works. NAT takes the address the packet has come from (e.g. a device within a LAN) and rewrites it so it appears to be coming from a different address (most commonly the WAN gateway), then when the response to that packet comes back it does the opposite.
In your situation it's just simple routing. The fact it doesn't work indicates an issue with your network setup. Something is misconfigured. As a starting point it'd be useful to see the content of /etc/config/network and /etc/config/firewall.
Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
This shouldn't have been possible - since 192.168.100.0/24 and 192.192.101.0/24 networks exist on on the same device - and hence should be a Kernel route. Something's odd here.
I assume the Windows machine does not use the OpenWrt pictured as it's gateway.