USG5500 配置地址池和easy-ip雙出口NAT
一、組網需求:
1、某公司購買了兩個運營商的公網IP,使公司內部使用者能夠通過NAT訪問網際網路。但是向A運營商只購買一個公網IP,所以想配置為easy-ip的NAT模式。向B運營商購買了6公網IP(202.202.202.1-202.202.202.6),所有想配置為NAT地址池模式。
另外,同一個網段的內網,指定IP的機器不能訪問網際網路,其他IP可以訪問網際網路。
2、網路拓撲
3、資料規劃
VLAN:vlan172(172.16.1.1/24),vlan192(192.168.1.1/24),vlan100(100.100.100.1/24)
SW1:G0/0/1:(vlan100),G0/0/2:(vlan192),G0/0/3:(vlan172),G0/0/4:(vlan192)
FW1:G0/0/1(100.100.100.2),G0/0/2(201.201.201.1/24),G0/0/3(202.202.202.1/24)
ISP1:G0/0/2(201.201.201.2/24),G0/0/0(203.203.203.2/24)
ISP2:G0/0/2(202.202.202.6/24),G0/0/0(203.203.203.3/24)
4、配置思路
匯聚層劃分vlan,並配置IP,對應介面應用vlan
防火牆配置IP,域間安全策略,NAT
二、操作步驟
SW1交換機
1、配置vlan和介面
<Huawei>system-view [Huawei]sysname SW1 [SW1]vlan batch 172 192 100 [SW1]interface Vlanif 172 [SW1-Vlanif172]ip address 172.16.1.1 24 [SW1-Vlanif172]q [SW1]interface Vlanif 192 [SW1-Vlanif192]ip address 192.168.1.1 24 [SW1-Vlanif192]q [SW1]interface Vlanif 100 [SW1-Vlanif100]ip address 100.100.100.1 24 [SW1-Vlanif100]q [SW1]interface GigabitEthernet 0/0/2 [SW1-GigabitEthernet0/0/2]port link-type access [SW1-GigabitEthernet0/0/2]port default vlan 192 [SW1-GigabitEthernet0/0/2]q [SW1]interface GigabitEthernet 0/0/4 [SW1-GigabitEthernet0/0/4]port link-type access [SW1-GigabitEthernet0/0/4]port default vlan 192 [SW1-GigabitEthernet0/0/4]q [SW1]interface GigabitEthernet 0/0/3 [SW1-GigabitEthernet0/0/3]port link-type access [SW1-GigabitEthernet0/0/3]port default vlan 172 [SW1-GigabitEthernet0/0/3]q [SW1]interface GigabitEthernet 0/0/1 [SW1-GigabitEthernet0/0/1]port link-type access [SW1-GigabitEthernet0/0/1]port default vlan 100 [SW1-GigabitEthernet0/0/1]q
2、新增路由
[SW1]ip route-static 0.0.0.0 0.0.0.0 100.100.100.2
FW1防火牆
1、配置介面IP地址
<SRG>system-view [SRG]sysname FW1 [FW1]interface GigabitEthernet 0/0/1 [FW1-GigabitEthernet0/0/1]ip address 100.100.100.2 24 [FW1-GigabitEthernet0/0/1]q [FW1]interface GigabitEthernet 0/0/2 [FW1-GigabitEthernet0/0/2]ip address 201.201.201.1 24 [FW1-GigabitEthernet0/0/2]q [FW1]interface GigabitEthernet 0/0/3 [FW1-GigabitEthernet0/0/3]ip address 202.202.202.1 24 [FW1-GigabitEthernet0/0/3]q
2、介面加入對應安全區域
[FW1]firewall zone trust
[FW1-zone-trust]add interface GigabitEthernet 0/0/1
[FW1-zone-trust]q
[FW1]firewall zone untrust
[FW1-zone-untrust]add interface GigabitEthernet 0/0/2
[FW1-zone-untrust]add interface GigabitEthernet 0/0/3
[FW1-zone-untrust]q
3、配置域間安全策略,允許內網指定網點與公網進行報文互動,並拒絕指定內網IP不能與公網通訊
[FW1]policy interzone trust untrust outbound
[FW1-policy-interzone-trust-untrust-outbound]policy 1
[FW1-policy-interzone-trust-untrust-outbound-1]policy source 192.168.1.20 0
[FW1-policy-interzone-trust-untrust-outbound-1]action deny
[FW1-policy-interzone-trust-untrust-outbound-1]q
[FW1-policy-interzone-trust-untrust-outbound]policy 2
[FW1-policy-interzone-trust-untrust-outbound-2]policy source 192.168.0.0 mask 16
[FW1-policy-interzone-trust-untrust-outbound-2]action permit
[FW1-policy-interzone-trust-untrust-outbound-2]q
[FW1-policy-interzone-trust-untrust-outbound]policy 3
[FW1-policy-interzone-trust-untrust-outbound-3]policy source 172.16.0.0 mask 16
[FW1-policy-interzone-trust-untrust-outbound-3]action permit
[FW1-policy-interzone-trust-untrust-outbound-3]q
[FW1-policy-interzone-trust-untrust-outbound]q
這裡需要注意的是策略的執行順序,預設是按照配置的先後順序,而不是policy數字的大小。所以如果拒絕動作是後來才配置的,需要移動策略的順序。(執行命令policy move policy-id1 { before | after } policy-id2,調整策略優先順序。)
4、配置NAT地址池,並允許埠轉換,實現公網地址複用
[FW1]nat address-group 172 202.202.202.3 202.202.202.6
5、配置源NAT策略,實現內網指定網段訪問公網時自動進行源地址轉換
[FW1]nat-policy interzone trust untrust outbound
[FW1-nat-policy-interzone-trust-untrust-outbound]policy 1
[FW1-nat-policy-interzone-trust-untrust-outbound-1]action source-nat
[FW1-nat-policy-interzone-trust-untrust-outbound-1]policy source 192.168.0.0 mask 16
[FW1-nat-policy-interzone-trust-untrust-outbound-1]easy-ip GigabitEthernet 0/0/2
[FW1-nat-policy-interzone-trust-untrust-outbound-1]q
[FW1-nat-policy-interzone-trust-untrust-outbound]policy 2
[FW1-nat-policy-interzone-trust-untrust-outbound-2]action source-nat
[FW1-nat-policy-interzone-trust-untrust-outbound-2]policy source 172.16.0.0 mask 16
[FW1-nat-policy-interzone-trust-untrust-outbound-2]address-group 172
[FW1-nat-policy-interzone-trust-untrust-outbound-2]q
[FW1-nat-policy-interzone-trust-untrust-outbound]q
6、在防火牆配置預設路由,使內網流量可以正常傳送至ISP路由器
[FW1]ip route-static 0.0.0.0 0.0.0.0 201.201.201.2
[FW1]ip route-static 0.0.0.0 0.0.0.0 202.202.202.2
[FW1]ip route-static 192.168.0.0 16 100.100.100.1
[FW1]ip route-static 172.16.0.0 16 100.100.100.1
三、檢視防火牆驗證
1、防火牆NAT轉發記錄
[FW1]display firewall session table
16:37:35 2018/08/05
Current Total Sessions : 10
icmp VPN:public --> public 172.16.1.10:19639[202.202.202.6:2079]-->203.203.203.10:2048
icmp VPN:public --> public 172.16.1.10:19895[202.202.202.6:2080]-->203.203.203.10:2048
icmp VPN:public --> public 172.16.1.10:20151[202.202.202.6:2081]-->203.203.203.10:2048
icmp VPN:public --> public 172.16.1.10:20407[202.202.202.6:2082]-->203.203.203.10:2048
icmp VPN:public --> public 172.16.1.10:20663[202.202.202.6:2083]-->203.203.203.10:2048
icmp VPN:public --> public 192.168.1.10:22455[201.201.201.1:2123]-->203.203.203.10:2048
icmp VPN:public --> public 192.168.1.10:22711[201.201.201.1:2124]-->203.203.203.10:2048
icmp VPN:public --> public 192.168.1.10:23223[201.201.201.1:2125]-->203.203.203.10:2048
icmp VPN:public --> public 192.168.1.10:23479[201.201.201.1:2126]-->203.203.203.10:2048
icmp VPN:public --> public 192.168.1.10:23735[201.201.201.1:2127]-->203.203.203.10:2048
2、域間安全策略命中次數,可以看到允許通過的IP次數和拒絕IP(192.268.1.20)的次數為5
[FW1]display policy interzone trust untrust outbound
16:40:33 2018/08/05
policy interzone trust untrust outbound
firewall default packet-filter is deny
policy 1 (5 times matched)
action deny
policy service service-set ip
policy source 192.168.1.20 0
policy destination any
policy 2 (80 times matched)
action permit
policy service service-set ip
policy source 192.168.0.0 mask 16
policy destination any
policy 3 (38 times matched)
action permit
policy service service-set ip
policy source 172.16.0.0 mask 16
policy destination any
四、補充說明
1、就算域間策略預設規則是放通的,但是如果手動指定的拒絕通過,還是無法訪問的,比如trunk到untrunk 預設是允許的
[FW1]firewall packet-filter default permit interzone trust untrust direction outbound
但是還是會被拒絕,可以看到拒絕命中條目增加了
[FW1]display policy interzone trust untrust outbound
17:09:35 2018/08/05
policy interzone trust untrust outbound
firewall default packet-filter is permit
policy 1 (34 times matched)
action deny
policy service service-set ip
policy source 192.168.1.20 0
policy destination any
policy 2 (80 times matched)
action permit
policy service service-set ip
policy source 192.168.0.0 mask 16
policy destination any
policy 3 (38 times matched)
action permit
policy service service-set ip
policy source 172.16.0.0 mask 16
policy destination any