ospf入门实验
题目要求
1、使用OSPF实现全网可达
2、R1-3之间R1为DR,没有BDR;
3、R3与R4,R4为DR,没有BDR;
R1
<Huawei>
<Huawei>sys
<Huawei>system-view
[Huawei]sysn r1
[r1]int gi 0/0/0
[r1-GigabitEthernet0/0/0]ip address 100.1.1.1 24
[r1-GigabitEthernet0/0/0]int lo 0
[r1-LoopBack0]ip address 1.1.1.1 24
[r1-LoopBack0]q
[r1]int gi 0/0/0
[r1-GigabitEthernet0/0/0]ospf dr-priority 100 // 修改接口优先级,为0表示不参加DR选举
[r1]ospf 1 router-id 100.0.0.0 // 先是接口优先级大的是DR,优先级一样,router-id越大为DR; 一旦配置选举DR后不会被抢占。
// router-id 一.手工指定最优 二.先选举所有逻辑中IP地址最大的 三.选举所有物理接口IP 地址最大的
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 100.1.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]
[r1]display ospf 1 int gi0/0/0
OSPF Process 1 with Router ID 1.1.1.1
Interfaces
Interface: 100.1.1.1 (GigabitEthernet0/0/0)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 100.1.1.1
Backup Designated Router: 100.1.1.2
Timers:
[r1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 4 Routes : 4
OSPF routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 OSPF 10 1 D 100.1.1.2 GigabitEthernet0/0/0
3.3.3.3/32 OSPF 10 1 D 100.1.1.3 GigabitEthernet0/0/0
4.4.4.4/32 OSPF 10 2 D 100.1.1.3 GigabitEthernet0/0/0
200.1.1.0/24 OSPF 10 2 D 100.1.1.3 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[r1]ping -a 1.1.1.1 4.4.4.4
PING 4.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=254 time=60 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=60 ms
Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=60 ms
--- 4.4.4.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/56/60 ms
R2
<Huawei>sys
[Huawei]sysn r2
[r2]int gi 0/0/0
[r2-GigabitEthernet0/0/0]ip address 100.1.1.2 24
[r2-GigabitEthernet0/0/0]ospf dr-priority 0
[r2-GigabitEthernet0/0/0]int lo 0
[r2-LoopBack0]ip address 2.2.2.2 24
[r2]q
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 100.1.1.0 0.0.0.255
R3
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname r3
[r3]int gi 0/0/0
[r3-GigabitEthernet0/0/0]ip address 100.1.1.3 24
[r3-GigabitEthernet0/0/0]ospf dr-priority 0
[r3-GigabitEthernet0/0/0]int lo 0
[r3-LoopBack0]ip address 3.3.3.3 24
[r3-LoopBack0]int gi 0/0/1
[r3-GigabitEthernet0/0/1]ip address 200.1.1.1 24
[r3-GigabitEthernet0/0/1]ospf dr-priority 0
[r3-GigabitEthernet0/0/1]q
[r3]int gi 0/0/1
[r3-GigabitEthernet0/0/1]ospf dr-priority 100 // 修改优先级
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 100.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]
[r3-ospf-1-area-0.0.0.1]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.1]network 200.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.1]q
R4
<Huawei>
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn r4
[r4]int gi 0/0/0
[r4-GigabitEthernet0/0/0]ip address 200.1.1.2 24
[r4-GigabitEthernet0/0/0]ospf dr-priority 100
[r4-GigabitEthernet0/0/0]int lo 0
[r4-LoopBack0]ip address 4.4.4.4 24
[r4-LoopBack0]q
[r4]ar
[r4]ospf 1 router-id 4.1.1.1
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.1]network 200.1.1.0 0.0.0.255