设备:神州数码 DCR-2655
环境:纯内网
基本拓扑图:
第一步:配置物理端口的网关IP地址
RT-1_config#interface gigaEthernet 0/3
RT-1_config_g0/3#ip address 192.168.1.1 255.255.255.0
RT-1_config#interface gigaEthernet 0/6
RT-1_config_g0/6#ip address 192.168.10.1 255.255.255.0
RT-2_config#interface gigaEthernet 0/3
RT-2_config_g0/3#ip address 192.168.2.1 255.255.255.0
RT-2_config#interface gigaEthernet 0/6
RT-2_config_g0/6#ip address 192.168.10.2 255.255.255.0
第二步:配置ospf协议
RT-1_config#router ospf 1
RT-1_config_ospf_1#network 192.168.1.0 255.255.255.0 area 0
RT-1_config_ospf_1#network 192.168.2.0 255.255.255.0 area 0
RT-1_config_ospf_1#network 192.168.10.0 255.255.255.0 area 0
RT-2_config#router ospf 1
RT-2_config_ospf_1#network 192.168.1.0 255.255.255.0 area 0
RT-2_config_ospf_1#network 192.168.2.0 255.255.255.0 area 0
RT-2_config_ospf_1#network 192.168.10.0 255.255.255.0 area 0
第三步:查看路由表
RT-1_config#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
C 192.168.1.0/24 is directly connected, GigaEthernet0/3
O 192.168.2.0/24 [110,2] via 192.168.10.2(on GigaEthernet0/6)
C 192.168.10.0/24 is directly connected, GigaEthernet0/6
RT-2_config#show ip route
Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
OE1 - OSPF external type 1, OE2 - OSPF external type 2
DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
VRF ID: 0
O 192.168.1.0/24 [110,2] via 192.168.10.1(on GigaEthernet0/6)
C 192.168.2.0/24 is directly connected, GigaEthernet0/3
C 192.168.10.0/24 is directly connected, GigaEthernet0/6
第四步:保存配置(重要)
RT-2_config#write
正在保存当前配置...
OK!
第五步:pc互ping,验证互通性
pc1>ping 192.168.2.2
正在 Ping 192.168.2.2 具有 32 字节的数据:
来自 192.168.2.2 的回复: 字节=32 时间=1ms TTL=126
来自 192.168.2.2 的回复: 字节=32 时间=1ms TTL=126
来自 192.168.2.2 的回复: 字节=32 时间=1ms TTL=126
来自 192.168.2.2 的回复: 字节=32 时间=1ms TTL=126
192.168.2.2 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 1ms,最长 = 1ms,平均 = 1ms
pc2>ping 192.168.1.2
正在 Ping 192.168.1.2 具有 32 字节的数据:
来自 192.168.1.2 的回复: 字节=32 时间=1ms TTL=126
来自 192.168.1.2 的回复: 字节=32 时间=1ms TTL=126
来自 192.168.1.2 的回复: 字节=32 时间=1ms TTL=126
来自 192.168.1.2 的回复: 字节=32 时间=1ms TTL=126
192.168.1.2 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 1ms,最长 = 1ms,平均 = 1ms
完结撒花