配置单区域 ospf ospf 是典型的链路状态路由协议) <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Router 0 :

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip add
Router(config-if)#ip address <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10.1.1.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#no shutdown

 

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#
Router(config-if)#int f 0/1
Router(config-if)#ip add 12.12.12.1 255.255.255.0
Router(config-if)#no shut

 

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#
Router(config-if)#int loo 0

 

%LINK-5-CHANGED: Interface Loopback0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
Router(config-if)#ip add 1.1.1.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#rout
Router(config)#router o
Router(config)#router ospf 1

Router(config-router)#net

Router(config-router)#network 10.1.1.0 0.0.0.255 are

Router(config-router)#network 10.1.1.0 0.0.0.255 area 0

Router(config-router)#network 12.12.12.0 0.0.0.255 area 0

Router(config-router)#
00:12:59: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/1 from LOADING to FULL, Loading Done
Router(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
Router#show ip rou
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

 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.1.0 is directly connected, FastEthernet0/0

     12.0.0.0/24 is subnetted, 1 subnets

C       12.12.12.0 is directly connected, FastEthernet0/1

     23.0.0.0/24 is subnetted, 1 subnets

O       23.23.23.0 [110/2] via 12.12.12.2, 00:02:35, FastEthernet0/1

O    192.168.1.0/24 [110/3] via 12.12.12.2, 00:00:47, FastEthernet0/1

Router#ping 192.168.1.100

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 80/91/94 ms

Router#

 

 

 

Router 1

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f 0/0
Router(config-if)#ip add 23.23.23.2 255.255.255.0
Router(config-if)#no shut

 

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#int f 0/1
Router(config-if)#ip add 12.12.12.2 255.255.255.0
Router(config-if)#no shut

 

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#
Router(config-if)#exit
Router(config)#int loo
Router(config)#int loopback 0

 

%LINK-5-CHANGED: Interface Loopback0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
Router(config-if)#ip add 2.2.2.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#
Router(config-if)#exit
Router(config)#router ospf 1

Router(config-router)#net

Router(config-router)#network 23.23.23.0 0.0.0.255 area 0

Router(config-router)#network 12.12.12.0 0.0.0.255 area 0

Router(config-router)#
00:12:55: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/1 from LOADING to FULL, Loading Done
00:13:21: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
Router(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
Router#show ip rou
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

 

     2.0.0.0/24 is subnetted, 1 subnets

C       2.2.2.0 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

O       10.1.1.0 [110/2] via 12.12.12.1, 00:02:55, FastEthernet0/1

     12.0.0.0/24 is subnetted, 1 subnets

C       12.12.12.0 is directly connected, FastEthernet0/1

     23.0.0.0/24 is subnetted, 1 subnets

C       23.23.23.0 is directly connected, FastEthernet0/0

O    192.168.1.0/24 [110/2] via 23.23.23.3, 00:01:08, FastEthernet0/0

Router#ping 10.1.1.100

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.100, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 46/52/62 ms

 

Router#ping 192.168.1.100

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms

 

Router#

 

 

 

 

Router 2

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f 0/0
Router(config-if)#ip add 23.23.23.3 255.255.255.0
Router(config-if)#no shut

 

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#
Router(config-if)#int f 0/1
Router(config-if)#ip add 192.168.1.3 255.255.255.0
Router(config-if)#no shut

 

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#int loo
Router(config)#int loopback 0

 

%LINK-5-CHANGED: Interface Loopback0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
Router(config-if)#ip add 3.3.3.3 255.255.255.0
Router(config-if)#no shut
Router(config-if)#exit
Router(config)#router o
Router(config)#router ospf 1

Router(config-router)#net

Router(config-router)#network 23.23.23.0 0.0.0.255 area 0

Router(config-router)#network 23.23.23.0 0.0.0.25

00:13:18: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, L area 0^Z
%SYS-5-CONFIG_I: Configured from console by console
Router#conf
Router#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#rout
Router(config)#router o
Router(config)#router ospf 1

Router(config-router)#net

Router(config-router)#network 192.168.1.0 0.0.0.255 area 0

Router(config-router)#end
%SYS-5-CONFIG_I: Configured from console by console
Router#show ip rout
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

 

     3.0.0.0/24 is subnetted, 1 subnets

C       3.3.3.0 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

O       10.1.1.0 [110/3] via 23.23.23.2, 00:02:47, FastEthernet0/0

     12.0.0.0/24 is subnetted, 1 subnets

O       12.12.12.0 [110/2] via 23.23.23.2, 00:02:47, FastEthernet0/0

     23.0.0.0/24 is subnetted, 1 subnets

C       23.23.23.0 is directly connected, FastEthernet0/0

C    192.168.1.0/24 is directly connected, FastEthernet0/1

Router#ping 10.1.1.100

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.100, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 93/93/94 ms

 

Router#

 

 

 

 

Pc 0 ping 对方主机 :

Packet Tracer PC Command Line 1.0
PC>ping 192.168.1.100

 

Pinging 192.168.1.100 with 32 bytes of data:

 

Reply from 192.168.1.100: bytes=32 time=125ms TTL=125
Reply from 192.168.1.100: bytes=32 time=109ms TTL=125
Reply from 192.168.1.100: bytes=32 time=109ms TTL=125
Reply from 192.168.1.100: bytes=32 time=78ms TTL=125

 

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

 

PC>tracert 192.168.1.100

 

Tracing route to 192.168.1.100 over a maximum of 30 hops:

 

  1   32 ms     18 ms     31 ms     10.1.1.1
  2   47 ms     62 ms     62 ms     12.12.12.2
  3   93 ms     94 ms     94 ms     23.23.23.3
  4   109 ms    125 ms    125 ms    192.168.1.100

 

Trace complete.

 

PC>