NAT 网络地址转换

私有地址范围

10.0.0.0/8 :10开头的

172.16.0.0/16 - 172.31.0.0/16 :172.16-172.31

192.168.0.0/16 :192.168开头的

分类:静态NAT,动态NAT,PAT

注意

内网到外网:转换源IP

外网到内网:转换目标IP

从inside到outside:先路由再NAT

从outside到inside:先NAT再路由

当地址从inside口进来,从outside口出去就会触发nat

### 1.静态NAT

一对一转换,多用于服务器。

  • IP映射:192.168.1.1 <-------> 202.101.10.1
  • 端口映射:192.168.1.1:80 <---------- 202.101.10.1:80,不可以主动访问外网

配置命令

IP映射:

ip nat inside source statice 192.168.1.1 202.101.10.1

int f0/x

ip nat inside

int f0/y

ip nat outside

端口映射:

ip nat inside source static tcp 192.168.1.1 80 202.101.10.1 80

2.动态NAT

网络安全笔记-21-NAT

池里有很多公网IP,一人拿一个,也是一对一的映射,当池里的一个IP被使用时,其他人就不能用。

配置命令

ip nat pool 池名称 起始地址 结束地址 network 子网掩码

eg:

ip nat pool nat1 202.101.10.1 202.101.10.3 network 255.255.255.0

access-list 1 permit 192.168.1.0 0.0.0.255

ip nat inside source list 1 pool nat1

int s1/0

ip nat outside

int f0/x

ip nat inside

3.PAT 端口复用

网络安全笔记-21-NAT

通过端口去对应内网IP。

配置命令

access-list 1 permit any :定义ACL

ip nat inside source list 1 interface S1/0 overload :将ACL与出接口匹配,并且是PAT

int f0/x

ip nat inside

int S1/0

ip nat outside

与出接口匹配,并且是PAT

int f0/x

ip nat inside

int S1/0

ip nat outside

相关文章:

  • 2021-10-12
  • 2021-05-13
  • 2021-05-10
  • 2021-06-21
  • 2021-10-04
  • 2021-11-29
  • 2021-10-04
  • 2021-06-03
猜你喜欢
  • 2021-11-01
  • 2021-07-19
  • 2021-05-16
  • 2021-08-07
  • 2021-04-23
  • 2022-12-23
  • 2021-10-23
相关资源
相似解决方案