Router1配置:
Press Enter to Start
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Route1
Route1(config)#interface e0
Route1(config-if)#ip address 192.168.1.2 255.255.255.0
Route1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
Route1(config-if)#interface s0
Route1(config-if)#ip address 192.168.2.1 255.255.255.0
Route1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Serial0, changed state to up
%LINK-3-UPDOWN: Interface Serial0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
Route1(config-if)#en
Route1(config-if)#encapsulation ppp
Route1(config-if)#clock rate 64000
Route1(config-if)#exit
Route1(config)#route ?
rip Routing Information Protocol (RIP)
igrp Interior Gateway Routing Protocol (IGRP)
eigrp Enhanced Interior Gateway Routing Protocol (EIGRP)
ospf Open Shortest Path First (OSPF)
bgp Border Gateway Protocol (BGP)
isis ISO IS-IS
word Route map tag
Route1(config)#route ospf ?
<1-65535> Process ID
Route1(config)#route ospf 1 //启用ospf协议
Route1(config-router)#network 192.168.2.0 0.0.0.255 area 0 //发布邻接网络
Route1(config-router)#network 192.168.1.0 0.0.0.255 area 0 //此处分别为192.168.1.0和192.168.2.0
Route1(config-router)#exit
Route1(config)#exit
Route1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Router2配置:
Press Enter to Start
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Route2
Router2(config)#interface e0
Router2(config-if)#ip address 192.168.3.1 255.255.255.0
Router2(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
Router2(config-if)#interface s1
Router2(config-if)#ip address 192.168.2.2 255.255.255.0
Router2(config-if)#encapsulation ppp
Router2(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Serial1, changed state to up
Router2(config-if)#exit
Router2(config)#exit
Router2#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#route ospf 1 //启用ospf协议
Router2(config-router)#network 192.168.2.0 0.0.0.255 area 0 //发布邻接网络
Router2(config-router)#network 192.168.3.0 0.0.0.255 area 0 //此处分别为192.168.3.0和192.168.2.0
Router2(config-router)#exit
Router2(config)#exit
Router2#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
PC1的配置:
Boson BOSS 5.0
Copyright 1998-2003 Boson Software, Inc.
Use the command help to get started
Press Enter to begin
C:>
C:>winip?
winipcfg
C:>winipcfg中进行配置IP:192.168.1.1 255.255.255.0 网关:192.168.1.2
PC2的配置:
Boson BOSS 5.0
Copyright 1998-2003 Boson Software, Inc.
Use the command help to get started
Press Enter to begin
C:>
C:>winip?
winipcfg
C:>winipcfg中进行配置IP:192.168.3.2 255.255.255.0 网关:192.168.3.1
测试:
Router1#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
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, * - candidate default
U - per-user static route
Gateway of last resort is not set
192.168.1.0/24 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, Ethernet0
192.168.2.0/24 is subnetted, 1 subnets
C 192.168.2.0 is directly connected, Serial0
192.168.3.0/24 is subnetted, 1 subnets
O 192.168.3.0 [110/64] via 192.168.3.1, 00:14:53, Serial0 //ospf学来的路由条目
Router2#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
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, * - candidate default
U - per-user static route
Gateway of last resort is not set
192.168.3.0/24 is subnetted, 1 subnets
C 192.168.3.0 is directly connected, Ethernet0
192.168.2.0/24 is subnetted, 1 subnets
C 192.168.2.0 is directly connected, Serial1
192.168.1.0/24 is subnetted, 1 subnets
O 192.168.1.0 [110/64] via 192.168.2.1, 00:15:33, Serial1 //ospf学来的路由条目
P1PingP2:
C:>ping 192.168.3.2
Pinging 192.168.3.2 with 32 bytes of data:
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Reply from 192.168.3.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.3.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
成功!!