实验1 网络地址翻译及配置-NAT
一、实验目的
(1)理解私有IP地址的作用。
(2)理解网络地址翻译(NAT)的概念及作用。 (3)掌握静态NAT和动态NAT的配置。
二、实验环境
(1)两台路由器 (2)一台交换机或集线器 (3)三台PC机 (4)线缆若干
1.1网络拓扑图 1.1路由器配置表
路由器名 E0或Fa0/0 S0或S0/0 环回地址 特权密码 Gateway ISP 10.1.6.1/24 200.1.1.2/24 200.1.1.1/24 1.1.1.1/24 仿真终端密码 cisco cisco cisco cisco 公网IP地址为200.1.1.0/24
三、实验内容与步骤
1.实验准备
(1)按要求完成拓扑的连接 (2) 分配主机的IP地址和缺省网关 (3)清空路由器配置 2.路由器的基本配置 (1)完成接口的配置 Gateway的接口配置: enable
configure terminal hostname Gateway interface fa0/0
ip address 10.1.6.1 255.255.255.0 no shutdown exit
interface s0/0
ip address 200.1.1.2 255.255.255.0 clock rate 64000 no shutdown exit
ISP的接口配置: enable
configure terminal hostname ISP interface s0/0
ip address 200.1.1.1 255.255.255.0 no shutdown exit
interface loopback 0
ip address 1.1.1.1 255.255.255.0 no shutdown exit
2.路由协议的配置 (1)配置动态路由协议 Gateway的路由配置: Router rip Network 200.1.1.0
ISP的路由配置: Router rip Network 200.1.1.0 Network 1.0.0.0
3.静态NAT的配置 (1)NAT分配表
表1.2 静态NAT分配表
主机名 PC1(WWW) 内部私有IP地址 10.1.6.2/24 外部公有IP地址 200.1.1.3/24 200.1.1.4/24 PC2(console) 10.1.6.3/24
(2)静态NAT配置 Gateway的配置: enable
configure terminal
ip nat inside source static 10.1.6.2 200.1.1.3 ip nat inside source static 10.1.6.3 200.1.1.4 (3)指定接口 enable
configure terminal interface fa0/0 ip nat inside
exit
interface s0/0 ip nat outside
(4)测试与ISP连通性
主机PC1和PC2分别ping 1.1.1.1(路由器ISP的环回接口)
(5)检查NAT是否正常工作
show ip nat translation //查看当前活跃的转换信息 show ip nat statistics //查看有关转换的统计信息
4. 动态NAT的配置 Gateway的配置:
(1)清空前面实验的静态NAT配置。 enable
configure terminal
no ip nat inside source static 10.1.6.2 200.1.1.3 no ip nat inside source static 10.1.6.3 200.1.1.4 (2)创建地址池 enable
configure terminal
ip nat pool gateway 200.1.1.0 200.1.1.255 netmask 255.255.255.0 (3)设置访问控制列表 enable
configure terminal
access-list 1 permit 10.1.6.0 0.0.0.255 (4)建立动态地址转换 enable
configure terminal
ip nat inside source list 1 pool gateway (5)指定接口
enable
configure terminal interface fa0/0 ip nat inside exit
interface s0/0 ip nat outside (6)测试与ISP连通性
主机PC1和PC2分别ping 1.1.1.1(路由器ISP的环回接口) (7)检查NAT是否正常工作
show ip nat translation //查看当前活跃的转换信息 show ip nat statistics //查看有关转换的统计信息
相关推荐: