最佳答案
· 某公司内网使用的IP地址为192.168.0.0/16。
· 该公司拥有202.38.1.2和202.38.1.3两个外网IP地址。
· 需要实现,内部网络中192.168.1.0/24网段的用户可以访问Internet,其它网段的用户不能访问Internet。使用的外网地址为202.38.1.2和202.38.1.3。
图2-4 内网用户通过NAT访问外网配置组网图(地址不重叠)
(1) 配置接口IP地址
# 根据组网图中规划的信息,配置各接口的IP地址,具体配置步骤如下。
<Device> system-view
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] ip address 192.168.1.1 16
[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) 配置静态路由
本举例仅以静态路由方式配置路由信息。实际组网中,请根据具体情况选择相应的路由配置方式。
# 请根据组网图中规划的信息,配置静态路由,本举例假设到达Server所在网络的下一跳IP地址为202.38.1.20,实际使用中请以具体组网情况为准,具体配置步骤如下。
[Device] ip route-static 200.1.1.0 24 202.38.1.20
(4) 配置安全策略
# 配置名称为trust-untrust的安全策略,保证Trust安全域内的Host可以访问Untrust安全域中的Server,具体配置步骤如下。
[Device] security-policy ip
[Device-security-policy-ip] rule name trust-untrust
[Device-security-policy-ip-1-trust-untrust] source-zone trust
[Device-security-policy-ip-1-trust-untrust] destination-zone untrust
[Device-security-policy-ip-1-trust-untrust] source-ip-subnet 192.168.1.0 24
[Device-security-policy-ip-1-trust-untrust] destination-ip-host 200.1.1.10
[Device-security-policy-ip-1-trust-untrust] action pass
[Device-security-policy-ip-1-trust-untrust] quit
[Device-security-policy-ip] quit
(5) 配置NAT功能
# 配置地址组0,包含两个外网地址202.38.1.2和202.38.1.3。
[Device] nat address-group 0
[Device-address-group-0] address 202.38.1.2 202.38.1.3
[Device-address-group-0] quit
# 配置地址对象组obj1,仅允许对内部网络中192.168.1.0/24网段的用户报文进行地址转换。
[Device] object-group ip address obj1
[Device-obj-grp-ip-obj1] network subnet 192.168.1.0 24
[Device-obj-grp-ip-obj1] quit
# 配置全局NAT规则,允许使用地址组0中的地址对匹配的对象组obj1的报文进行源地址转换,并在转换过程中使用端口信息。
[Device] nat global-policy
[Device-nat-global-policy] rule name rule1
[Device-nat-global-policy-rule-rule1] source-ip obj1
[Device-nat-global-policy-rule-rule1] action snat address-group 0
# 以上配置完成后,Host A能够访问WWW server,Host B和Host C无法访问WWW server。通过查看如下显示信息,可以验证以上配置成功。
[Device] display nat all
NAT address group information:
Totally 1 NAT address groups.
Address group ID: 0
Port range: 1-65535
Address information:
Start address End address
202.38.1.2 202.38.1.3
Exclude address information:
Start address End address
--- ---
NAT global-policy information:
Totally 1 NAT global-policy rules.
Rule name: rule1
Type : nat
SrcIP object group : obj1
SNAT action:
Address group ID: 0
NO-PAT: N
Reversible: N
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
SCTP : Disabled
SIP : Disabled
SQLNET : Disabled
TFTP : Disabled
XDMCP : Disabled
Static NAT load balancing: Disabled
NAT link-switch recreate-session: Disabled
NAT configuration-for-new-connection: Disabled
# 通过以下显示命令,可以看到Host A访问WWW server时生成NAT会话信息。
[Device] display nat session verbose
Slot 1:
Initiator:
Source IP/port: 192.168.1.10/52082
Destination IP/port: 200.1.1.10/80
DS-Lite tunnel peer: -
VPN instance/VLAN ID/Inline ID: -/-/-
Protocol: TCP(6)
Inbound interface: GigabitEthernet1/0/1
Source security zone: Trust
Responder:
Source IP/port: 200.1.1.10/80
Destination IP/port: 202.38.1.2/1036
DS-Lite tunnel peer: -
VPN instance/VLAN ID/Inline ID: -/-/-
Protocol: TCP(6)
Inbound interface: GigabitEthernet1/0/2
Source security zone: Untrust
State: TCP_ESTABLISHED
Application: HTTP
Rule ID: -/-/-
Rule name:
Start time: 2017-05-19 16:16:59 TTL: 9995s
Initiator->Responder: 551 packets 32547 bytes
Responder->Initiator: 956 packets 1385514 bytes
Total sessions found: 1
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论