JohnLyu的blog

橙汁事务所艾欧泽亚分部

0%

OSPF(Open Shortest Path First)

实验记录

网络初始构造

网络初始构造类似上文Enhanced Interior Gateway Routing Protocol, 新增一个交换机

image-20201119131535741

配置ospf

r0:

1
2
3
4
router ospf 100 
network 192.168.1.0 255.255.255.0 area 0
network 192.168.3.0 255.255.255.0 area 0
end

r1:

1
2
3
4
router ospf 100 
network 192.168.4.0 255.255.255.0 area 0
network 192.168.3.0 255.255.255.0 area 0
end

r2:

1
2
3
4
router ospf 100 
network 192.168.2.0 255.255.255.0 area 0
network 192.168.4.0 255.255.255.0 area 0
end

检查路由器状态

r0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.1.0/24 is directly connected, FastEthernet0/0
O 192.168.2.0/24 [110/66] via 192.168.3.2, 00:02:05, Serial2/0
C 192.168.3.0/24 is directly connected, Serial2/0
O 192.168.4.0/24 [110/65] via 192.168.3.2, 00:02:05, Serial2/0

测试ping

pc0 ping pc1

1
2
3
4
5
6
7
8
9
10
11
12
13
C:\>ping 192.168.2.2

Pinging 192.168.2.2 with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time=23ms TTL=125
Reply from 192.168.2.2: bytes=32 time=1ms TTL=125
Reply from 192.168.2.2: bytes=32 time=1ms TTL=125
Reply from 192.168.2.2: bytes=32 time=2ms TTL=125

Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 23ms, Average = 6ms

pc1 ping pc0

1
2
3
4
5
6
7
8
9
10
11
12
13
C:\>ping 192.168.1.2

Pinging 192.168.1.2 with 32 bytes of data:

Reply from 192.168.1.2: bytes=32 time=2ms TTL=125
Reply from 192.168.1.2: bytes=32 time=1ms TTL=125
Reply from 192.168.1.2: bytes=32 time=1ms TTL=125
Reply from 192.168.1.2: bytes=32 time=1ms TTL=125

Ping statistics for 192.168.1.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms