静态 nat 的配置: <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

router 0 上做静态的 nat.

 

router 0

Router>enable
Router#configure
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fastEthernet 0/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.0.0.0
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)#exit
Router(config)#interface fastEthernet 0/1
Router(config-if)#ip address 2.2.2.1 255.0.0.0
Router(config-if)#no shutdown

 

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#rou
Router(config)#router ?

  eigrp  Enhanced Interior Gateway Routing Protocol (EIGRP)

  ospf   Open Shortest Path First (OSPF)

  rip    Routing Information Protocol (RIP)

Router(config)#router rip

Router(config-router)#network 10.0.0.0

Router(config-router)#network 2.0.0.0

Router(config-router)#exit
Router(config)#ip nat ?

  inside  Inside address translation

  pool    Define pool of addresses

Router(config)#ip nat inside ?

  source  Source address translation

Router(config)#ip nat inside source st 10.1.1.2 2.2.2.3

Router(config)#ip nat inside source st 10.1.1.3 2.2.2.4

Router(config)#no shut

Router(config)#interface fastEthernet 0/0

Router(config-if)#ip nat ?

  inside   Inside interface for address translation

  outside  Outside interface for address translation

Router(config-if)#ip nat inside

Router(config-if)#no shutdown

Router(config-if)#exit

Router(config)#interface fastEthernet 0/1

Router(config-if)#ip nat

Router(config-if)#ip nat ?

  inside   Inside interface for address translation

  outside  Outside interface for address translation

Router(config-if)#ip nat out

Router(config-if)#ip nat outside

Router(config-if)#no shutdown
Router(config-if)#end
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    2.0.0.0/8 is directly connected, FastEthernet0/1

R    3.0.0.0/8 [120/1] via 2.2.2.2, 00:00:12, FastEthernet0/1

C    10.0.0.0/8 is directly connected, FastEthernet0/0

Router#show ip nat statistics
Total translations: 2 (2 static, 0 dynamic, 0 extended)
Outside Interfaces: FastEthernet0/1
Inside Interfaces: FastEthernet0/0
Hits: 6  Misses: 16
Expired translations: 0
Dynamic mappings:
Router#show ip nat ?
  statistics    Translation statistics
  translations  Translation entries
Router#show ip nat tr
Router#show ip nat translations

Pro  Inside global     Inside local       Outside local      Outside global

---  2.2.2.3           10.1.1.2           ---                ---

---  2.2.2.4           10.1.1.3           ---                ---

 

Router#ping 3.3.3.2

 

Type escape sequence to abort.

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

!!!!!

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

 

Router#

 

 

 

 

router 1 的配置 ;

Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip add
Router(config-if)#ip address 2.2.2.2 255.0.0.0
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)#exit
Router(config)#interface fastEthernet 0/1
Router(config-if)#ip add
Router(config-if)#ip address 3.3.3.1 255.0.0.0
Router(config-if)#no shutdown

 

%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)#router rip

Router(config-router)#net

Router(config-router)#network 2.0.0.0

Router(config-router)#network 3.0.0.0

Router(config-router)#

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

 

C    2.0.0.0/8 is directly connected, FastEthernet0/0

C    3.0.0.0/8 is directly connected, FastEthernet0/1

R    10.0.0.0/8 [120/1] via 2.2.2.1, 00:00:09, FastEthernet0/0

Router#
Router#ping 2.2.2.3

 

Type escape sequence to abort.

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

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 78/85/94 ms

 

Router#ping 2.2.2.4

 

Type escape sequence to abort.

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

.!!!!

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

 

Router#

 

 

 

 

 

 

 

 

 

Pc2 ping 对方:
Packet Tracer PC Command Line 1.0
PC>ping 2.2.2.3

 

Pinging 2.2.2.3 with 32 bytes of data:

 

Reply from 2.2.2.3: bytes=32 time=125ms TTL=126
Reply from 2.2.2.3: bytes=32 time=109ms TTL=126
Reply from 2.2.2.3: bytes=32 time=125ms TTL=126
Reply from 2.2.2.3: bytes=32 time=125ms TTL=126

 

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

 

PC>ping 2.2.2.4

 

Pinging 2.2.2.4 with 32 bytes of data:

 

Reply from 2.2.2.4: bytes=32 time=125ms TTL=126
Reply from 2.2.2.4: bytes=32 time=125ms TTL=126
Reply from 2.2.2.4: bytes=32 time=125ms TTL=126
Reply from 2.2.2.4: bytes=32 time=125ms TTL=126

 

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

 

PC>ping 10.1.1.2

 

Pinging 10.1.1.2 with 32 bytes of data:

 

Reply from 2.2.2.3: bytes=32 time=125ms TTL=126
Reply from 2.2.2.3: bytes=32 time=111ms TTL=126
Reply from 2.2.2.3: bytes=32 time=94ms TTL=126
Reply from 2.2.2.3: bytes=32 time=112ms TTL=126

 

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

 

PC>ping 10.1.1.3

 

Pinging 10.1.1.3 with 32 bytes of data:

 

Reply from 2.2.2.4: bytes=32 time=98ms TTL=126
Reply from 2.2.2.4: bytes=32 time=110ms TTL=126
Reply from 2.2.2.4: bytes=32 time=110ms TTL=126
Reply from 2.2.2.4: bytes=32 time=125ms TTL=126

 

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

 

PC>