Aby se NAT používal jen pro připojení do internetu (a například VPN provoz byl routovaný napřímo), je potřeba u pravidla typu srcnat
s akci masquerade
mít nastaveno Out. Interface na rozhraní, které je připojením do internetu (typicky ether1-gateway
).
/ip firewall layer7-protocol add name=uam-zone regexp=corp.uam.im /ip firewall mangle add chain=prerouting dst-address=<Mikrotik IP> layer7-protocol=uam-zone action=mark-connection new-connection-mark=corp.uam.im-forward protocol=tcp dst-port=53 /ip firewall mangle add chain=prerouting dst-address=<Mikrotik IP> layer7-protocol=uam-zone action=mark-connection new-connection-mark=corp.uam.im-forward protocol=udp dst-port=53 /ip firewall nat add action=dst-nat chain=dstnat connection-mark=corp.uam.im-forward to-addresses=172.17.1.1 commnet="DNS Forward of corp.uam.im" /ip firewall nat add action=masquerade chain=srcnat connection-mark=corp.uam.im-forward comment="DNS Forward of corp.uam.im"
(ověřeno na 6.41)
pomocí pravidel ve firewallu
/ip firewall layer7-protocol add name=uam-zone regexp=corp.uam.im /ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-address=10.10.1.254 dst-port=53 layer7-protocol=uam-zone protocol=udp to-addresses=172.17.1.1 to-ports=53 /ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-address=10.10.1.254 dst-port=53 layer7-protocol=uam-zone protocol=tcp to-addresses=172.17.1.1 to-ports=53
kde
corp.uam.im | přesměrovávaná DNS zóna |
10.10.1.254 | IP adresa mikrotiku, který slouží jako DNS server |
172.17.1.1 | IP adresa DNS serveru pro danou zónu |
Zkusit podle http://forum.mikrotik.com/viewtopic.php?f=2&t=36595 (neotestováno)
exportovaný klíč z cacert.org upravit tak, jak očekává openvpn (pro klienta)
openssl pkcs12 -in vladacacert.p12 -clcerts -out client-cacert.pem -nodes openssl pkcs12 -in vladacacert.p12 -nokeys -cacerts -out root.crt
/certificate create-certificate-request
I've struggled for a few hours to figure out why my OpenVPN client (using RB750G with RouterOS 4.3) didn't want to route correctly. It connected fine to the Windows OVPN server, applied the routing table entries pushed from the server, but the routing table entries remained „unreachable“. Here's my config:
/interface ovpn-client> print Flags: X - disabled, R - running 0 name="ovpn-client" mac-address=00:00:00:00:00:00 max-mtu=1400 connect-to=10.11.12.13 port=1194 mode=ethernet user="username" password="" profile=ovpn-encryption certificate=mycert auth=none cipher=none add-default-route=no /interface ovpn-client> /ip route print detail ... 11 DC dst-address=192.168.1.0/24 pref-src=192.168.1.136 gateway=ovpn-client gateway-status=ovpn-client unreachable distance=0 scope=255
Eventually I managed to solve it, by simply specifying a non 00:00:00:00:00:00 MAC address! eg:
/interface ovpn-client> print Flags: X - disabled, R - running 0 name="ovpn-client" mac-address=00:FF:96:21:DF:D4 max-mtu=1400 connect-to=10.11.12.13 port=1194 mode=ethernet user="username" password="" profile=ovpn-encryption certificate=mycert auth=none cipher=none add-default-route=no