应用场景描述:<?xml:namespace prefix = o />

公司因为对因特网的访问需求逐步提升,原来申请的公网IP地址数量不够使用,因为重新申请了一段地址作为连接互联网使用,作为网络管理员,需要对路由器上的NAT配置进行重新规划设置

使用到的相关知识点总结:

1ip nat inside source static 本地IP地址 全球IP地址

2ip nat inside/outside

3ip route network(mask)下一跳/接口

4. access-list access-list-num permit 网段,反码

5. ip nat pool pool-num 开始IP 结束IP 子网掩码

6. ip nat inside  source list access-list-num pool pool-num

7. ip nat inside  source list access-list-num pool pool-num overload

8. ip nat inside source list access-list-num int 接口号 overload

NAT配置步骤

1、接口IP地址配置

2、使用访问控制列表定义哪些内部主机能做NAT

3、决定采用什么公有地址,静态或地址池

4、指定地址转换映射

5、在内部和外部端口上启用NAT

步骤:

静态NAT的配置:

  R6

int f0/1

ip add 192.168.2.1 255.255.255.0

no sh

ip nat inside

int f0/0

ip add <?xml:namespace prefix = st1 />10.0.0.2 255.255.255.0

no sh

ip nat outside

exit

ip route 0.0.0.0 0.0.0.0 f0/0

静态:ip nat inside source static 192.168.2.2 102.0.0.1

静态:ip nat inside source static 192.168.2.3 102.0.0.2
有几个就写几条

****************************************

动态NAT的设置:

int f0/1

ip add 192.168.2.1 255.255.255.0

no sh

ip nat inside

int f0/0

ip add 10.0.0.2 255.255.255.0

no sh

ip nat outside

exit

ip route 0.0.0.0 0.0.0.0 f0/0

access-list 1 permit 192.168.2.0  0.0.0.255

ip nat pool yuan 102.0.0.1 102.0.0.2 netmask 255.255.255.252

ip nat inside source list 1 pool yuan

******************************************************

PAT的设置:

int f0/1

ip add 192.168.2.1 255.255.255.0

no sh

ip nat inside

int f0/0

ip add 10.0.0.2 255.255.255.0

no sh

ip nat outside

exit

ip route 0.0.0.0 0.0.0.0 f0/0

access-list 1 permit 192.168.2.0  0.0.0.255

ip nat pool yuan 102.0.0.1 102.0.0.2 netmask 255.255.255.252

ip nat inside source list 1 pool yuan overload .....设置PAT
***************************************************

PAT复用路由器的外部接口:

int f0/1

ip add 192.168.2.1 255.255.255.0

no sh

ip nat inside

int f0/0

ip add 102.0.0.1 255.255.255.252

no sh

ip nat outside

exit

ip route 0.0.0.0 0.0.0.0 f0/0

access-list 1 permit 192.168.2.0  0.0.0.255

ip nat inside source list 1 int f0/0 overload

 
总结:

   当设置成静态转换时,转换了几条就只能有几个主机上网。

   当设置成动态转换时,随机转换条目.

   设置成PAT时,可以有多个主机上网,这是最常用的NAT转换方式