The ****
src-nat
rule will let you translate the source address of the outgoing packet to just any address, even completely unrelated to any subnet used on your router, and remember that as a
reply-dst-address
in the connection context:
[me@MyTik] > ip firewall connection print detail where src-address~":59891"
Flags: E - expected, S - seen-reply, A - assured, C - confirmed, D - dying, F - fasttrack, s - srcnat, d - dstnat
0 SAC Fs protocol=tcp
src-address=192.168.99.242:59891 dst-address=104.40.240.50:443
reply-src-address=104.40.240.50:443 reply-dst-address=192.168.10.88:59891
tcp-state=established timeout=23h58m17s orig-packets=12 orig-bytes=2 390
orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=13 repl-bytes=12 175 repl-fasttrack-packets=9
repl-fasttrack-bytes=10 592 orig-rate=0bps repl-rate=0bps
The only thing you have to ensure is that your ISP would send packets for all these addresses to your device, and it depends on how the connection between you and the ISP looks like. If your router is not a gateway to the subnet you’ve made up in the example but is a member of that subnet, you need to make sure that it would respond to arp requests for all the IP addresses you use as
src-nat to-addresses
, even those not attached to any interface This does not happen automatically by default:
[me@MyTik] > ip firewall nat print where dst-address="193.108.106.40"
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat action=src-nat to-addresses=192.168.10.122 dst-address=193.108.106.40 out-interface=ether1
[me@MyTik] > ip firewall connection print detail where dst-address~"193.108.106.40"
Flags: E - expected, S - seen-reply, A - assured, C - confirmed, D - dying, F - fasttrack, s - srcnat, d - dstnat
0 C s protocol=tcp
src-address=192.168.99.242:59937 dst-address=193.108.106.40:80
reply-src-address=193.108.106.40:80 reply-dst-address=192.168.10.122:59937
tcp-state=syn-sent timeout=1s orig-packets=2 orig-bytes=104
orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=0 repl-bytes=0 repl-fasttrack-packets=0
repl-fasttrack-bytes=0 orig-rate=0bps repl-rate=0bps
To do the trick, you need to change the arp mode of the WAN interface from the default ****
enabled
to
local-proxy-arp
:
[me@MyTik] > /interface ethernet set ether1 arp=local-proxy-arp