Code: Select all
iptables -t nat -A OUTPUT --dst 192.168.80.1 -j DNAT --to-destination 192.168.84.2
iptables -t nat -A OUTPUT --dst 192.168.80.1 -j DNAT --to-destination 192.168.84.2
/interface bridge
add name=loopback protocol-mode=none
/ip address
add address=127.0.0.2/32 interface=loopback
/interface ipip
add local-address=127.0.0.1 name=ipip-loop1 remote-address=127.0.0.2
add local-address=127.0.0.2 name=ipip-loop2 remote-address=127.0.0.1
/ip route
add distance=1 gateway=ipip-loop1 routing-mark=loophack
add distance=1 dst-address=10.10.10.10/32 gateway=ipip-loop2
/ip dns
set allow-remote-requests=yes servers=208.67.222.222,208.67.220.220
/ip firewall mangle
add action=mark-routing chain=output dst-port=53 new-routing-mark=loophack passthrough=no protocol=udp
add action=mark-routing chain=output dst-port=53 new-routing-mark=loophack passthrough=no protocol=tcp
/ip firewall nat
add action=src-nat chain=srcnat out-interface=ipip-loop1 to-addresses=10.10.10.10
add action=dst-nat chain=dstnat dst-port=53 in-interface=ipip-loop2 protocol=udp to-ports=5353
add action=dst-nat chain=dstnat dst-port=53 in-interface=ipip-loop2 protocol=tcp to-ports=5353
add action=masquerade chain=srcnat out-interface=<WAN>
After reading sindy's Multiple Road Warrior L2TP/IPsec clients behind NAT - solved thread, and after my brain stopped hurting, .........
It works, but now my brain hurts again.
+1, for the same reason, about conditional DNS forwarding.If this was added, I'd also use it for per-domain DNS forwarding in few places, because it would help with at least some shortcomings of current L7 hack (bypassing cache and not working for router itself). But I really hope to live to see proper support for that in RouterOS DNS resolver.
/ip firewall nat
add chain=output dst-address=192.168.80.1 action=dst-nat to-addresses=192.168.84.2
/ip firewall mangle
add chain=postrouting protocol=icmp action=log
22:14:10 firewall,info postrouting: in:(unknown 0) out:internal, proto ICMP (type 8, code 0), 192.168.80.183->192.168.84.2, NAT 192.168.80.183->(192.168.80.1->192.168.84.2), len 56
/ip firewall nat
add chain=output dst-address=1.2.3.4 protocol=tcp dst-port=80,443 action=dst-nat to-addresses=192.168.88.20
19:50:47 system,error,critical login failure for user root from 8.8.8.8 via ssh
input: in:internal out:(unknown 0), src-mac a0:d3:5e:f3:f0:26, proto TCP (SYN), 192.168.80.10:60573->192.168.80.184:22, len 52
input: in:internal out:(unknown 0), src-mac a0:d3:5e:f3:f0:26, proto TCP (ACK), 192.168.80.10:60573->192.168.80.184:22, NAT (192.168.80.10:60573->8.8.8.8:60573)->192.168.80.184:22, len 40
/ip firewall nat
add chain=input protocol=tcp dst-port=22 action=src-nat to-addresses=8.8.8.8
If "help with" is an euphemism for "allow to get rid of", then yes - the sole purpose of the hairpin tunnel was to work around the unavailability of src-nat on input in ROS 6. But unless the contemporary connection tracking can also be set to prefer maximum diversity, in terms that it would try to assign a distinct IP part of reply-dst-address to each connection, the script taking care about incrementing the to-addresses address in the src-nat rule will have to stay.@sindy: I don't want to risk overheating my brain, but wouldn't this also help with your L2TP/IPSec loop?