以下是二线设置代码
说明:Local为内网 wlan1、wlan2为外网
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=wlan2
add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=wlan1
/ ip firewall mangle
add chain=input in-interface=wlan1 action=mark-connection new-connection-mark=wlan1_conn
add chain=input in-interface=wlan2 action=mark-connection new-connection-mark=wlan2_conn
add chain=output connection-mark=wlan1_conn action=mark-routing new-routing-mark=to_wlan1
add chain=output connection-mark=wlan2_conn action=mark-routing new-routing-mark=to_wlan2
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:2/0
action=mark-connection new-connection-mark=wlan1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:2/1
action=mark-connection new-connection-mark=wlan2_conn passthrough=yes
add chain=prerouting connection-mark=wlan1_conn in-interface=Local action=mark-routing new-routing-mark=to_wlan1
add chain=prerouting connection-mark=wlan2_conn in-interface=Local action=mark-routing new-routing-mark=to_wlan2
/ ip route
add dst-address=0.0.0.0/0 gateway=10.111.0.1 routing-mark=to_wlan1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 routing-mark=to_wlan2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.111.0.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 distance=2 check-gateway=ping
/ ip firewall nat
add chain=srcnat out-interface=wlan1 action=masquerade
add chain=srcnat out-interface=wlan2 action=masquerade
PCC双线负载均衡配置脚本
/ip firewall mangle
add action=change-mss chain=forward comment="" disabled=no new-mss=1400 protocol=tcp tcp-flags=syn
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out1 new-connection-mark=pppoe-out1_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out2 new-connection-mark=pppoe-out2_conn passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out1_conn disabled=no new-routing-mark=to_pppoe-out1 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out2_conn disabled=no new-routing-mark=to_pppoe-out2 passthrough=yes
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out1_conn disabled=no in-interface=LAN new-routing-mark=to_pppoe-out1 passthrough=yes
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out2_conn disabled=no in-interface=LAN new-routing-mark=to_pppoe-out2 passthrough=yes
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=pppoe-out1_conn passthrough=yes
per-connection-classifier=both-addresses:2/0
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=pppoe-out2_conn passthrough=yes
per-connection-classifier=both-addresses:2/1
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out1_conn disabled=no in-interface=LAN new-routing-mark=to_pppoe-out1 passthrough=yes
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out2_conn disabled=no in-interface=LAN new-routing-mark=to_pppoe-out2 passthrough=yes
/ip route
add comment=adsl2 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=122.232.29.133 routing-mark=to_pppoe-out2 scope=30 target-scope=10
add comment=adsl1 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=122.232.17.225 routing-mark=to_pppoe-out1 scope=30 target-scope=10
/ip firewall nat
add action=masquerade chain=srcnat comment="" disabled=no out-interface=pppoe-out2
add action=masquerade chain=srcnat comment="" disabled=no out-interface=pppoe-out1
如果你是ADSL动态IP和动态网关,请用动态脚本改变
:global assignaddress
:global newaddress
:global status
:global x
:global i
:set x 2
:for i from=1 to=$x do={
:set status [/interface get [/interface find name=("pppoe-out" . $i)] running]
:if ($status=true) do={
:set newaddress [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
:set newaddress [:pick $newaddress 0 [:find $newaddress "/"]]
:set assignaddress [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
:set assignaddress [:pick $assignaddress 0 [:find $assignaddress "/"]]
:if ($assignaddress != $newaddress) do={
/ip address set [/ip address find comment=("adsl" . $i)] address=$newaddress network=$newaddress broadcast=$newaddress
/ip route set [/ip route find comment=("adsl" . $i)] gateway=$newaddress
}
}
}
如果最下面的链接不能下载请点击微软的网盘链接