FGT透明模式下IPSecVPN应用场景测试-构建全场景安全加密通道
目录
3.1.3 调整IPSec VPN Vdom为透明模式并设置管理IP
3.1.5 分配把vlan接口添加到IPsec
VPN Vdom
3.3 防火墙策略控制需要加密的流进入IPSec VPN隧道
4.1.2 创建IPSec VPN Vdom并设置为透明模式
4.1.4 分配把vlan接口添加到IPsec
VPN Vdom
4.2.1 启用Web界面上支持基于策略IPsec
VPN(略)
原有拓扑:
PC1(30.30.30.x)----R1_20.20.20.1/30----专线 -----20.20.20.2/30_R2------PC2(40.40.40.2)
专线两端经过R1和R2路由器互联。
现有拓扑:
现在要求R1和R2转发的流量30.30.30.x和40.40.40.x在透明的在专线上加密,且现网IP地址上不需要任何改变。
PC1(30.30.30.x)----R1_20.20.20.1/30----FW1(10.10.10.1)—IPSecVPN--------FW2(10.10.10.2)-----20.20.20.2/30_R2------PC2(40.40.40.2)
其中FW1和FW2 是透明模式。我们可以简单的认为FW1是中心端防火墙墙,FW2是分支端防火墙,与FW2角色相同的有很多。
中心端FW1和FW2等其它分支端FW二层互通,其它各分支通过VLAN隔离。(本质上不需要vlan,因为一个项目需要这样做,所以配置中涉及到了vlan)
所以每一个分支FW与中心端的FW在一个独立的vlan中。
FW1 FW2是透明墙,用管理管理IP(10.10.10.x段)用来做VPN隧道端点IP。
1. 为方便管理,把需要加密的流量放到新创建透明IPSec VPN Vdom(当然也可以不创建Vdom,使用全局透明模式)
2. 加密:透明模式下基于策略把需要加密的流量进入IPsec隧道
3. 解密:VPN解密后,因为目的MAC地址是空的,涉及到三层数据包需要封装成二层帧落地问题,此时会查找该解密后的流送给哪一个下一跳,根据路由表找到下一跳地址,然后封装成二层帧时会把目的mac写成下一跳的。
4. 透明域下可以配置路由,管理IP可以和默认网关不在同一个三层IP网段中。
config system global
set vdom-admin enable //启用VDOM
end
IPSec VPN Vdom 的名字为Vdom-10
FW1 # config Vdom
FW1 (Vdom) # edit Vdom-10
current vf=Vdom-10:3
FW1 (Vdom-10) # config system settings
FW1 (settings) # set opmode
nat Change to NAT mode.
transparent Change to transparent mode.
FW1 (settings) # set opmode transparent //设置该Vdom为透明模式
FW1 (settings) # set manageip 10.10.10.1/24//设置管理IP
FW1 (settings) # set gateway 20.20.20.1 //设置默认网关。VPN解密后送给的下一跳
FW1 (settings) # show
config system settings
set opmode transparent
set inspection-mode flow
set manageip 10.10.10.1/255.255.255.0
set gateway 20.20.20.1
end
FW1 (settings) # end
查看路由,会自动添加默认路由配置
FW1 (Vdom-10) # show router static
config router static
edit 1
set gateway 20.20.20.1
next
end
透明模式下,设置透明模式的同时会让设置一个默认网关,即这个配置会自动生成一条默认路由:
FW1 (Vdom-10) # show router static
config router static
edit 1
set gateway 20.20.20.1(中心端路由器接口IP)
next
end
当然,也可以根据需要手工指定明细的静态路由。
全局下配置Vdom-10的成员接口:vlan10
在物理接口port3创建vlan接口
在物理接口port4创建vlan接口
切换后Vdom-10虚拟域
能够看到两个口在属于该Vdom
需要注意需要退出后再登录一下设备,这样创建的IPsec VPN才是基于策略模式的。
IP地址为对端管理IP
注意:防火墙策略会把匹配的流送进IPsec VPN隧道,同时需要注意,也要启用【允许从远端站点发起流量】,放行主动过来的IPSEVPN隧道内的流量。
分支端可以不启用Vdom,把整机调整透明模式,本文也把分支设备启用了Vdom
分支端可以启用Vdom,并创建一个Vdom 为透明Vdom
我们成为为Vdom-10,并设置管理IP为10.10.10.2
FW2 # config Vdom
FW2 (Vdom) # edit Vdom-10
current vf=Vdom-10:3
FW2 (Vdom-10) # config system settings
FW2 (settings) # set opmode transparent //设置该Vdom为透明模式
FW2 (settings) # set manageip 10.10.10.2/24//设置管理IP
FW2 (settings) # set gateway 20.20.20.2 //设置默认网关。VPN解密后送给的下一跳
FW2 (settings) # show
config system settings
set opmode transparent
set inspection-mode flow
set manageip 10.10.10.2 255.255.255.0
set gateway 20.20.20.2
end
FW2 (Vdom-10) # show router static
config router static
edit 1
set gateway 20.20.20.2
next
end
在设置透明模式的时候设置了网关自动生成了默认路由。
config router static
edit 1
set gateway 20.20.20.2//设置默认网关,VPN解密后送给的下一跳
next
end
IP地址为对端管理IP
我们在FW1 和FW2 墙的Root Vdom启用lookback口进行测试。
即模拟以下的场景
PC1(30.30.30.x)----R1_20.20.20.1/30----FW1(10.10.10.1)—IPsecVPN----FW2(10.10.10.2)-----20.20.20.2/30_R2------PC2(40.40.40.2)
其中FW1和FW2 是透明模式。
FW1和FW2 透明Vdom 建立了IPSec VPN。
中心端墙模拟PC1和R1部分配置:
² Lookback口
config
system interface
edit "lookback"
set Vdom "root"
set ip 30.30.30.1 255.255.255.0
set allowaccess ping https http fgfm
set type loopback
set snmp-index 28
next
end
² R1与R2的互联接口:
config system interface
edit "vlan10"
set Vdom "root"
set ip 20.20.20.1 255.255.255.252
set allowaccess ping https http
set role lan
set snmp-index 27
set interface "port5"
set vlanid 10
next
end
² R1和R2的互联路由:
config
router static
edit 1
set gateway 20.20.20.2
set device "vlan10"
next
end
中心端墙模拟PC2和R1部分配置:
² Lookback口
config system
interface
edit "lookback"
set Vdom "root"
set ip 40.40.40.1 255.255.255.0
set allowaccess ping
set type loopback
set snmp-index 10
next
end
² R2与R1的互联接口:
config
system interface
edit "vlan10"
set Vdom "root"
set ip 20.20.20.2 255.255.255.252
set allowaccess ping
set role lan
set snmp-index 9
set interface "wan2"
set vlanid 10
next
end
² R1和R2的互联路由:
config
router static
edit 1
set gateway 20.20.20.1
set device "vlan10"
next
end
FW1 (Vdom-10) # diagnose vpn ike gateway list
vd:
Vdom-10/1
name: v1
version:
1
interface: 0
addr:
10.10.10.1:500 -> 10.10.10.2:500
created:
1359s ago
auto-discovery:
0
IKE SA:
created 1/1 established 1/1 time 10/10/10 ms
IPsec SA: created 1/1 established 1/1 time 10/10/10 ms
id/spi: 2 67f3a45ff45f18a4/fd59511768084932
direction: responder
status: established 1359-1359s ago = 10ms
proposal: aes256-sha256
key:
e41d656ae790e618-de8ea39ae1dcbed3-45f5f46760043ad3-985fb191942e7a53
lifetime/rekey: 86400/84770
DPD sent/recv: 00000000/00000000
FW1
(Vdom-10) # diagnose vpn tunnel list
list all
ipsec tunnel in vd 1
------------------------------------------------------
name=v1
ver=1 serial=1 10.10.10.1:0->10.10.10.2:0
bound_if=0
lgwy=static/1 tun=tunnel/1 mode=auto/1 encap=none/8 options[0008]=npu
proxyid_num=1
child_num=0 refcnt=11 ilast=2 olast=1 ad=/0 itn-status=24
stat:
rxp=8659 txp=8671 rxb=384231 txb=322070
dpd:
mode=on-idle on=1 idle=20000ms retry=3 count=0 seqno=6
natt:
mode=none draft=0 interval=0 remote_port=0
proxyid=v1p2
proto=0 sa=1 ref=7 serial=1
src: 0:0.0.0.0/0.0.0.0:0
dst: 0:0.0.0.0/0.0.0.0:0
SA: ref=6 options=10224 type=00 soft=0 mtu=1438 expire=41565/0B replaywin=0
seqno=1207 esn=0
replaywin_lastseq=00000000 itn=0
life: type=01 bytes=0/0 timeout=42928/43200
dec: spi=fedecf70 esp=aes key=32
b334595d4b79d883c36458e234756beceeeff2d47912120e5839ed21136cd762
ah=sha256 key=32
5d243eb36f9afddd893abd91592c6e0ac82f41ab4323c1a8939f057f66c869dc
enc: spi=460fd074 esp=aes key=32
4a0ab8c7b1f33c0eb348685994717f676cea51952f406f8426370493157d19d2
ah=sha256 key=32
227956ca4eebcbd34fa761b205b55c1566a7aa0649491a1253255c856ca8aeef
dec:pkts/bytes=4098/16552,
enc:pkts/bytes=8670/636973
npu_flag=03
npu_rgwy=10.10.10.2 npu_lgwy=10.10.10.1 npu_selid=0 dec_npuid=1 enc_npuid=1
F FW2 (Vdom-10) # diagnose vpn ike gateway list
vd:
Vdom-10/1
name: v1
version:
1
interface: 0
addr:
10.10.10.2:500 -> 10.10.10.1:500
created:
1307s ago
auto-discovery:
0
IKE SA:
created 1/1 established 1/1 time 10/10/10 ms
IPsec SA: created 1/1 established 1/1 time 10/10/10 ms
id/spi: 30187 67f3a45ff45f18a4/fd59511768084932
direction: initiator
status: established 1307-1307s ago = 10ms
proposal: aes256-sha256
key:
e41d656ae790e618-de8ea39ae1dcbed3-45f5f46760043ad3-985fb191942e7a53
lifetime/rekey: 86400/84792
DPD sent/recv: 00000000/00000000
FW2
(Vdom-10) # diagnose vpn tunnel list
list all
ipsec tunnel in vd 1
------------------------------------------------------
name=v1
ver=1 serial=1 10.10.10.2:0->10.10.10.1:0
bound_if=0
lgwy=static/1 tun=tunnel/1 mode=auto/1 encap=none/8 options[0008]=npu
proxyid_num=1
child_num=0 refcnt=11 ilast=1 olast=1 ad=/0 itn-status=0
stat:
rxp=4368 txp=4226 rxb=657640 txb=327932
dpd:
mode=on-idle on=1 idle=20000ms retry=3 count=0 seqno=1
natt:
mode=none draft=0 interval=0 remote_port=0
proxyid=v1p2
proto=0 sa=1 ref=2 serial=1 auto-negotiate
src: 0:0.0.0.0/0.0.0.0:0
dst: 0:0.0.0.0/0.0.0.0:0
SA: ref=10 options=18225 type=00 soft=0 mtu=1438 expire=41585/0B replaywin=0
seqno=10f9 esn=0
replaywin_lastseq=00000000 itn=0
life: type=01 bytes=0/0 timeout=42897/43200
dec: spi=460fd074 esp=aes key=32
4a0ab8c7b1f33c0eb348685994717f676cea51952f406f8426370493157d19d2
ah=sha256 key=32
227956ca4eebcbd34fa761b205b55c1566a7aa0649491a1253255c856ca8aeef
enc: spi=fedecf70 esp=aes key=32
b334595d4b79d883c36458e234756beceeeff2d47912120e5839ed21136cd762
ah=sha256 key=32
5d243eb36f9afddd893abd91592c6e0ac82f41ab4323c1a8939f057f66c869dc
dec:pkts/bytes=4368/656552,
enc:pkts/bytes=8559/914180
npu_flag=03 npu_rgwy=10.10.10.1
npu_lgwy=10.10.10.2 npu_selid=0
测试:
FW2
(root) # execute ping-options
source 40.40.40.1
FW2 (root) # execute ping-options repeat-count 1
FW2
(root) # execute ping 30.30.30.1
PING
30.30.30.1 (30.30.30.1): 56 data bytes
64 bytes from 30.30.30.1: icmp_seq=0 ttl=255 time=0.8 ms
--- 30.30.30.1
ping statistics ---
1 packets
transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.8/0.8/0.8 ms
可以看到可以ping通40.40.40.1
执行ping 中心端地址:30.30.30.1
FW2
(root) # execute ping-options
source 40.40.40.1
FW2 (root) # execute ping-options repeat-count 1
FW2
(root) # execute ping 30.30.30.1
PING
30.30.30.1 (30.30.30.1): 56 data bytes
64 bytes from 30.30.30.1: icmp_seq=0 ttl=255 time=0.8 ms
---
30.30.30.1 ping statistics ---
1 packets
transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.8/0.8/0.8 ms
可以看到可以ping通40.40.40.1
通过debug跟踪数据包流转:
id=20085
trace_id=14 func=print_pkt_detail line=5296 msg="vd-Vdom-10 received a
packet(proto=1, 40.40.40.1:6656->30.30.30.1:2048) from vlan10-dmz. type=8,
code=0, id=6656, seq=0."
id=20085
trace_id=14 func=init_ip_session_common line=5455 msg="allocate a new
session-000a5e27"
id=20085
trace_id=14 func=iprope_dnat_check line=4732 msg="in-[vlan10-dmz],
out-[]"
id=20085
trace_id=14 func=iprope_dnat_check line=4745 msg="result:
skb_flags-01800000, vid-0, ret-no-match, act-accept, flag-00000000"
id=20085
trace_id=14 func=iprope_fwd_check line=716 msg="in-[vlan10-dmz],
out-[vlan10.wan1], skb_flags-01800000, vid-0, app_id: 0, url_cat_id: 0"
id=20085
trace_id=14 func=__iprope_tree_check line=545 msg="gnum-100004, use
addr/intf hash, len=2"
id=20085
trace_id=14 func=__iprope_check_one_policy line=1735 msg="checked
gnum-100004 policy-1, ret-matched, act-accept"
id=20085
trace_id=14 func=__iprope_user_identity_check line=1563
msg="ret-matched"
id=20085
trace_id=14 func=__iprope_check line=1970 msg="gnum-4e20,
check-f8adcdf0"
id=20085
trace_id=14 func=__iprope_check_one_policy line=1735 msg="checked
gnum-4e20 policy-6, ret-no-match, act-accept"
id=20085
trace_id=14 func=__iprope_check_one_policy line=1735 msg="checked
gnum-4e20 policy-6, ret-no-match, act-accept"
id=20085
trace_id=14 func=__iprope_check_one_policy line=1735 msg="checked
gnum-4e20 policy-6, ret-no-match, act-accept"
id=20085
trace_id=14 func=__iprope_check line=1989 msg="gnum-4e20 check result:
ret-no-match, act-accept, flag-00000000, flag2-00000000"
id=20085
trace_id=14 func=__iprope_check_one_policy line=1941 msg="policy-1 is
matched, act-accept"
id=20085
trace_id=14 func=iprope_fwd_auth_check line=771 msg="after
iprope_captive_check(): is_captive-0, ret-matched, act-accept, idx-1"
id=20085 trace_id=14
func=br_fw_forward_handler line=530 msg="Allowed by Policy-1:
encrypt"
id=20085 trace_id=14
func=ipsec_tunnel_output4 line=1223 msg="enter IPsec tunnel-v1"
id=20085 trace_id=14
func=esp_output4 line=1178 msg="IPsec encrypt/auth"
id=20085
trace_id=14 func=__if_queue_push_xmit line=376 msg="send out via
dev-vlan10.wan1, dst-mac-70:4c:a5:a4:eb:3e"
可以看到命中了 防火墙策略ID 1,进入了IPSec VPN隧道封装,而不是走的underlay路由的路径。
config
firewall policy
edit 1
set name "ipsecvpn"
set uuid
5c0e34fa-d716-51ea-8b63-30d8ed0fc4b6
set srcintf "vlan10-dmz"
set dstintf "vlan10.wan1"
set srcaddr "all"
set dstaddr "all"
set action ipsec
set schedule "always"
set service "ALL"
set inbound enable
set vpntunnel "v1"
next
end
收到被动回包解密过程:
id=20085
trace_id=29 func=print_pkt_detail line=5296 msg="vd-Vdom-10 received a
packet(proto=1, 30.30.30.1:9728->40.40.40.1:0) from vlan10.wan1. type=0,
code=0, id=9728, seq=0."
id=20085
trace_id=29 func=resolve_ip_tuple_fast line=5371 msg="Find an existing
session, id-000a720e, reply direction"
id=20085
trace_id=29 func=npu_handle_session44 line=917 msg="Trying to offloading
session from vlan10.wan1 to vlan10-dmz, skb.npu_flag=00000000
ses.state=00018210 ses.npu_state=0x00000000"
id=20085 trace_id=29 func=__if_queue_push_xmit line=376 msg="send out via dev-vlan10-dmz, dst-mac-08:5b:0e:19:49:55"
插入目标mac地址08:5b:0e:19:49:55
FW2 (Vdom-10) # get system arp
Address Age(min) Hardware Addr Interface
20.20.20.2 11 08:5b:0e:19:49:55 Vdom-10.b
10.10.10.1 11 70:4c:a5:a4:eb:3e Vdom-10.b
这是因为查到路由的下一跳是20.20.20.2,所以二层帧的目的mac是08:5b:0e:19:49:55。
FW1 (Vdom-10) # diagnose debug flow filter addr 40.40.40.1
FW1
(Vdom-10) # diagnose debug flow show function-name enable
show function name
FW1
(Vdom-10) # diagnose debug flow show
function-name Enable/disable display function name.
iprope Enable/disable trace iprope match.
FW1 (Vdom-10) # diagnose debug flow trace start 10
FW1
(Vdom-10) # diagnose debug enable
id=20085
trace_id=29 func=print_pkt_detail line=5347 msg="vd-Vdom-10 received a
packet(proto=1, 40.40.40.1:9472->30.30.30.1:2048) from vlan10-port4. type=8,
code=0, id=9472, seq=0."
id=20085
trace_id=29 func=init_ip_session_common line=5506 msg="allocate a new
session-0000d73f"
70.119406
40.40.40.1 -> 30.30.30.1: icmp: echo request
70.119438
40.40.40.1 -> 30.30.30.1: icmp: echo request
70.119439
40.40.40.1 -> 30.30.30.1: icmp: echo request
70.119446
40.40.40.1 -> 30.30.30.1: icmp: echo request
70.119497
30.30.30.1 -> 40.40.40.1: icmp: echo reply
70.119498
30.30.30.1 -> 40.40.40.1: icmp: echo reply
70.119506
30.30.30.1 -> 40.40.40.1: icmp: echo reply
id=20085
trace_id=29 func=iprope_dnat_check line=4748 msg="in-[vlan10-port4],
out-[]"
id=20085
trace_id=29 func=iprope_dnat_check line=4761 msg="result:
skb_flags-06000008, vid-0, ret-no-match, act-accept, flag-00000000"
id=20085
trace_id=29 func=iprope_fwd_check line=712 msg="in-[vlan10-port4],
out-[vlan10-port3], skb_flags-06000008, vid-0, app_id: 0, url_cat_id: 0"
id=20085
trace_id=29 func=__iprope_check line=2178 msg="gnum-100003,
check-ffffffffa00258a0"
id=20085
trace_id=29 func=__iprope_check_one_policy line=1942 msg="checked
gnum-100003 policy-1, ret-matched, act-drop"
id=20085
trace_id=29 func=__iprope_user_identity_check line=1769
msg="ret-matched"
id=20085
trace_id=29 func=__iprope_check line=2178 msg="gnum-4e20,
check-ffffffffa00258a0"
id=20085
trace_id=29 func=__iprope_check_one_policy line=1942 msg="checked
gnum-4e20 policy-6, ret-no-match, act-drop"
id=20085
trace_id=29 func=__iprope_check_one_policy line=1942 msg="checked
gnum-4e20 policy-6, ret-no-match, act-drop"
id=20085
trace_id=29 func=__iprope_check_one_policy line=1942 msg="checked
gnum-4e20 policy-6, ret-no-match, act-drop"
id=20085
trace_id=29 func=__iprope_check line=2197 msg="gnum-4e20 check result:
ret-no-match, act-drop, flag-00000000, flag2-00000000"
id=20085 trace_id=29
func=__iprope_check_one_policy line=2149 msg="policy-1 is matched,
act-accept"
id=20085 trace_id=29
func=__iprope_check line=2197 msg="gnum-100003 check result: ret-matched,
act-accept, flag-08010880, flag2-00004000"
id=20085 trace_id=29
func=iprope_policy_group_check line=4158 msg="after check: ret-matched,
act-accept, flag-08010880, flag2-00004000"
id=20085 trace_id=29
func=br_fw_forward_handler line=536 msg="Allowed by Policy-1:"
id=20085 trace_id=29 func=__if_queue_push_xmit line=367 msg="send out via dev-vlan10-port3, dst-mac-70:4c:a5:a4:eb:40"
解密后的重新封装成二层帧目的mac地址:70:4c:a5:a4:eb:40,通过查ARP表可以看到是默认路由下一条20.20.20.1的mac地址。
FW1
(Vdom-10) # get system arp
Address Age(min) Hardware Addr Interface
20.20.20.1 1 70:4c:a5:a4:eb:40 Vdom-10.b
10.10.10.2 60 08:5b:0e:19:49:53 Vdom-10.b
Mac地址表:
FW1
(global) # diagnose netlink brctl name host Vdom-10.b
show
bridge control interface Vdom-10.b host.
fdb:
size=2048, used=5, num=5, depth=1
Bridge
Vdom-10.b host table
port no device devname mac addr ttl attributes
2 33 vlan10-port4 08:5b:0e:19:49:53 1 Hit(1)
1 32 vlan10-port3 70:4c:a5:a4:eb:40 1 Hit(1)
2 33 vlan10-port4 70:4c:a5:a4:eb:3f 0 Local Static
2 33 vlan10-port4 08:5b:0e:19:49:55 7 Hit(7)
1 32 vlan10-port3 70:4c:a5:a4:eb:3e 0 Local Static
被动回包:
id=20085
trace_id=42 func=print_pkt_detail line=5347 msg="vd-Vdom-10 received a
packet(proto=1, 30.30.30.1:9728->40.40.40.1:0) from vlan10-port3. type=0, code=0,
id=9728, seq=0."
id=20085
trace_id=42 func=resolve_ip_tuple_fast line=5422 msg="Find an existing
session, id-0000e3ae, reply direction"
id=20085
trace_id=42 func=npu_handle_session44 line=1100 msg="Trying to offloading
session from vlan10-port3 to vlan10-port4, skb.npu_flag=00000000
ses.state=00018220 ses.npu_state=0x02000000"
id=20085
trace_id=42 func=ipsec_tunnel_output4 line=1216 msg="enter IPsec
tunnel-v1"
id=20085
trace_id=42 func=esp_output4 line=895 msg="IPsec encrypt/auth"
id=20085
trace_id=42 func=__if_queue_push_xmit line=367 msg="send out via
dev-vlan10-port4, dst-mac-08:5b:0e:19:49:53"
FW2
(Vdom-10) # diagnose ip route list
tab=254 vf=1 scope=253 type=1
proto=2 prio=0 0.0.0.0/0.0.0.0/0->10.10.10.0/24 pref=10.10.10.2 gwy=0.0.0.0
dev=27(Vdom-10.b)
tab=254 vf=1 scope=0 type=1
proto=14 prio=0 0.0.0.0/0.0.0.0/0->0.0.0.0/0 pref=0.0.0.0 gwy=20.20.20.2
dev=27(Vdom-10.b)
tab=255
vf=1 scope=254 type=2 proto=2 prio=0 0.0.0.0/0.0.0.0/0->10.10.10.2/32
pref=10.10.10.2 gwy=0.0.0.0 dev=27(Vdom-10.b)
tab=255
vf=1 scope=253 type=3 proto=2 prio=0 0.0.0.0/0.0.0.0/0->127.255.255.255/32
pref=127.0.0.1 gwy=0.0.0.0 dev=18(Vdom-10)
tab=255
vf=1 scope=253 type=3 proto=2 prio=0 0.0.0.0/0.0.0.0/0->10.10.10.0/32
pref=10.10.10.2 gwy=0.0.0.0 dev=27(Vdom-10.b)
tab=255
vf=1 scope=253 type=3 proto=2 prio=0 0.0.0.0/0.0.0.0/0->10.10.10.255/32
pref=10.10.10.2 gwy=0.0.0.0 dev=27(Vdom-10.b)
tab=255
vf=1 scope=253 type=3 proto=2 prio=0 0.0.0.0/0.0.0.0/0->127.0.0.0/32
pref=127.0.0.1 gwy=0.0.0.0 dev=18(Vdom-10)
tab=255
vf=1 scope=254 type=2 proto=2 prio=0 0.0.0.0/0.0.0.0/0->127.0.0.1/32
pref=127.0.0.1 gwy=0.0.0.0 dev=18(Vdom-10)
tab=255 vf=1 scope=254 type=2 proto=2 prio=0 0.0.0.0/0.0.0.0/0->127.0.0.0/8 pref=127.0.0.1 gwy=0.0.0.0 dev=18(Vdom-10)
其实我们可以看到有直连路由和默认路由的。
我的理解,常规情况下:
1. 当收到目的mac为透明墙自身时,进入三层转发。
2. 当收到目的mac 为非防火墙自身时,进入二层转发,即我们常说的透明模式(如果是单播根据策略情况进行匹配。)
3. 当VPN报文解密后,查解密后的包往哪发,包转发首先需要查路由表。根据路由表的情况寻找下一跳的目的mac地址,然后封装成二层帧转发。
4. ARP协议没有规定请求的源和目的必须在同一个三层IP网段,主要有别的条件触发了ARP的请求欲望,就会触发ARP请求。
比如本例中,当中心端VPN解密后,需要查找到40.40.40.1包该往哪,首先查找路由需要往20.20.20.1发,然后中心端以发起管理IP 10.10.10.1 为源,目的为20.20.20.1的arp请求。20.20.20.1回复了10.10.10.1,所以中心端就有了下一跳的mac地址,就能把这个解密后的报文转给下一跳,本例中转发给了20.20.20.1(下一跳也可能是直连网段的最终目标主机)。