找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2422|回复: 1

[其它] 用routeros虚拟机设置合并宽带,可以拨号但是无法上网

[复制链接]
发表于 2009-9-25 22:57:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
全部都是按照下面的步骤做的,做完之后再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
       }
   }
}
routeros
 楼主| 发表于 2009-9-26 21:16:07 | 显示全部楼层
..................
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-11-25 05:59 , Processed in 0.055320 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表