|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
全部都是按照下面的步骤做的,做完之后再IP->FIREWALL,NAT选项卡,+号添加chain:srcnat,src.addr:IP地址,ACTION选项卡里为masquerade,但是还是无法通过网关192.168.0.1上网,请问是哪里出错了啊?谢谢
简要安装过程:
1、新建虚拟机 自定义 linux 桥接 磁盘 IDE, 添加五块桥接网卡, 光驱使用ISO镜像就是routeros2.9.6破解版.iso ,启动,安
装完,镜像ISO不要了,启动login admin ,setup a a 192.168.0.1/24 x x 。好了虚拟机好了,以后只需要后台运行
着即可,配置高的机器几乎不占用系统资源。
2、本机IP设为192.168.0.2 后 用 winbox 连接到192.168.0.1 。
new terminal 脚本
/ interface pppoe-client
add name="pppoe-out1" max-mtu=1480 max-mru=1480 interface=ether2 \
user="拨号账号" password="拨号密码" profile=default service-name="" \
ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no \
allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out2" max-mtu=1480 max-mru=1480 interface=ether3 \
user="拨号账号" password="拨号密码" profile=default service-name="" \
ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no \
allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out3" max-mtu=1480 max-mru=1480 interface=ether4 \
user="拨号账号" password="拨号密码" profile=default service-name="" \
ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no \
allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out4" max-mtu=1480 max-mru=1480 interface=ether5 \
user="拨号账号" password="拨号密码" profile=default service-name="" \
ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no \
allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out5" max-mtu=1480 max-mru=1480 interface=ether6 \
user="拨号账号" password="拨号密码" profile=default service-name="" \
ac-name="" add-default-route=no dial-on-demand=no use-peer-dns=no \
allow=pap,chap,mschap1,mschap2 disabled=no
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 \
interface=ether1 comment="added by setup" disabled=no
add address=128.228.188.17/32 network=128.228.188.17 broadcast=128.228.188.17 \
interface=pppoe-out1 comment="1" disabled=no
add address=128.228.191.73/32 network=128.228.191.73 broadcast=128.228.191.73 \
interface=pppoe-out2 comment="2" disabled=no
add address=128.228.190.137/32 network=128.228.190.137 \
broadcast=128.228.190.137 interface=pppoe-out3 comment="3" disabled=no
add address=128.228.189.121/32 network=128.228.189.121 \
broadcast=128.228.189.121 interface=pppoe-out4 comment="4" disabled=no
add address=128.228.192.121/32 network=128.228.192.121 \
broadcast=128.228.192.121 interface=pppoe-out5 comment="5" disabled=no
/ ip firewall mangle
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,0 \
action=mark-connection new-connection-mark=1 passthrough=yes comment="" \
disabled=no
add chain=prerouting in-interface=ether1 connection-mark=1 action=mark-routing \
new-routing-mark=1 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,1 \
action=mark-connection new-connection-mark=2 passthrough=yes comment="" \
disabled=no
add chain=prerouting in-interface=ether1 connection-mark=2 action=mark-routing \
new-routing-mark=2 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,2 \
action=mark-connection new-connection-mark=3 passthrough=yes comment="" \
disabled=no
add chain=prerouting in-interface=ether1 connection-mark=3 action=mark-routing \
new-routing-mark=3 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,3 \
action=mark-connection new-connection-mark=4 passthrough=yes comment="" \
disabled=no
add chain=prerouting in-interface=ether1 connection-mark=4 action=mark-routing \
new-routing-mark=4 passthrough=no comment="" disabled=no
add chain=prerouting in-interface=ether1 connection-state=new nth=4,1,4 \
action=mark-connection new-connection-mark=5 passthrough=yes comment="" \
disabled=no
add chain=prerouting in-interface=ether1 connection-mark=5 action=mark-routing \
new-routing-mark=5 passthrough=no comment="" disabled=no
/ ip firewall nat
add chain=srcnat connection-mark=1 action=src-nat to-addresses=128.228.188.17 \
to-ports=0-65535 comment="1" disabled=no
add chain=srcnat connection-mark=2 action=src-nat to-addresses=128.228.191.73 \
to-ports=0-65535 comment="2" disabled=no
add chain=srcnat connection-mark=3 action=src-nat to-addresses=128.228.190.137 \
to-ports=0-65535 comment="3" disabled=no
add chain=srcnat connection-mark=4 action=src-nat to-addresses=128.228.189.121 \
to-ports=0-65535 comment="4" disabled=no
add chain=srcnat connection-mark=5 action=src-nat to-addresses=128.228.192.121 \
to-ports=0-65535 comment="5" disabled=no
/ ip route
add dst-address=0.0.0.0/0 gateway=128.228.188.17 scope=255 target-scope=10 \
routing-mark=1 comment="1" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.191.73 scope=255 target-scope=10 \
routing-mark=2 comment="2" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.190.137 scope=255 target-scope=10 \
routing-mark=3 comment="3" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.189.121 scope=255 target-scope=10 \
routing-mark=4 comment="4" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.192.121 scope=255 target-scope=10 \
routing-mark=5 comment="5" disabled=no
add dst-address=0.0.0.0/0 gateway=128.228.189.121 scope=255 target-scope=10 \
comment="6" disabled=no
/ ip upnp interfaces
add interface=ether1 type=internal disabled=no
add interface=pppoe-out1 type=external disabled=no
add interface=pppoe-out2 type=external disabled=no
add interface=pppoe-out3 type=external disabled=no
add interface=pppoe-out4 type=external disabled=no
add interface=pppoe-out5 type=external disabled=no
/ ip upnp
set enabled=yes allow-disable-external-interface=yes show-dummy-rule=yes
在system schedule 粘入,设置为20秒自动更新
:local assign-address
:local new-address
:local status
:local x
:set x 5
: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 ([:len $new-address] -3)]
:set assign-address /ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
:set assign-address [:pick $assign-address 0 ([:len $assign-address] -3)]
:if ($assign-address != $new-address) do={ /ip address set [/ip address find comment=$i] address=$new-
address network=$new-address broadcast=$new-address
/ip route set [/ip route find comment=$i] gateway=$new-address
/ip route set [/ip route find comment="6"] gateway=$new-address
/ip fir nat set [/ip fir nat find comment=$i] to-addresses=$new-address
}
}
} |
|