拓扑如下所述:
总部的core有3条链路:
1、wan通过222.222.222.222/24的地址与公网相连网关为222.222.222.221
2、down_to_br通过192.168.33.2/24与分支机构的up_to_core相连
3、co_office接总部办公网,地址为172.16.2.100/24
分支机构也有3条链路:
1、up_to_core通过192.168.33.1/24 与总部的 down_to_br相连
2、br_office接分支机构办公网,地址为172.16.1.99/24
3、pppoe_svr未分配接口IP,下面用户只能通过PPPoE拨号访问
技术实现要求:使用OSPF协议使全网互通,并且实现过程包含包括动态拨号的PPPoE用户
两台设备的接口和IP配置结果如下:
[admin@branch] > ip ad pr
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@branch] >
[admin@core] > ip ad pr
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
[admin@core] >
分支机构OSPF配置:
引用:[admin@branch] > ro os ex
# sep/10/2008 22:54:18 by RouterOS 2.9.27
# software id = PL4E-P00
#
/ 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
[admin@branch] >
总部OSPF配置
引用:[admin@core] > ro os ex
# sep/10/2008 23:10:12 by RouterOS 2.9.27
# software id = PL4E-P00
#
/ 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
[admin@core] >
通过以上配置即可达到技术实现的要求(pppoe配置的部分略,请参考本论坛其他精华贴)
下面,测试并验证配置的结果
1、先检查静态路由
[admin@branch] > ip ro ex
# sep/10/2008 22:45:00 by RouterOS 2.9.27
# software id = PL4E-P00
#
/ ip route
[admin@branch] >
[admin@core] > ip ro ex
# sep/11/2008 01:03:02 by RouterOS 2.9.27
# software id = PL4E-P00
#
/ ip route
add dst-address=0.0.0.0/0 gateway=222.222.222.221 scope=255 target-scope=10 \
comment="" disabled=no
[admin@core] >
通过核对静态路由配置,可以看出除了总部的缺省网关外,两台路由器上没有其它的静态路由配置
2、检查无拨号的动态路由
[admin@branch] > ip ro pr
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
[admin@branch] >
通过显示分支机构的路由表可以看到,它从总部通过OSPF协议学习到了1、3、4、5这4条路由信息,并且由于直连路由级别高,导致3这条路由处于非激活状态,另外需要特别注意的是,它还学到了0.0.0.0/0这条重要的默认路由,并指明了是从up_to_core这个口出去的!
引用:[admin@core] > ip ro pr
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
[admin@core] >
通过显示总部的路由表可以看到,通过OSPF协议,它从分支机构学习到了0、3这两条路由信息
3、拨号以后,检查动态拨号路由在动态路由中的表现
[admin@branch] > ip ro pr
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 <pppoe-123>
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
[admin@branch] >
通过branch的路由表项2可以看到有一个账号为123的PPPoE的用户拨号成功后获得了172.16.51.255/32这个地址
引用:[admin@core] > ip ro pr
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
[admin@core] >
通过core的路由表项2可以看到它学到了PPPoE用户的路由信息。
现在将拨号断开检查路由信息更新的情况
[admin@core] > ip ro pr
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
[admin@core] >
现在,从总部的core中,可以看到,172.16.51.255/32这条路由信息因断开拨号连接自动从新学到的路由表里消失了。