您好,欢迎来到五一七教育网。
搜索
您的当前位置:首页linux单网卡多拨Adsl,ROS单线多拨pppoe

linux单网卡多拨Adsl,ROS单线多拨pppoe

来源:五一七教育网

/ ip add add interface=ether1

address=192.168.0.254/255.255.255.0

#设置共享上网

/ ip firewall nat add action=masquerade chain=srcnat

src-address=192.168.0.0/255.255.255.0

#设置ADSL拔号

/ interface pppoe-client add name="pppoe-out1" interface=ether2

user="wwwszwblmcom@163.gd" password="88888888"

add-default-route=no disabled=no

/ interface pppoe-client enable pppoe-out1

/ interface pppoe-client add name="pppoe-out2" interface=ether3

user="wwwszwblmcom@163.gd" password="88888888"

add-default-route=no disabled=no

/ interface pppoe-client enable pppoe-out2

/ interface pppoe-client add name="pppoe-out2" interface=ether4

user="wwwszwblmcom@163.gd" password="88888888"

add-default-route=no disabled=no

/ interface pppoe-client enable pppoe-out3

#设置ADSL虚拟IP

/ ip address add address=58.58.58.51/32 interface=pppoe-out1

comment="adsl1"

/ ip address add address=58.58.58.52/32 interface=pppoe-out2

comment="adsl2"

/ ip address add address=58.58.58.53/32 interface=pppoe-out3

comment="adsl3"

#设置分流上网

/ ip firewall mangle add chain=prerouting

src-address=192.168.0.1-192.168.0.20 action=mark-routing

new-routing-mark=adsl1 comment=adsl1

/ ip firewall mangle add chain=prerouting

src-address=192.168.0.21-192.168.0.30 action=mark-routing

new-routing-mark=adsl2 comment=adsl2

/ ip firewall mangle add chain=prerouting

src-address=192.168.0.31-192.168.0.40 action=mark-routing

new-routing-mark=adsl3 comment=adsl3

#设置路由表

/ ip route add gateway=58.58.58.51 routing-mark=adsl1

comment=adsl1

/ ip route add gateway=58.58.58.52 routing-mark=adsl2

comment=adsl2

/ ip route add gateway=58.58.58.53 routing-mark=adsl3

comment=adsl3

#设置脚本

:local assign-address

:local new-address

:local status

:local x

:set x 3

:for i from=1 to=$x do={

:set status [/interface get [/interface find name=("pppoe-out" . $i)] running]:if ($status=true) do={

:set new-address [/ip address get [/ip address find dynamic=yes

interface=("pppoe-out" . $i)] address]

:set new-address [:pick $new-address 0 [:find $new-address

"/"]]

:set assign-address [/ip address get [/ip address find dynamic=no

interface=("pppoe-out" . $i)] address]

:set assign-address [:pick $assign-address 0 [:find $assign-address

"/"]]

:if ($assign-address != $new-address) do={

/ip address set [/ip address find comment=("adsl" . $i)]

address=$new-address network=$new-address

broadcast=$new-address

/ip route set [/ip route find comment=("adsl" . $i)]

gateway=$new-address

}

}

}

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 517ttc.cn 版权所有 赣ICP备2024042791号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务