1.配置ip地址包括loopback地址,底下路由器至少有两个用户网段,用于测试汇总
2.进行多区域设计,宣告ospf(完成的标志是各路由器邻接关系形成)
3.在出口设备注入默认路由(完成的标志是每台路由器学习到默认路由)
4.ABR上对用户网段进行汇总,精简核心设备路由表(汇总前核心及出口能看到明细用户路由,汇总后则只看到汇总用户路由)
5.将末梢区域设置为完全stub区域,精简边缘设备路由表(设置前边缘路由器能看到区间路由信息及E2的默认路由,设置后看不到区间路由,默认路由变成IA)
6.修改cost值,实现数据合理分流,来回路径一致(修改前两条线路等价负载均衡,修改后只走主线路,且宿舍1区和宿舍2区的主线路分开)
7.修改接口网络类型为点到点,加快收敛速度(修改前建立邻居后要选举dr,花费40s时间,修改后不用选举dr快速收敛)
8.配置出口NAT
9.配置安全增强策略
9.1 将连接用户的接口配置为被动接口(设置前,用户接口连接路由设备开启ospf可以建立邻居,设置后无法建立)
9.2 开启ospf验证,并采用md5算法对密码进行加密
1、配置IP地址(略)
2、OSPF基础配置,配置完成后,可查看到邻居关系
[AR1]router id 1.1.1.1
[AR1]ospf 1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]net 10.0.0.0 0.255.255.255
[AR2]router id 2.2.2.2
[AR2]ospf 1
[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]network 10.0.0.0 0.255.255.255
[AR3]router id 3.3.3.3
[AR3]ospf 1
[AR3-ospf-1]area 0
[AR3-ospf-1-area-0.0.0.0]network 10.0.0.0 0.255.255.255
[AR4]router id 4.4.4.4
[AR4]ospf 1
[AR4-ospf-1]area 0
[AR4-ospf-1-area-0.0.0.0]network 10.0.0.0 0.255.255.255
[AR4-ospf-1-area-0.0.0.0]area 10
[AR4-ospf-1-area-0.0.0.10]network 11.0.0.0 0.255.255.255
[AR5]router id 5.5.5.5
[AR5]ospf 1
[AR5-ospf-1]area 0
[AR5-ospf-1-area-0.0.0.0]network 10.0.0.0 0.255.255.255
[AR5-ospf-1-area-0.0.0.0]area 20
[AR5-ospf-1-area-0.0.0.10]network 12.0.0.0 0.255.255.255
[AR6]router id 6.6.6.6
[AR6]ospf 1
[AR6-ospf-1]area 10
[AR6-ospf-1-area-0.0.0.10]network 0.0.0.0 0.0.0.0
[AR7]router id 7.7.7.7
[AR7]ospf 1
[AR7-ospf-1]area 20
[AR7-ospf-1-area-0.0.0.10]network 0.0.0.0 0.0.0.0
验证:
查看邻居关系,以下为AR1的输出结果,其他设备略
[AR1]display ospf peer brief
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full
0.0.0.0 GigabitEthernet0/0/2 3.3.3.3 Full
查看路由,以下为AR1的路由表,其他设备略
[AR1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 11 Routes : 18
OSPF routing table status :
Destinations : 11 Routes : 18
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.23.0/24 OSPF 10 2 D 10.10.12.2 GigabitEthernet
0/0/1
OSPF 10 2 D 10.10.13.3 GigabitEthernet
0/0/2
10.10.24.0/24 OSPF 10 2 D 10.10.12.2 GigabitEthernet
0/0/1
…
在边界设备,配置引入缺省路由,可以使所有ospf路由器学习到缺省路由
[AR1-ospf-1]default-route-advertise always
验证(各设备均可看到默认路由)
[AR3]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 26 Routes : 29
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 1 D 10.10.13.1 GigabitEthernet
0/0/2
配置路由汇总,可以精简路由表。路由汇总在ABR上配置,可以精简区间路由,在ASBR上做配置,可以精简引入的外部路由。
[AR4]ospf 1
[AR4-ospf-1]area 10
[AR4-ospf-1-area-0.0.0.10]abr-summary 192.168.0.0 255.255.0.0
验证:
[AR1]dis ip routing-table 192.168.0.1
Routing Table : Public
Summary Count : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.0.0/16 OSPF 10 3 D 10.10.12.2 GigabitEthernet
0/0/1
OSPF 10 3 D 10.10.13.3 GigabitEthernet
0/0/2
将末节区域配置为完全stub区域,可以最大程度的精简路由表,用1条缺省路由代替各种ospf明细路由。
[AR4]ospf 1
[AR4-ospf-1]area 10
[AR4-ospf-1-area-0.0.0.10]stub no-summary
[AR6]ospf 1
[AR6-ospf-1]area 10
[AR6-ospf-1-area-0.0.0.10]stub no-summary
验证:
[AR6]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 1 Routes : 1
OSPF routing table status :
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 OSPF 10 2 D 11.10.46.4 GigabitEthernet
0/0/2
[AR4]int gi0/0/1
[AR4-GigabitEthernet0/0/1]ospf cost 1000
[AR5]int gi0/0/2
[AR5-GigabitEthernet0/0/2]ospf cost 1000
[AR2]int gi0/0/2
[AR2-GigabitEthernet0/0/2]ospf cost 1000
[AR3]int gi0/0/1
[AR3-GigabitEthernet0/0/1]ospf cost 1000
验证:
访问外网的路径,AR4和AR5分别走不同路径
[AR4]dis ip routing-table 8.8.8.8
Route Flags: R - relay, D - download to fib
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 1 D 10.10.24.2 GigabitEthernet
0/0/0
[AR5]dis ip routing-table 8.8.8.8
Route Flags: R - relay, D - download to fib
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 1 D 10.10.35.3 GigabitEthernet
0/0/0
回包路径,给192和172网段走不同路径
[AR1]dis ip routing-table 192.168.0.1
Route Flags: R - relay, D - download to fib
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.0.0/16 OSPF 10 3 D 10.10.12.2 GigabitEthernet
0/0/1
[AR1]dis ip routing-table 172.16.0.1
Route Flags: R - relay, D - download to fib
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
172.16.0.0/16 OSPF 10 3 D 10.10.13.3 GigabitEthernet
0/0/2
以太网接口默认是广播型,需要花40s的时间来选举Dr。
但是如果在一条广播链路上只有两台路由器,就没必要选DR,可以将接口类型修改为点到点,加快收敛速度。
[AR1]int gi0/0/1
[AR1-GigabitEthernet0/0/1]ospf network-type p2p
[AR2]int gi0/0/1
[AR2-GigabitEthernet0/0/1]ospf network-type p2p
验证:
[AR1]display ospf peer | include DR
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 10.10.12.1(GigabitEthernet0/0/1)'s neighbors
DR: None BDR: None
在连接外网的asbr,配置常规的nat和缺省路由。
acl number 2000
rule 5 permit source 192.168.0.0 0.0.255.255
rule 10 permit source 172.16.0.0 0.0.255.255
rule 15 deny
nat address-group 1 64.1.1.2 64.1.1.3
interface GigabitEthernet0/0/0
ip address 64.1.1.1 255.255.255.0
nat outbound 2000 address-group 1
ip route-static 0.0.0.0 0.0.0.0 64.1.1.6
验证:
在ar6上,使用loopback接口地址,访问外网
[AR6]ping -a 192.168.0.1 8.8.8.8
PING 8.8.8.8: 56 data bytes, press CTRL_C to break
Reply from 8.8.8.8: bytes=56 Sequence=1 ttl=252 time=30 ms
Reply from 8.8.8.8: bytes=56 Sequence=2 ttl=252 time=30 ms
Reply from 8.8.8.8: bytes=56 Sequence=3 ttl=252 time=30 ms
Reply from 8.8.8.8: bytes=56 Sequence=4 ttl=252 time=30 ms
Reply from 8.8.8.8: bytes=56 Sequence=5 ttl=252 time=40 ms
— 8.8.8.8 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/32/40 ms
被动接口用于连接终端的接口,当收到hello报文会丢弃,可以提高安全性,避免受到协议攻击。
在连接其他路由器的接口,可以配置邻居验证,输入正确的密码才可以建立邻居
被动接口
[AR6-ospf-1]silent-interface gi0/0/0
邻居验证
[AR4-GigabitEthernet0/0/2]ospf authentication-mode md5 1 zhynet
[AR6-GigabitEthernet0/0/2]ospf authentication-mode md5 1 zhynet
了解更多华为技术,解决工作与学习上的问题,添加QQ号:369621272进入群聊。