预配置
[r7isp]
#
sysname r7isp
#
interface Serial1/0
ip address 20.0.0.100 255.255.255.0
#
return
[r1]
sysname r1
#
interface Serial1/0
ip address 20.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip address 10.0.0.254 255.255.255.0
#
interface GigabitEthernet0/1
port link-mode route
combo enable copper
ip address 10.1.1.254 255.255.255.0
#
user-group system
#
return
[r2pc]
#
sysname r2pc
#
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip address 10.0.0.1 255.255.255.0
#
ip route-static 0.0.0.0 0 10.0.0.254
#
return
[r3server]
#
sysname r3server
#
interface GigabitEthernet0/1
port link-mode route
combo enable copper
ip address 10.1.1.1 255.255.255.0
#
ip route-static 0.0.0.0 0 10.1.1.254
#
return
需求场景 内部网络访问外网时,源地址转换为外网接口地址 PAT
企业总部内网 PC、Server,需访问互联网进行补丁升级,网关路由器r1对外接口只有一个公网地址,在路由器上配置源地址转换,当10.0.0.0/24和10.1.1.0/24访问外部资源时,将其源地址转换为网关公网接口地址20.0.0.1。
配置如下:
[r1]
#
acl basic name snat
rule 0 permit source 10.0.0.0 0.0.0.255
rule 5 permit source 10.1.1.0 0.0.0.255
#
nat address-group 10
address 20.0.0.1 20.0.0.1
#
interface Serial1/0
ip address 20.0.0.1 255.255.255.0
nat outbound name snat address-group 10
#
return
验证:在r2pc 和 r3server上ping r7isp的接口地址20.0.0.100
r1上通过 display nat session 命令查看NAT转换会话
r7isp通过terminal debugging 和 debugging ip icmp 验证源转换