SW200#
conf t
Enter configuration commands, one per line. End with CNTL/Z.
//
注意:如果没有开启路由功能,直接运行路由协议,将提示如下的错误信息
SW200(config)#
router ospf 200
IP routing not enabled
SW200(config)#
ip routing
SW200(config)#
router ospf 200
SW200(config-router)#
net 12.0.0.2 0.0.0.255 a 0
SW200(config-router)#
net 172.16.0.2 0.0.0.255 a 0
SW200(config-router)#
end
00:05:27: %OSPF-5-ADJCHG: Process 200, Nbr 192.168.0.1 on FastEthernet0/24 from LOADING to FULL, Loading Done
/
/
查看路由表,观察通过OSPF
学习到路由条目
SW200#
show ip ro
00:05:33: %SYS-5-CONFIG_I: Configured from console by console
SW200#show ip route
Codes: C - connected, S - static, 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, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, Vlan200
O 192.168.0.0/24 [110/2] via 12.0.0.1, 00:00:02, FastEthernet0/24
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, FastEthernet0/24
//
测试IP
连通性
SW200#
ping 12.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
SW200#
ping 192.168.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
SW200#
ping 192.168.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
SW200#
|