H3C SecPath F5010兩條wan口,其中一條出口有靜態nat映射,內網主機訪問映射的公網地址不能通訊,也ping不通所映射的公網地址,需要內網地址能夠通過映射的公網地址訪問到內部服務器
(0)
最佳答案
內網接口開啟一下nat harping
配置案例:
某P2P應用環境中,內網中的客戶端首先需要向外網服務器進行注冊,外網服務器會記錄客戶端的IP地址和端口號。如果內網的一個客戶端要訪問內網的另一個客戶端,首先需要向服務器獲取對方的IP地址和端口號。
需要實現如下功能:
· 內網客戶端可以向外網中的服務器注冊,且注冊為一個相同的外網地址。
· 內網客戶端能夠通過從服務器獲得的IP地址和端口進行互訪。
圖2-7 內網用戶通過NAT地址互訪配置組網圖
該需求為典型的P2P模式的NAT hairpin應用,具體配置思路如下。
· 內網中的客戶端需要向外網中的服務器注冊,因此需要進行源地址轉換,可以配置出方向動態地址轉換實現。
· 服務器記錄客戶端的IP地址和端口號,且該地址和端口號是NAT轉換後的。由於服務器記錄的客戶端IP地址和端口號需要供任意源地址訪問,因此客戶端地址的轉換關係必須不關心對端地址,這可以通過配置EIM模式的動態地址轉換實現。
(1) 配置接口IP地址
# 根據組網圖中規劃的信息,配置各接口的IP地址,具體配置步驟如下。
<Device> system-view
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] ip address 192.168.1.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) 配置靜態路由
本舉例僅以靜態路由方式配置路由信息。實際組網中,請根據具體情況選擇相應的路由配置方式。
# 請根據組網圖中規劃的信息,配置靜態路由,本舉例假設到達Server所在網絡的下一跳IP地址為202.38.1.1,實際使用中請以具體組網情況為準,具體配置步驟如下。
[Device] ip route-static 200.2.2.0 24 202.38.1.1
(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.2.2.2
[Device-security-policy-ip-1-trust-untrust] action pass
[Device-security-policy-ip-1-trust-untrust] quit
# 配置名稱為trust-trust的安全策略,保證Trust安全域內的Host可以互訪,具體配置步驟如下。
[Device-security-policy-ip] rule name trust-trust
[Device-security-policy-ip-2-trust-trust] source-zone trust
[Device-security-policy-ip-2-trust-trust] destination-zone trust
[Device-security-policy-ip-2-trust-trust] source-ip-host 202.38.1.3
[Device-security-policy-ip-2-trust-trust] destination-ip-subnet 192.168.1.0 24
[Device-security-policy-ip-2-trust-trust] action pass
[Device-security-policy-ip-2-trust-trust] quit
[Device-security-policy-ip] quit
(5) 配置NAT功能
# 配置地址對象組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規則,通過Easy IP方式對內網訪問外網的報文進行源地址轉換,因為多個內部主機共用一個外網地址,因此需要配置為PAT方式,即轉換過程中使用端口信息。
[Device] nat global-policy
[Device-nat-global-policy] rule name rule1
[Device-nat-global-policy-rule-rule1] source-zone trust
[Device-nat-global-policy-rule-rule1] destination-zone untrust
[Device-nat-global-policy-rule-rule1] source-ip obj1
[Device-nat-global-policy-rule-rule1] action snat easy-ip
[Device-nat-global-policy-rule-rule1] quit
[Device-nat-global-policy] quit
# 配置ACL 2000,允許對內部網絡中192.168.1.0/24網段的報文進行地址轉換。
[Device] acl basic 2000
[Device-acl-ipv4-basic-2000] rule permit source 192.168.1.0 0.0.0.255
[Device-acl-ipv4-basic-2000] quit
# 配置PAT方式下的地址轉換模式為EIM,即隻要是來自相同源地址和源端口號的且匹配ACL 2000的報文,不論其目的地址是否相同,通過PAT轉換後,其源地址和源端口號都被轉換為同一個外部地址和端口號。
[Device] nat mapping-behavior endpoint-independent acl 2000
# 以上配置完成後,Host A、Host B和Host C 分別向外網服務器注冊之後,它們之間可以相互訪問。通過查看如下顯示信息,可以驗證以上配置成功。
[Device] display nat all
NAT global-policy information:
Totally 2 NAT global-policy rules.
Rule name: rule1
Type : nat
SrcIP object group : obj1
Source-zone name : trust
Destination-zone name : untrust
SNAT action:
Easy-IP
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 : Endpoint-Independent
ACL : 2000
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
NAT link-switch recreate-session: Disabled
NAT configuration-for-new-connection: Disabled
NAT global-policy compatible-previous-version rule-type ipv4-snat-and-dnat translate-before-secp : Disabled
NAT gratuitous-arp: Enabled
# 通過以下顯示命令,可以看到Client A訪問Client B時生成NAT會話信息。
[Device] display nat session verbose
Slot 1:
Initiator:
Source IP/port: 192.168.1.3/44929
Destination IP/port: 202.38.1.3/1
DS-Lite tunnel peer: -
VPN instance/VLAN ID/Inline ID: -/-/-
Protocol: UDP(17)
Inbound interface: GigabitEthernet1/0/1
Source security zone: Trust
Responder:
Source IP/port: 192.168.1.2/69
Destination IP/port: 202.38.1.3/1024
DS-Lite tunnel peer: -
VPN instance/VLAN ID/Inline ID: -/-/-
Protocol: UDP(17)
Inbound interface: GigabitEthernet1/0/1
Source security zone: Trust
State: UDP_READY
Application: TFTP
Rule ID: -/-/-
Rule name:
Start time: 2012-08-15 15:53:36 TTL: 46s
Initiator->Responder: 1 packets 56 bytes
Responder->Initiator: 1 packets 72 bytes
Total sessions found: 1
(0)
親~登錄後才可以操作哦!
確定你的郵箱還未認證,請認證郵箱或綁定手機後進行當前操作
舉報
×
侵犯我的權益
×
侵犯了我企業的權益
×
抄襲了我的內容
×
原文鏈接或出處
誹謗我
×
對根叔社區有害的內容
×
不規範轉載
×
舉報說明