SRX所使用的地址池使用的地址在SRX是虚拟的,它不是一个真正物理存在的。那么这个地址的可达性必然依赖于简单的IP路由查找。SRX也支持将自己的物理接口配置到Pool中,如图5-8

Figure5-8. Source NAT with ProxyARP

为保证这些Pool的可达性,Proxy ARP功能使能。由于Pool内有可路由的IP网络(或者SRX设备本身是不可达),关键是要在以太网层面(二层)提供可达性,而不是IP层的可达性。

最后一跳IP路由设备必须在本地以太网络上发送一个ARP请求,以获得MAC地址。Proxy ARP功能可以让SRX设备上代表Pool内地址回应这些ARP请求。在这样做时,SRX设备提供其自己的MAC地址作为数据包在以太网层目的地发送到池地址的IP层。一旦报文被接收时,SRX设备继续流处理为正常。

代理ARP配置

james@SRX5800-1>edit

Enteringconfigurationmode

[edit]

james@SRX5800-1# edit  security natsource

[editsecurity natsource]

james@SRX5800-1# set  pool phyPool  address  198.18.5.64/27

创建一个新的rule-set应用这个Pool

[edit]

james@SRX5800-1#editrule-set Dept-B-to-Inet

对来自Dept-B zone的流量进行匹配:

[editsecurity nat source rule-setDept-B-to-Inet]

james@SRX5800-1#set  from   zone Dept-B

目的是Inet zone:

[editsecuritynatsourcerule-setDept-B-to-Inet]

james@SRX5800-1# set  to zone Inet

下面在rule层级下进行配置:

[editsecuritynatsourcerule-setDept-B-to-Inet]

james@SRX5800-1# editrulephypoolNAT

对源地址10.2.0.0/16的流量进行匹配:

[editsecurity nat source rule-set Dept-B-to-Inet rulephypoolNAT]

james@SRX5800-1#  set   match  source-address  10.2/16

配置source natAction

[editsecurity nat source rule-set Dept-B-to-Inet rulephypoolNAT]

james@SRX5800-1#set  then   source-nat   phyPool

[editsecurity nat source rule-set Dept-B-to-Inet rulephypoolNAT]

james@SRX5800-1#up 3

Inet zone ge-0/0/2.0 interface198.18.5.64/27range配置Proxy ARP

[editsecurity nat]

james@SRX5800-1#set proxy-arp interface ge-0/0/2.0 address198.18.5.64/27

[editsecuritynat]

james@SRX5800-1#show |compare

[editsecurity natsource] pool ipPool { ...}

+     pool phyPool{

+            address{

+                   198.18.5.64/27;

+            }

+     }

[editsecurity natsource]

rule-setDept-A-to-Inet { ...}

+     rule-set Dept-B-to-Inet{

+            from zoneDept-B;

+            to zoneweb-dmz;

+            rule phypoolNAT{

+                   match{

+                          source-address198.18.11.0/24;

+                   }

+                   then{

+                          source-nat{

+                                  pool{

+                                         phyPool;

+                                  }

+                          }

+                   }

+            }

+     }

[editsecuritynat]

+  proxy-arp{

+          interface ge-0/0/2.0{

+                  address{

+                         198.18.5.64/27;

+                  }

+          }

+}

 [edit securitynat]

james@SRX5800-1#commit and-quit

configurationchecksucceeds commit complete

Exitingconfiguration mode

james@SRX5800-1>

来自Dept-B zone10.2.0.0/16流量去往net zone的流量将被翻译为198.18.5.64/27,该地址池存在于egress Inet zone network

当在GE-0/0/2.0接口上收到对198.18.5.64/27ARP请求时,设备SRX将对其应答。

查看代理ARP:

可以看到一条flow通过新的rule-set进行了翻译:

james@SRX5800-1>show  security flow  session

SessionID: 2336, Policy name: webdmz_mgt/8, Timeout:1796

In:10.2.1.15/49842 --> 198.18.200.1/80;tcp, If:ge-0/0/0.0

Out:198.18.200.1/80 --> 198.18.5.78/2615;tcp, If:ge-0/0/2.0

1sessionsdisplayed james@SRX5800-1>

在此,内部源IP地址10.2.1.15被转换为198.18.5.78池地址(在Out返回方向可见),而源端口是从49842翻译到2615(因为它没有明确禁用)。该流量相应的日志是:

james@SRX5800-1>show  logtraffic-log

Jan19 09:41:59 SRX210 RT_FLOW: RT_FLOW_SESSION_CREATE: sessioncreated10.2.1.15/49842->198.18.200.1/80junos-http198.18.5.78/2615->198.18.200.1/80

phypoolNATNone 6 webdmz_mgt Dept-B web-dmz2336

james@SRX5800-1>

此会话初始化日志条目显示翻译内部源IP地址和端口从10.2.1.1549842198.18.5.782615公共地址和端口,它也显示了匹配NAT规则(phypoolNAT)。

通过show命令查看rule

james@SRX5800-1>show security  nat  source rule phypoolNAT

source NAT rule:phypoolNAT                         Rule-set:Dept-B-to-InetRule-Id       2

Ruleposition                                1

Fromzone                                :Dept-B

Tozone                                    :Inet

Match

Sourceaddresses                  :198.18.5.64            -198.18.5.95 Action     :phyPool

PersistentNATtype              :N/AInactivitytimeout               0

Max sessionnumber                0

Translationhits                            1

james@SRX5800-1>

    新的地址池:

james@SRX5800-1>showsecurity nat source pool  all

Totalpools:1

Poolname                  :phyPool

Poolid                           5

Routinginstance         :default Host address base  :0.0.0.0

Port                           : [1024,63487]

Totaladdresses              32

Translationhits              1

Addre***ange                                            SinglePorts         TwinPorts 198.18.5.64 -198.18.5.95                 1                                                              0

james@SRX5800-1>