天天看點

Juniper SRX防火牆-NAT(二)

SRX 防火牆NAT配置

為什麼位址轉換

NAT主要提供公網、私網IP位址之間的轉換,同時也支援端口轉換

Juniper SRX防火牆-NAT(二)

NAT路由缺失、路由沖突時,可以通過轉換位址來解決

Juniper SRX防火牆-NAT(二)

安全考慮,對外隐藏伺服器真實IP

SRX封包處理過程

Juniper SRX防火牆-NAT(二)
Juniper SRX防火牆-NAT(二)

NAT轉換位址必須知道

我們需要第一步先确認、規劃好對外提供轉換的虛IP,(比如說公網IP)

Juniper SRX防火牆-NAT(二)
Juniper SRX防火牆-NAT(二)

Ø 一對一伺服器端口映射:适用于就一台伺服器,對外提供多個服務功能;

問題:不能從外網管理防火牆咧!

Ø 基于端口伺服器端口映射:适用于多台伺服器,分别對外提供多個服務功能;

可以對多台伺服器來做,外網端口和伺服器端口可以不一樣!

Ø 内網通路公網,源NAT,即将内網位址轉換為公網接口位址通路公網

注意:一個公網位址隻能支援最大64000個會話

Juniper SRX防火牆-NAT(二)

當NAT的公網位址和公網接口是在同一網段時,需要啟用NAT Proxy ARP,使得SRX對端裝置能夠解析到此公網位址的MAC address,便于傳回封包能夠正常發送至SRX防火牆

Proxy ARP

Juniper SRX防火牆-NAT(二)

當我們的公網接口位址不夠用,或同段位址用完了,我們需要再向營運商申請一些公網,這些位址與接口位址,不在同一個子網段。

對端需要将本段路由指向防火牆外網接口IP牆上不需要做其他處理,可直接NAT

[edit security nat]

user@host# show

proxy-arp {

interface ge-0/0/3.10 {

address {

1.1.70.10/32 to

1.1.70.100/32;

}

Juniper SRX防火牆-NAT(二)

網絡位址轉換

Juniper SRX防火牆-NAT(二)

NAT類型

兩種類型的 NAT和PAT:

• 基于目的位址的NAT:包括目的位址及端口的轉換

• 基于源位址的NAT:包括源IP位址及端口的轉換

目的及源NAT、PAT的組合

動态與靜态的位址轉換

Juniper SRX防火牆-NAT(二)

SRX還提供第三種NAT:Static NAT

靜态位址翻譯:提供雙向NAT功能,由source static nat與destination static nat組合而成

Juniper SRX防火牆-NAT(二)

目的NAT

目的NAT的兩種類型:

• Static NAT:此為1對1的位址映射,此NAT沒有PAT端口轉換

• Rule-based NAT:基于動态位址池的位址映射,此NAT選擇是否做PAT端口轉換

VoIP ALGs 會動态産生allow-incoming表來允許資料進入内部網絡

Juniper SRX防火牆-NAT(二)

靜态目的位址轉換

Sample topology:

Juniper SRX防火牆-NAT(二)

 Enable static destination NAT to host A using a public address of 100.0.0.1/32

将内網主機10.1.10.5與公網IP位址100.0.0.1綁定做一對一的靜态映射

一對一的位址轉換,在NETSCREEN中稱之為MIP

具體配置如下,destination-address定義為公網IP位址

[edit security]

nat {

static {

rule-set r1 {

from zone untrust;

rule a {

match {

destination-address 100.0.0.1/32;

then {

static-nat prefix 10.1.10.5/32;

Juniper SRX防火牆-NAT(二)

set interfaces ge-0/0/0 unit 0 family inetaddress 222.0.0.1/27

set interfaces ge-0/0/1 unit 0 family inetaddress 192.168.1.1/24

set security natproxy-arpinterface ge-0/0/0.0 address 222.0.0.8/32

set security natproxy-arpinterface ge-0/0/0.0 address 222.0.0.7/32

set security zones security-zone untrustinterfaces ge-0/0/0.0 host-inbound-traffic system-services all

set security zones security-zone trust interfaces ge-0/0/1.0 host-inbound-traffic system-services all

set security natstaticrule-set static-natfrom zone untrust

set security nat static rule-set static-natrule 1 match destination-address222.0.0.6/32

set security nat static rule-set static-natrule 1 then static-natprefix 192.168.1.6/32

set security natstaticrule-set static-natrule 2 match destination-address222.0.0.7/32

set security natstaticrule-set static-natrule 2 then static-natprefix 192.168.1.7/32

set security natstaticrule-set static-natrule 3 match destination-address222.0.0.8/32

set security natstaticrule-set static-natrule 3 then static-natprefix 192.168.1.8/32

show security nat static rule 3

檢視NAT對應關系 ,驗證NAT是否被外網發起通路起命中,以排隊故障

Juniper SRX防火牆-NAT(二)
Juniper SRX防火牆-NAT(二)

Reverse static source

NAT is automatically enabled:

内網主機192.168.1.8如果發起通路外網的請求,IP位址自動轉換為222.0.0.8

Session is not created

until triggered NAT與會話無直接關系,隻有會話發起建立才能看到

Juniper SRX防火牆-NAT(二)