内部服务器使用iis部署服务,在防火墙上使用目的nat对内外网同时发布业务,在内用使用发布的IP+端口或者使用域名都可以访问,但是在互联网使用IP+端口可以正常访问,使用域名无法访问,这是什么原因呢?
(0)
最佳答案
· 某公司内部对外提供Web服务,Web服务器地址为10.110.10.2/24。
· 该公司在内网有一台DNS服务器,IP地址为10.110.10.3/24,用于解析Web服务器的域名。
· 该公司拥有两个外网IP地址:202.38.1.2和202.38.1.3。
需要实现,外网主机可以通过域名访问内网的Web服务器。
图2-6 外网用户通过域名访问内网服务器配置组网图(地址不重叠)
· 外网主机通过域名访问Web服务器,首先需要通过访问内网DNS服务器获取Web服务器的IP地址,因此需要通过配置NAT内部服务器将DNS服务器的内网IP地址和DNS服务端口映射为一个外网地址和端口。
· DNS服务器回应给外网主机的DNS报文载荷中携带了Web服务器的内网IP地址,因此需要将DNS报文载荷中的内网IP地址转换为一个外网IP地址。外网地址分配可以通过出方向动态地址转换功能实现,转换载荷信息可以通过DNS ALG功能实现。
(1) 配置接口IP地址
# 根据组网图中规划的信息,配置各接口的IP地址,具体配置步骤如下。
<Device> system-view
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] ip address 10.110.10.1 24
[Device-GigabitEthernet1/0/1] quit
请参考以上步骤配置其他接口的IP地址,具体配置步骤略。
(2) 将接口加入安全域
# 请根据组网图中规划的信息,将接口加入对应的安全域,具体配置步骤如下。
[Device] security-zone name trust
[Device-security-zone-Trust] import interface gigabitethernet 1/0/1
[Device-security-zone-Trust] quit
[Device] security-zone name untrust
[Device-security-zone-Untrust] import interface gigabitethernet 1/0/2
[Device-security-zone-Untrust] quit
(3) 配置安全策略
# 配置名称为untrust-trust的安全策略,保证Untrust安全域内的Host可以访问Trust安全域中的Server,具体配置步骤如下。
[Device] security-policy ip
[Device-security-policy-ip] rule name untrust-trust
[Device-security-policy-ip-1-untrust-trust] source-zone untrust
[Device-security-policy-ip-1-untrust-trust] destination-zone trust
[Device-security-policy-ip-1-untrust-trust] destination-ip-host 10.110.10.2
[Device-security-policy-ip-1-untrust-trust] destination-ip-host 10.110.10.3
[Device-security-policy-ip-1-untrust-trust] destination-ip-host 10.110.10.4
[Device-security-policy-ip-1-untrust-trust] action pass
[Device-security-policy-ip-1-untrust-trust] quit
[Device-security-policy-ip] quit
(4) 配置NAT功能
# 开启DNS的NAT ALG功能。
[Device] nat alg dns
# 创建地址组。
[Device] nat address-group 1
[Device-address-group-1] address 202.38.1.3 202.38.1.3
[Device-address-group-1] quit
# 配置服务对象组service1,提供DNS服务。
[Device] object-group service service1
[Device-obj-grp-service-service1] service tcp destination eq 53
[Device-obj-grp-service-service1] service udp destination eq 53
[Device-obj-grp-service-service1] quit
# 配置全局NAT规则,允许外网主机使用地址202.38.1.2访问内网DNS服务器。
[Device] nat global-policy
[Device-nat-global-policy] rule name rule1
[Device-nat-global-policy-rule-rule1] source-zone untrust
[Device-nat-global-policy-rule-rule1] destination-ip host 202.38.1.2
[Device-nat-global-policy-rule-rule1] service service1
[Device-nat-global-policy-rule-rule1] action dnat ip-address 10.110.10.3 local-port 53
[Device-nat-global-policy-rule-rule1] quit
# 配置全局NAT规则,允许使用地址组1中的地址对DNS应答报文载荷中的内网地址进行转换,并在转换过程中不使用端口信息,以及允许反向地址转换。
[Device-nat-global-policy] rule name rule2
[Device-nat-global-policy-rule-rule2] source-ip host 10.110.10.2
[Device-nat-global-policy-rule-rule2] source-zone trust
[Device-nat-global-policy-rule-rule2] destination-zone untrust
[Device-nat-global-policy-rule-rule2] action snat address-group 1 no-pat reversible
[Device-nat-global-policy-rule-rule2] quit
[Device-nat-global-policy] quit
# 以上配置完成后,外网Host能够通过域名访问内网Web server。通过查看如下显示信息,可以验证以上配置成功。
[Device] display nat all
NAT address group information:
Totally 1 NAT address groups.
Address group ID: 1
Port range: 1-65535
Address information:
Start address End address
202.38.1.3 202.38.1.3
NAT global-policy information:
Totally 2 NAT global-policy rules.
Rule name: rule1
Type : nat
DestIP address : 202.38.1.2
Source-zone name : untrust
Service object group : service1
DNAT action:
IPv4 address: 10.110.10.3
Port: 53
NAT counting : 0
Config status: Active
Rule name: rule2
Type : nat
SrcIP address : 10.110.10.2
Source-zone name : trust
Destination-zone name : untrust
SNAT action:
Address group ID: 1
NO-PAT: Y
Reversible: Y
Port-preserved: N
NAT counting : 0
Config status: Active
NAT logging:
Log enable : Disabled
Flow-begin : Disabled
Flow-end : Disabled
Flow-active : Disabled
Port-block-assign : Disabled
Port-block-withdraw : Disabled
Alarm : Disabled
NO-PAT IP usage : Disabled
NAT mapping behavior:
Mapping mode : Address and Port-Dependent
ACL : ---
Config status: Active
NAT ALG:
DNS : Enabled
FTP : Enabled
H323 : Disabled
ICMP-ERROR : Enabled
ILS : Disabled
MGCP : Disabled
NBT : Disabled
PPTP : Enabled
RTSP : Enabled
RSH : Disabled
SCCP : Disabled
SIP : Disabled
SQLNET : Disabled
TFTP : Disabled
XDMCP : Disabled
Static NAT load balancing: Disabled
# 通过以下显示命令,可以看到Host访问Web server时生成NAT会话信息。
[Device] display nat session verbose
Slot 1:
Initiator:
Source IP/port: 200.1.1.2/1694
Destination IP/port: 202.38.1.3/8080
DS-Lite tunnel peer: -
VPN instance/VLAN ID/Inline ID: -/-/-
Protocol: TCP(6)
Inbound interface: GigabitEthernet1/0/2
Source security zone: Untrust
Responder:
Source IP/port: 10.110.10.2/8080
Destination IP/port: 200.1.1.2/1694
DS-Lite tunnel peer: -
VPN instance/VLAN ID/Inline ID: -/-/-
Protocol: TCP(6)
Inbound interface: GigabitEthernet1/0/1
Source security zone: Trust
State: TCP_ESTABLISHED
Application: HTTP
Rule ID: -/-/-
Rule name:
Start time: 2017-06-15 14:53:29 TTL: 3597s
Initiator->Responder: 7 packets 308 bytes
Responder->Initiator: 5 packets 312 bytes
Total sessions found: 1
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明