CCNA试验-NAT_路由交换
Hostname
F0
S2/0
Enaacle
console
Gateway
10.10.10.1/24
200.2.2.18/30
cisco
Cisco
Isp
 
200.2.2.17/30
cisco
class
 
 
 
内部私有地址
 
内部全局地址
10.10.10.0
-à
199.99.9.40
199.99.9.60
255.255.255.0
 
255.255.255.224
255.255.255.224
 
 
 
 
 
理解NAT 注意基础的四个概念
 
●Inside Local Address(内部本地地址)
    指一个网络内部分配给网上主机的IP地址,此地址通常不是Internet上的合法地址,即不是网络信息中心 (NIC)或Internet服务提供商(ISP)所分配的IP地址。
    ●Inside Global Address(内部全局地址)
    用来代替一个或者多个内部本地IP地址的、对外的、Internet上合法的IP地址。
    ●Outside Local Address(外部本地地址)
    一个外部主机相对于内部网所用的IP地址。此地址需要是Internet上合法的地址,但是从内部网可以进行路由的地址空间中进行分配的。
    ●Outside Global Address(外部全局地址)
    由主机拥有者分配给在外部网上主机的IP地址。此地址是从一个从全局可路由的地址或网络空间中分配的。
CCNA试验-NAT_路由交换_02
 
CCNA试验-NAT_NAT_03
 
Step 1 配置路由器
ISP
Router#configure terminal
Router(config)#hostname ISP
ISP(config)#enable password cisco
ISP(config)#enable secret class
ISP(config)#line console 0
ISP(config-line)#password cisco
ISP(config-line)#login
ISP(config-line)#exit
ISP(config)#line vty 0 4
ISP(config-line)#password cisco
ISP(config-line)#login
ISP(config-line)#exit
ISP(config)#interface loopback 0
ISP(config-if)#ip address 172.16.1.1 255.255.255.255
ISP(config-if)#exit
ISP(config)#interface serial 0
ISP(config-if)#ip address 200.2.2.17 255.255.255.252
ISP(config-if)#clock rate 64000
ISP(config)#ip route 199.99.9.32 255.255.255.224 200.2.2.18
ISP(config)#end
ISP#copy running-config startup-config
 
Gateway
Router#configure terminal
Router(config)#hostname Gateway
Gateway(config)#enable password cisco
Gateway(config)#enable secret class
Gateway(config)#line console 0
Gateway(config-line)#password cisco
Gateway(config-line)#login
Gateway(config-line)#exit
Gateway(config)#line vty 0 4
Gateway(config-line)#password cisco
Gateway(config-line)#login
Gateway(config-line)#exit
Gateway(config)#interface fastethernet 0
Gateway(config-if)#ip address 10.10.10.1 255.255.255.0
Gateway(config-if)#no shutdown
Gateway(config-if)#exit
Gateway(config)#interface serial 0
Gateway(config-if)#ip address 200.2.2.18 255.255.255.252
Gateway(config-if)#no shutdown
Gateway(config)#ip route 0.0.0.0 0.0.0.0 200.2.2.17
Step 2 保存配置
copy running-config startup-config.
Step 3 PC配置正确的IP地址,子网掩码和缺省网关
Step 4 测试网络的连通性
Step 5 创建静态路由
ISP(config)#ip route 199.99.9.32 255.255.255.224 200.2.2.18
 
ISP#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
 
     10.0.0.0/24 is subnetted, 1 subnets
S       10.10.10.0 [1/0] via 200.2.2.18
     172.16.0.0/32 is subnetted, 1 subnets
C       172.16.1.1 is directly connected, Loopback0
     200.2.2.0/30 is subnetted, 1 subnets
C       200.2.2.16 is directly connected, Serial2/0
 
 
 
GATEway#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 200.2.2.17 to network 0.0.0.0
 
     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, FastEthernet0/0
     200.2.2.0/30 is subnetted, 1 subnets
C       200.2.2.16 is directly connected, Serial2/0
S*   0.0.0.0/0 [1/0] via 200.2.2.17
 
 
 
tep 6 创建缺省路由
Gateway(config)#ip route 0.0.0.0 0.0.0.0 200.2.2.17
   
Step 7 定义缺省的公有地址池
Gateway(config)#ip nat pool public_access 199.99.9.40 199.99.9.62
netmask 255.255.255.224
 
Step 8 创建ACL定义内部私有的IP地址
Gateway(config)#access-list 1 permit 10.10.10.0 0.0.0.255
Step 9 定义内部列表到外部地址池的地址转换
Gateway(config)#ip nat inside source list 1 pool public_access(poolname )
 
Step 10 确定接口
Gateway(config)#interface fastethernet 0
Gateway(config-if)#ip nat inside
Gateway(config-if)#interface serial 0
Gateway(config-if)#ip nat outside
Step 11 配置静态映射
Gateway(config)#ip nat inside source static 10.10.10.2 199.99.9.36
Gateway#show ip nat translations
 
 
重要的步骤
 
GATEway(config)# ip nat pool public-access 199.99.9.40 199.99.9.60 netmask 255.255.255.224
 
GATEway(config)#ip nat inside source list 1 pool public-access
 
GATEway(config)#access-list 1 permit 10.10.10.0 0.0.0.255
 
一条静态nat条目 
GATEway(config)#ip nat inside source static 10.10.10.2 199.99.9.36
 
GATEway#show ip nat translations
Pro  Inside global     Inside local       Outside local      Outside global
---  199.99.9.36       10.10.10.2         ---                ---
 
 
Ping 内网私有地址
 
 ISP #ping 10.10.10.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 79/9