配置NAT超载(NAPT)

【实验名称】

利用动态NAPT实现局域网访问互联网

【实验目的】

掌握内网中所有的主机连接到Internet网时,通过端口号区分的复用内部全局地址转换

【实验功能】

允许内部所有主机在公网地址缺乏的情况下可以访问外部网络

【实验设备】

 

 

实验步骤】

路由器左边 代表内网   右边 代表外网! 二层交换机不给配置 纯属汇聚作用!

218.1.1.10 为外网申请到的IP

外网PC2 IP:218.1.1.2 255.255.255.0

Router1

Router>enable
Router#configure terminal
Router(config)#interface fastEthernet 0/0
Router(config-if)#no shutdown

Router(config-if)#ip address 192.168.1.254 255.255.255.0
Router(config-if)#ip nat inside
Router(config-if)#exit
Router(config)#interface fastEthernet 1/0
Router(config-if)#no shutdown

Router(config-if)#ip address 218.1.1.10 255.255.255.0
Router(config-if)#ip nat outside
Router(config-if)#exit
Router(config)#access-list 1 permit 192.168.1.0 0.0.0.255
Router(config)#ip nat inside source list 1 interface fastEthernet 1/0 overload

(不用创建地址池,直接借用F1/0的IP地址,F1/0获取什么地址就使用什么地址。

这样配置NAT超载就从5步骤变成4步骤,该方法同样适用于静态接入)

结果!

server1 ping外网主机

PC>ping 218.1.1.2

Pinging 218.1.1.2 with 32 bytes of data:

Reply from 218.1.1.2: bytes=32 time=78ms TTL=127
Reply from 218.1.1.2: bytes=32 time=94ms TTL=127
Reply from 218.1.1.2: bytes=32 time=78ms TTL=127
Reply from 218.1.1.2: bytes=32 time=93ms TTL=127

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

PC1 ping 外网主机

PC>ping 218.1.1.2

Pinging 218.1.1.2 with 32 bytes of data:

Reply from 218.1.1.2: bytes=32 time=141ms TTL=127
Reply from 218.1.1.2: bytes=32 time=79ms TTL=127
Reply from 218.1.1.2: bytes=32 time=94ms TTL=127
Reply from 218.1.1.2: bytes=32 time=93ms TTL=127

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

Router#show ip nat translations
Pro  Inside global     Inside local       Outside local      Outside global
icmp 218.1.1.10:10     192.168.1.1:10     218.1.1.2:10       218.1.1.2:10
icmp 218.1.1.10:11     192.168.1.1:11     218.1.1.2:11       218.1.1.2:11
icmp 218.1.1.10:12     192.168.1.1:12     218.1.1.2:12       218.1.1.2:12
icmp 218.1.1.10:1024   192.168.1.1:13     218.1.1.2:13      
218.1.1.2:1024
icmp 218.1.1.10:13     192.168.1.2:13     218.1.1.2:13       218.1.1.2:13
icmp 218.1.1.10:14     192.168.1.2:14     218.1.1.2:14       218.1.1.2:14

 

 

 

原创:胡斌   

我会从简单到难的发表一些我学过的知识,希望能给一些想入门的朋友帮助,也希望找一些志同道合的朋友、老师 给我些指教。 QQ 276200261!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章