Mikrotik通过vpn从一个界面路由互联网流量


1

下面是我目前mikrotik hAP lite的配置。如您所见,配置非常基本。我的网络中有另一台路由器(192.168.178.1)执行DHCP并提供互联网连接。端口ether1是此路由器的上行链路。

连接到ether2,ether3和wlan的所有设备都应该在网络中,就好像它们只是通过普通交换机连接一样。

这可行,但配置可能不是最佳选择。如果我能做得更好,请告知。

ether4上的设备也应该在网络中可用,并且还应该能够正常访问网络上的所有其他设备,但是当在ether4连接的设备想要访问互联网时(=即向DNS请求或发送流量)通过默认网关192.168.178.1),应该重新路由此流量,并通过配置的VPN发送。VPN的默认网关是动态分配的(其l2tpclient接口名为my-vpn),目前具有ip 10.9.9.1。

你可能会告诉我,我尝试过使用防火墙mangle规则,但是没有用。

我需要删除/更改/添加什么才能使其工作?

干杯,

塞巴斯蒂安

# jul/02/2017 19:49:03 by RouterOS 6.39.2
/interface bridge
add admin-mac=AA:BB:CC:AA:BB:CC auto-mac=no comment=defconf fast-forward=no \
    name=bridge
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n country=germany disabled=no \
    frequency=auto mode=ap-bridge ssid=test wireless-protocol=802.11
/interface ethernet
set [ find default-name=ether2 ] master-port=ether1
set [ find default-name=ether3 ] master-port=ether1
/interface l2tp-client
add connect-to=some.vpn.com disabled=no name=my-vpn password=\
    test user=test
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa2-psk eap-methods="" \
    group-ciphers=tkip,aes-ccm mode=dynamic-keys unicast-ciphers=tkip,aes-ccm \
    wpa-pre-shared-key=test wpa2-pre-shared-key=test
/interface bridge port
add bridge=bridge interface=ether1
add bridge=bridge interface=wlan1
add bridge=bridge interface=ether4
/ip dhcp-client
add comment=defconf dhcp-options=hostname,clientid disabled=no interface=\
    bridge
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 name=router
/ip firewall filter
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
    connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related" \
    connection-state=established,related
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
# in/out-interface matcher not possible when interface (ether1) is slave - use master instead (bridge)
add action=drop chain=forward comment=\
    "defconf:  drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface=ether1
/ip firewall mangle
add action=route chain=prerouting dst-address=192.168.178.1 log=yes \
    log-prefix=test passthrough=yes route-dst=10.9.9.1
/system clock
set time-zone-name=Europe/Berlin

1
很少有Mikrotik用户在这里; 最好的答案机会是forum.mikrotik.com
— Jeroen Wiert Pluimers

好想法。我与他们交叉
— Sebastian PR Gingter

你有没有得到这个工作?
— Jeroen Wiert Pluimers
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.