ros软路由ADSL双线+PPPOE服务器设置
- 格式:doc
- 大小:2.38 MB
- 文档页数:63
ros软路由ADSL双线+PPPOE服务器设置详细图文教程
减小字体 增大字体
一、先说下这几天泡论坛发现在自己以前及其错误的地方
登录winbox 初始化ros
以前都是把显示器键盘接到ros上,配置lan网卡地址后再将显示器键盘接到电脑上,把电脑本地连接配ros网段,连接winbox,等测试自动获取ip时又将本地连接设为自动获取。
需要回复ros为初始时,又重复上面的过程
泡坛才知道,winbox可以用ros lan网卡的mac地址登录,不必管本地连接的ip的。
初始化时在winbox里使用new terminal就可以初始化了,初始了后用mac登录winbox就可以配置了。
总结:把ros的电脑先设BIOS设为来电自动开机,忽略一切错误开机,就可以再也不接键盘和显示器了。
二、配置ros 双ADSl负载均衡走的弯路
因为夹杂了pppoe服务,一直配不通,用脚本生成器生成的也不通,看很多教程,互相影响,自己最后也不知道在配什么了。
总结:先一步一步配,看到哪一步不通。
不如
1、先配好lan,看winbox能否登陆winbox
2、配置双线adsl,看2条adsl是否拨号成功,双线adsl脚本配置后,在ip里是不应该出现58类ip的,因为之前不理解自动刷新网关,看到脚本里58类ip,自己的机子里没有,以为不正常,重复添加脚本。(增加pppoe服务后,拨号用户不通,这个后面详解)
3、客户机配置手动ip和dns,看能否上网。
3、增加pppoe服务,导入pppoe账号,可以用脚本生成器生成。
三:配置双线adsl+pppoe服务过程
1、安装ros,这个这里省略。
2、配置lan ip 3、电脑配ip,和ros一个网段,winbox登陆,获取到lan的MAC,把ip换为mac登陆。
方法是ip登陆后点下后面小□(里面有三个...的那个,connect左边那个)在打开的菜单里点mac就可以换了。
4、改网卡名字
我把第一个改为wan1,第二个改为wan2,第三个改为lan。
5、用脚本生成器生成双pppoe负载均衡脚本,如果你后面还要像我一样增加pppoe服务,接着要做一个重要的改动,不然pppoe拨号用户就不通。
秘密花园:将所生成的脚本之中的in-interface=ether1删除或替换成src-address=192.168.0.0/255.255.255.0 后面的IP及掩码为你的局域网的..
这段话后来我有走了湾路,先我不知道是替换生成双线ADSL的脚本,还是增加pppoe服务的脚本,这里老大指的的是替换生成双线ADSL的脚本里的,我错误的设为ros局域网的网段,这个网段要设为你要增加的pppoe服务的网段。
默认脚本生成器产生的网段是:10.10.10.0 如果用默认增加的pppoe脚本,这里你要替换为10.10.10.0/255.255.255.0
6、增加pppoe服务区
7、增加pppoe用户
至此配置成功
配置的脚本:
1、双线adsl负载均衡脚本(红色的:替换你自己的dns、账号、密码,如果默认用脚本生成器生成的pppoe服务网段,10.10.10.0/255.255.255.0就不改了)
导入方法: 登陆winbox,选择new terminal (用了new terminal 我不再喜欢用脚本导入框导入了,因为在new terminal导入出错会有提示,虽看不懂提示什么,但可以看出有出错信息)
在new terminal里右键pass+回车导入
/ip address add address=192.168.0.254/255.255.255.0
interface=lan comment=lan
/ip dns set primary-dns=222.172.200.68
secondary-dns=61.166.150.123 allow-remote-requests=yes
/ip firewall mangle add chain=forward protocol=tcp
tcp-flags=syn action=change-mss new-mss=1440
/interface pppoe-client add name="pppoe-out1"
interface=wan1 user="账号1" password="密码1"
add-default-route=no disabled=no
/interface pppoe-client enable pppoe-out1
/ip address add address=58.58.58.1/32 interface=pppoe-out1 comment="1"
/ip route add gateway=58.58.58.1 routing-mark=1
comment="1"
/ip firewall mangle add chain=prerouting
src-address=10.10.10.0/255.255.255.0
connection-state=new nth=1,1,0 action=mark-connection
new-connection-mark=1 passthrough=yes disabled=no
/ip firewall mangle add chain=prerouting
src-address=10.10.10.0/255.255.255.0 connection-mark=1
action=mark-routing new-routing-mark=1 passthrough=no
disabled=no
/ip firewall nat add chain=srcnat connection-mark=1
action=src-nat to-addresses=58.58.58.1 to-ports=0-65535
comment="1" disabled=no
/interface pppoe-client add name="pppoe-out2"
interface=wan2 user="账号2" password="密码2"
add-default-route=no disabled=no
/interface pppoe-client enable pppoe-out2
/ip address add address=58.58.58.2/32
interface=pppoe-out2 comment="2"
/ip route add gateway=58.58.58.2 routing-mark=2
comment="2" /ip firewall mangle add chain=prerouting
src-address=10.10.10.0/255.255.255.0
connection-state=new nth=1,1,1 action=mark-connection
new-connection-mark=2 passthrough=yes disabled=no
/ip firewall mangle add chain=prerouting
src-address=10.10.10.0/255.255.255.0 connection-mark=2
action=mark-routing new-routing-mark=2 passthrough=no
disabled=no
/ip firewall nat add chain=srcnat connection-mark=2
action=src-nat to-addresses=58.58.58.2 to-ports=0-65535
comment="2" disabled=no
2、刷新网关脚本,方法是:winbox中,增加到任务里,winbox生成代码旁有提示
:local assign-address
:local new-address
:local status
:local x
:set x 0
: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 fir nat set [/ip fir nat find comment=$i]
to-addresses=$new-address
/ip route set [/ip route find comment=$i]
gateway=$new-address
}
}
}
3、增加pppoe服务(在new terminal里右键pass+回车导入)注意这个网段就是上面导入双线账号中提到的局域网网段
/ ip pool add name=PPPoE_Pool
ranges=10.10.10.2-10.10.10.254
/ interface pppoe-server server add
service-name=PPPoE_Server interface=lan
one-session-per-host=yes disabled=no
/ ppp profile add name="PPPoE_Profile"
local-address=10.10.10.1 remote-address=PPPoE_Pool
use-compression=yes use-vj-compression=yes
use-encryption=yes change-tcp-mss=no only-one=yes
rate-limit=800000/1200000
dns-server=222.172.200.68,61.166.150.123