如下图所示,用户希望在路由器侧做NAT,映射关系如下:
192.168.1.1和10.10.0.1 互为映射
192.168.1.2和10.10.0.2 互为映射
192.168.1.4和10.10.0.3 互为映射
实现:1.PC2可以通过访问10.0.0.1、10.0.0.2和10.0.0.3分别访问到192.168.1.1、192.168.1.2和192.168.1.3;
2.并且PC3、PC4和PC5访问PC2时,要把自己的IP转换为10.0.0.x网段。
请问这种情况如何实现呢?
(0)
最佳答案
给个案例参考:
nat static outbound local-ip global-ip
对于从内网到外网的报文,将其源地址local-ip转换为global-ip;
对于从外网到内网的报文,将其目的地址global-ip转换为local-ip。
RTA-------------NAT-------------RTB
RTA:
#
interface GigabitEthernet0/0
ip address 192.168.0.1 255.255.255.0
#
ip route-static 0.0.0.0 0 192.168.0.254
#
NAT:
#
nat static outbound 192.168.0.1 1.1.1.2
nat static outbound 1.1.1.1 192.168.0.253
#
interface GigabitEthernet0/0
ip address 192.168.0.254 255.255.255.0
nat static enable
#
interface GigabitEthernet0/1
ip address 1.1.1.254 255.255.255.0
nat static enable
#
RTB:
#
interface GigabitEthernet0/0
ip address 1.1.1.1 255.255.255.0
#
ip route-static 0.0.0.0 0 1.1.1.254
#
<NAT>*May 23 19:58:23:756 2020 NAT NAT/7/COMMON:
PACKET: (GigabitEthernet0/0-in) Protocol: ICMP
192.168.0.1: 0 - 192.168.0.253: 0(VPN: 0) ------>
192.168.0.1: 0 - 1.1.1.1: 0(VPN: 0)
*May 23 19:58:23:756 2020 NAT NAT/7/COMMON:
PACKET: (GigabitEthernet0/1-out) Protocol: ICMP
192.168.0.1: 0 - 1.1.1.1: 0(VPN: 0) ------>
1.1.1.2: 0 - 1.1.1.1: 0(VPN: 0)
*May 23 19:58:23:757 2020 NAT NAT/7/COMMON:
PACKET: (GigabitEthernet0/1-in) Protocol: ICMP
1.1.1.1: 0 - 1.1.1.2: 0(VPN: 0) ------>
1.1.1.1: 0 - 192.168.0.1: 0(VPN: 0)
*May 23 19:58:23:757 2020 NAT NAT/7/COMMON:
PACKET: (GigabitEthernet0/0-out) Protocol: ICMP
1.1.1.1: 0 - 192.168.0.1: 0(VPN: 0) ------>
192.168.0.253: 0 - 192.168.0.1: 0(VPN: 0)
(0)
您好,请知:
关于双向NAT的部署,以下是配置要点,请参考:
1、内外网口都配置为nat outbound
2、分别在内外网口部署nat server
3、以下是双向NAT的案例,请参考:
https://zhiliao.h3c.com/theme/details/101822
4、注意确保路由可达。
以下是双向NAT的配置脚本关键点,请参考:
[R1]acl basic 2000
[R1-acl-ipv4-basic-2000]rule 0 permit source any
[R1-acl-ipv4-basic-2000]quit
[R1]int gi 0/1
[R1-GigabitEthernet0/1]nat outbound 2000
[R1-GigabitEthernet0/1]nat server protocol tcp global 202.1.100.3 80 inside 10.0.0.1 80
[R1-GigabitEthernet0/1]nat server protocol tcp global 202.1.100.3 443 inside 10.0.0.1 443
[R1-GigabitEthernet0/1]quit
[R1]acl basic 2001
[R1-acl-ipv4-basic-2001]rule 0 permit source 192.168.200.0 0.0.0.255
[R1-acl-ipv4-basic-2001]rule 1 deny source any
[R1]int gi 0/0
[R1-GigabitEthernet0/0]nat server protocol tcp global 202.1.100.3 443 inside 10.0.0.1
[R1-GigabitEthernet0/0]nat outbound 2001
[R1-GigabitEthernet0/0]quit
(0)
暂无评论
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论