• 安全进阶:虚拟防火墙基础实验


    实验拓扑

    网络拓扑及IP编址如上图所示;

    实验需求

    1. PC2与Server2属于一个敏感的业务,这个业务的流量要求与防火墙上的其他流量完全隔离,使用虚拟防火墙技术实现这个需求;

    2. PC2要求能够访问Server2;PC2属于Trust域,Server2属于DMZ域;

    3. PC1要求能够访问Server1;PC1属于Trust域,Server1属于DMZ域;

    实验步骤及配置

    1. 完成根防火墙的接口IP地址配置,将接口添加到相应的安全域,并配置域间包过滤策略,使得PC1能够访问Server1。

    FW的基本配置如下:

    [FW] interface GigabitEthernet 0/0/1
    [FW-GigabitEthernet0/0/1] ip address 192.168.1.254 24
    [FW] interface GigabitEthernet 0/0/2
    [FW-GigabitEthernet0/0/2] ip address 192.168.2.254 24
    [FW] firewall zone trust
    [FW-zone-trust] add interface GigabitEthernet 0/0/1
    [FW] firewall zone dmz
    [FW-zone-dmz] add interface GigabitEthernet 0/0/2
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    FW完成根防火墙域间策略的配置,使得PC1能够访问Server1:

    [FW] policy interzone trust dmz outbound
    [FW-policy-interzone-trust-dmz-outbound] policy 10
    [FW-policy-interzone-trust-dmz-outbound-10] policy source 192.168.1.0 0.0.0.255
    [FW-policy-interzone-trust-dmz-outbound-10] policy destination 192.168.2.0 0.0.0.255
    [FW-policy-interzone-trust-dmz-outbound-10] action permit
    
    • 1
    • 2
    • 3
    • 4
    • 5

    PC及Server的配置这里不再赘述。完成上述配置后,PC1即可访问Server1。当PC1 pingServer1时,在防火墙上查看会话表:

    [FW] display firewall session table
    Current Total Sessions : 5
    icmp VPN:public --> public 192.168.1.1:27431-->192.168.2.1:2048
    icmp VPN:public --> public 192.168.1.1:27943-->192.168.2.1:2048
    icmp VPN:public --> public 192.168.1.1:28199-->192.168.2.1:2048
    icmp VPN:public --> public 192.168.1.1:28455-->192.168.2.1:2048
    icmp VPN:public --> public 192.168.1.1:28711-->192.168.2.1:2048
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    1. 完成虚拟防火墙的接口IP地址的配置,将接口添加到虚拟防火墙上相应的安全域,并配置域间包过滤策略,使得PC2能够访问Server2。

    首先在防火墙上创建虚拟防火墙实例:

    [FW] ip vpn-instance vfw1 #创建虚拟防火墙实例,名称为vfw1
    [FW-vpn-instance-vfw1] route-distinguisher 1:1  #配置RD值
    [FW] interface GigabitEthernet 0/0/3
    [FW-GigabitEthernet0/0/3] ip binding vpn-instance vfw1  #将接口关联到虚拟防火墙
    [FW-GigabitEthernet0/0/3] ip address 192.168.11.254 24
    [FW] interface GigabitEthernet 0/0/4
    [FW-GigabitEthernet0/0/4] ip binding vpn-instance vfw1
    [FW-GigabitEthernet0/0/4] ip address 192.168.12.254 24
    [FW] firewall zone vpn-instance vfw1 trust  #将接口添加到虚拟防火墙的安全域
    [FW-zone-trust-vfw1] add interface GigabitEthernet 0/0/3
    [FW] firewall zone vpn-instance vfw1 dmz
    [FW-zone-dmz-vfw1] add interface GigabitEthernet 0/0/4
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    配置虚拟防火墙的域间包过滤策略,使得PC2能够访问Server2:

    [FW] policy interzone vpn-instance vfw1 trust dmz outbound
    [FW-policy-interzone-trust-dmz-vfw1-outbound] policy 10
    [FW-policy-interzone-trust-dmz-vfw1-outbound-10] policy source 192.168.11.0 0.0.0.255
    [FW-policy-interzone-trust-dmz-vfw1-outbound-10] policy destination 192.168.12.0
    0.0.0.255
    [FW-policy-interzone-trust-dmz-vfw1-outbound-10] action permit
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    完成上述配置后,首先查看一下根防火墙的路由表。

    [FW] display ip routing-table
    Destination/Mask Proto Pre Cost Flags NextHop Interface
    127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
    127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    192.168.1.0/24 Direct 0 0 D 192.168.1.254 GigabitEthernet0/0/1
    192.168.1.254/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    192.168.2.0/24 Direct 0 0 D 192.168.2.254 GigabitEthernet0/0/2
    192.168.2.254/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    我们发现,在跟防火墙的路由表中,直连路由只有192.168.1.0/24及192.168.2.0/24两个网段,而192.168.11.0/24及192.168.13.0/24这两个网段的接口由于被添加到了虚拟防火墙vfw1中,所以查看根防火墙路由表是看不到这两条直连路由的。接下来看看虚拟防火墙vfw1的路由表。

    [FW]display ip routing-table vpn-instance vfw1
    Destination/Mask Proto Pre Cost Flags NextHop Interface
    192.168.11.0/24 Direct 0 0 D 192.168.11.254 GigabitEthernet0/0/3
    192.168.11.254/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    192.168.12.0/24 Direct 0 0 D 192.168.12.254 GigabitEthernet0/0/4
    192.168.12.254/32 Direct 0 0 D 127.0.0.1 InLoopBack0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    现在PC2去ping Server2,然后查看防火墙的会话表:

    [FW]display firewall session table
    Current Total Sessions : 5
    icmp VPN:vfw1 --> vfw1 192.168.11.1:58666-->192.168.12.1:2048
    icmp VPN:vfw1 --> vfw1 192.168.11.1:58922-->192.168.12.1:2048
    icmp VPN:vfw1 --> vfw1 192.168.11.1:59178-->192.168.12.1:2048
    icmp VPN:vfw1 --> vfw1 192.168.11.1:59434-->192.168.12.1:2048
    icmp VPN:vfw1 --> vfw1 192.168.11.1:59946-->192.168.12.1:2048
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    留意各个表项,有个vfw1->vfw1字样,表示这些流量是从虚拟防火墙vfw1去访问虚拟防火墙vfw1的流量。

    思考题

    我们已经知道,在一台防火墙上创建虚拟防火墙,通常是希望将一些敏感的业务流量或者业务节点放到虚拟防火墙上从而与其他业务流量或节点完全隔离。但是网络的需求往往是复杂多变的。现在假设客户新增了一个需求,希望位于根防火墙的PC1能够访问位于虚拟防火墙上的Server2,能否实现?答案是可以的。

    我们需要修改防火墙的配置,首先为根防火墙添加一条静态路由,使得根防火墙有路由到处于虚拟防火墙的192.168.12.0/24网络,注意该条路由的下一跳必须关联到vpn实例vfw1中:

    [FW] ip route-static 192.168.12.0 24 vpn-instance vfw1 192.168.12.1
    
    • 1

    接下去再为虚拟防火墙vfw1添加一条去往192.168.1.0/24的静态路由。要注意这条路由必须配置在vpn实例vfw1的路由表中,并且该路由的下一跳由于是处于根防火墙的领地,因此需关联上public关键字:

    [FW] ip route-static vpn-instance vfw1 192.168.1.0 24 192.168.1.1 public
    
    • 1

    最后,配置域间包过滤策略,使得PC1能够访问Server2。注意根防火墙访问虚拟防火墙的direction始终是inbound(相对的,从虚拟防火墙访问根防火墙侧的流量的direction始终为outbound),无论是哪两个区域:

    [FW] policy interzone trust vpn-instance vfw1 dmz inbound
    [FW-policy-interzone-vfw1-dmz-public-trust-inbound] policy 10
    [FW-policy-interzone-vfw1-dmz-public-trust-inbound-10] policy source 192.168.1.1 0
    [FW-policy-interzone-vfw1-dmz-public-trust-inbound-10] policy destination 192.168.12.1 0
    [FW-policy-interzone-vfw1-dmz-public-trust-inbound-10] action permit
    
    • 1
    • 2
    • 3
    • 4
    • 5

    完成上述配置后,PC1即可访问Server2。

  • 相关阅读:
    Spring boot和Vue.js实现基于oauth2授权码模式的认证 (二)
    MapperStruct实现类为空
    不可复制网站上的文字——2种方法
    8.绘制旗帜(TRIANGLE_FAN)
    独有且优质,这些Mac软件绝了
    PostGIS的10个最佳实践
    .NET Core HttpReports 监控
    C专家编程 第7章 对内存的思考 7.8 轻松一下---“Thing King”和“页面游戏”
    设计模式——代理,静态代理及动态代理的使用
    基于springboot的智慧养老平台
  • 原文地址:https://blog.csdn.net/weixin_43025343/article/details/127927745