|
马上注册成为ROSABC会员,随时发帖回复。
您需要 登录 才可以下载或查看,没有账号?会员注册
x
RouterOS ROS软路由的官方网站的教程关于OSPF+PPPoE的设置部分是有些遗漏的地方,下面写出比较完整的教程、设置以及实验步骤:
网络结构如下:
总公司的核心路由器拥有3个线路:
1、wan的地址是222.222.222.222/24,公网网关是222.222.222.221。
2、另一外线IP地址是192.168.33.2/24与分公司的up线路相连。
3、co_office接总部办公网,IP地址为172.16.2.100/24。
分公司也有3个线路:
1、IP地址是192.168.33.1/24 的接口与总公司的down相连
2、br_office接分公司局域网,IP地址为172.16.1.99/24。
3、pppoe_svr未设置接口IP,用户仅能通过PPPoE协议拨号访问接入。
网络要求是这样的:设置动态路由协议OSPF使网络全通,这里也包括PPPoE动态拨号用户。
两台ROS路由器的接口和IP地址设置如下:[admin@branch] > ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 192.168.33.1/24 192.168.33.0 192.168.33.255 up_to_core
1 172.16.1.99/24 172.16.1.0 172.16.1.255 br_office
[admin@core] > ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 192.168.33.2/24 192.168.33.0 192.168.33.255 down_to_br
1 172.16.2.100/24 172.16.2.0 172.16.2.255 co_office
2 222.222.222.222/24 222.222.222.0 222.222.222.255 wan
分公司的ROS路由器的动态路由协议OSPF的配置: [admin@branch] > routing ospf export
/ routing ospf
set router-id=1.1.1.1 distribute-default=never redistribute-connected=as-type-1 redistribute-static=as-type-1
redistribute-rip=no redistribute-bgp=no metric-default=1 metric-connected=20 metric-static=20 metric-rip=20
metric-bgp=20
/ routing ospf area
set backbone area-id=0.0.0.0 type=default translator-role=translate-candidate authentication=none prefix-list-import=""
prefix-list-export="" disabled=no
/ routing ospf interface
set FIXME interface=up_to_core cost=10 priority=1 authentication-key="" network-type=broadcast retransmit-interval=5s
transmit-delay=1s hello-interval=10s dead-interval=40s
/ routing ospf network
add network=192.168.33.0/24 area=backbone disabled=no
总公司ROS软路由的OSPF配置如下:[admin@core] > routing ospf export
/ routing ospf
set router-id=2.2.2.2 distribute-default=always-as-type-1
redistribute-connected=as-type-1 redistribute-static=as-type-1
redistribute-rip=no redistribute-bgp=no metric-default=1
metric-connected=20 metric-static=20 metric-rip=20 metric-bgp=20
/ routing ospf area
set backbone area-id=0.0.0.0 type=default translator-role=translate-candidate
authentication=none prefix-list-import="" prefix-list-export=""
disabled=no
/ routing ospf interface
set FIXME interface=down_to_br cost=10 priority=1 authentication-key=""
network-type=broadcast retransmit-interval=5s transmit-delay=1s
hello-interval=10s dead-interval=40s
/ routing ospf network
add network=192.168.33.0/24 area=backbone disabled=no
经过以上面的设置即可达到网络需求(pppoe设置省略,请阅读本店相关文章)。
接着,检验一下网络是否达到目的。
1、检验RouteROS软路由静态路由 :[admin@branch] > ip route export
/ ip route
[admin@branch] >
[admin@core] > ip route export
/ ip route
add dst-address=0.0.0.0/0 gateway=222.222.222.221 scope=255 target-scope=10
comment="" disabled=no
经过检验静态路由设置,明显地,除了总公司ROS软路由的缺省网关外,2台ROS软路由器上无其他静态路由设置。
2、检验RouteROS软路由动态路由:[admin@branch] > ip routing print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
# DST-ADDRESS PREF-SRC G GATEWAY DISTANCE INTERFACE
0 ADC 172.16.1.0/24 172.16.1.99 br_office
1 ADo 172.16.2.0/24 r 192.168.33.2 up_to_core
2 ADC 192.168.33.0/24 192.168.33.1 up_to_core
3 Do 192.168.33.0/24
4 ADo 222.222.222.0/24 r 192.168.33.2 up_to_core
5 ADo 0.0.0.0/0 r 192.168.33.2 up_to_core
经过print分公司ROS软路由器的路由表,它从总公司的ROS通过OSPF协议动态学习到4条路由信息,因为直连路由级别最高,所以3条路由记录是非激活状态。还有一点需要注意,分公司ROS软路由器还学到了0.0.0.0/0默认路由,显示是从up口出去.[admin@core] > ip ro print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
# DST-ADDRESS PREF-SRC G GATEWAY DISTANCE INTERFACE
0 ADo 172.16.1.0/24 r 192.168.33.1 down_to_br
1 ADC 172.16.2.0/24 172.16.2.100 co_office
2 ADC 192.168.33.0/24 192.168.33.2 down_to_br
3 Do 192.168.33.0/24
4 ADC 222.222.222.0/24 222.222.222.222 wan
5 A S 0.0.0.0/0 r 222.222.222.221 wan
经过显示总公司的ROS软路由器路由表可见,通过OSPF协议,总公司的ROS软路由器从分公司学习到了2条路由信息。
3、拨号以后,测试动态路由中的表现。[admin@branch] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
# DST-ADDRESS PREF-SRC G GATEWAY DISTANCE INTERFACE
0 ADC 172.16.1.0/24 172.16.1.99 br_office
1 ADo 172.16.2.0/24 r 192.168.33.2 up_to_core
2 ADC 172.16.51.255/32 1.1.1.1
3 ADC 192.168.33.0/24 192.168.33.1 up_to_core
4 Do 192.168.33.0/24
5 ADo 222.222.222.0/24 r 192.168.33.2 up_to_core
6 ADo 0.0.0.0/0 r 192.168.33.2 up_to_core
分公司的ROS软路由器的路由表项2可见:PPPoE账号123用户成功拨号获得172.16.51.255/32这个IP地址:[admin@core] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
# DST-ADDRESS PREF-SRC G GATEWAY DISTANCE INTERFACE
0 ADo 172.16.1.0/24 r 192.168.33.1 down_to_br
1 ADC 172.16.2.0/24 172.16.2.100 co_office
2 ADo 172.16.51.255/32 r 192.168.33.1 down_to_br
3 ADC 192.168.33.0/24 192.168.33.2 down_to_br
4 Do 192.168.33.0/24
5 ADC 222.222.222.0/24 222.222.222.222 wan
6 A S 0.0.0.0/0 r 222.222.222.221 wan
总公司的ROS软路由器路由表项2可见学习获得了PPPoE用户的路由信息。
这时,将拨号断开再检验路由信息有没有更新:[admin@core] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
# DST-ADDRESS PREF-SRC G GATEWAY DISTANCE INTERFACE
0 ADo 172.16.1.0/24 r 192.168.33.1 down_to_br
1 ADC 172.16.2.0/24 172.16.2.100 co_office
2 ADC 192.168.33.0/24 192.168.33.2 down_to_br
3 Do 192.168.33.0/24
4 ADC 222.222.222.0/24 222.222.222.222 wan
5 A S 0.0.0.0/0 r 222.222.222.221 wan
这时,在总公司的ROS软路由器见到172.16.51.255/32路由信息消失了。
|
|