NAT实现内网访问外网_职场

 1.使用静态nat

让r3可以ping通r2.

首先在r3上设置,让r3模拟成PC

 

  1. ip route 0.0.0.0 0.0.0.0 192.168.13.1 

然后在R1上设置

 

  1. int e0/1  
  2. ip nat inside  
  3. exit  
  4.  
  5. int e0/0  
  6. ip nat outside  
  7. exit  
  8.  
  9. ip nat inside source static 192.168.13.3 202.66.84.2 

 2.使用动态NAT

步骤:

A.建立外部地址池

B.建立内部访问列表

C.转换

首先还是模拟R3,R4成为pc,分别敲如下命令

R3

  1. !  
  2. ip route 0.0.0.0 0.0.0.0 192.168.13.1  

 

R4

  1. !  
  2. ip route 0.0.0.0 0.0.0.0 192.168.14.1  

 

然后在R1上

 

  1. ip nat pool SHANGWANG 202.66.84.3 202.66.84.10 netmask 255.255.255.0  
  2.  
  3. ip access-list standard BenDi  
  4. permit 192.168.0.0 0.0.255.255  
  5.  
  6. !  
  7. interface Ethernet0/0  
  8.  ip address 202.66.84.1 255.255.255.0  
  9.  ip nat outside  
  10.  ip virtual-reassembly  
  11.  half-duplex  
  12. !  
  13. interface Ethernet0/1  
  14.  ip address 192.168.13.1 255.255.255.0  
  15.  ip nat inside  
  16.  ip virtual-reassembly  
  17.  half-duplex  
  18. !  
  19. interface Ethernet0/2  
  20.  ip address 192.168.14.1 255.255.255.0  
  21.  ip nat inside  
  22.  ip virtual-reassembly  
  23.  half-duplex  
  24. !  
  25.  
  26. ip nat inside source list BenDi pool SHANGWANG  
  27.  
  28.