NAT的配置

 

一、 NAT 的配置
使用软件: dynamips 模拟
1 1 、网络拓扑如下
 

 

 

按照上面拓扑连接设备
1 2 、基本配制

 

R1配置

R7配置

host R1

int f0/0

ip add 192.168.0.2 255.255.255.0

no shut

ip route 0.0.0.0 0.0.0.0 192.168.0.1

//用路由器来模拟PC所以要加默认路由

host R7

int f0/0

ip add 192.168.0.3 255.255.255.0

no shut

ip route 0.0.0.0 0.0.0.0 192.168.0.1

//用路由器来模拟PC所以要加默认路由

R2配置

ISP配置

host R2

int f0/0

ip add 192.168.0.1 255.255.255.0

ip route 0.0.0.0 0.0.0.0 202.99.224.10

int s1/1

ip add 202.99.224.9 255.255.255.252

clock rate 56000

no shut

 

host ISP

int l0    //loopback地址来模拟外网

ip add 202.99.223.1 255.255.255.0

int s1/0

ip add 202.99.224.10 255.255.255.252

no shut

 

1 3 、静态 NAT 配置 ( 一对一 )
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat inside source static 192.168.0.2 202.99.224.13
ip nat inside source static 192.168.0.3 202.99.224.14
int f0/0
ip nat inside
int s1/1
ip nat outside
验证:可以在R2和R7上ping 202.99.223.1然后在R2上用show ip nat trans查看转换情况
 
1 4 、动态 NAT 地址池配置 ( 一对一 )
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat pool pool1 202.99.224.13 202.99.224.14 netmask 255.255.255.252
ip nat inside source list 1 pool pool1
int f0/0
ip nat inside
int s1/1
ip nat outside
验证:可以在R2和R7上ping 202.99.223.1然后在R2上用show ip nat trans查看转换情况
 
1 5 、动态 NAT 配置 ( 一对多 )
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat inside source list 1 interface s1/1 overload
int f0/0
ip nat inside
int s1/1
ip nat outside
验证:可以在R2和R7上ping 202.99.223.1然后在R2上用show ip nat trans查看转换情况
1.6、补充说明
show ip nat translations 显示被转换的情况
show ip nat statistics    显示nat统计信息
show ip nat transitions verbose显示被转换的详细情况
1.6、针对端口映射
R2:
access-list 1 permit 192.168.0.0 0.0.0.255
ip nat inside source static tcp  192.168.0.2  1111 202.99.224.13 1111   针对端口映射

int f0/0
ip nat inside
int s1/1
ip nat outside

你可能感兴趣的:(配置,连接,NAT)