穿越两次PIX8.0防火墙并两次静态NAT的FTP测试

本文涉及的产品
云防火墙,500元 1000GB
公网NAT网关,每月750个小时 15CU
简介:

一.测试拓扑

wKioL1X0-syze3ntAADfSrYJAKc050.jpg

二.测试思路

  1. 客户端和Server端不能直接通讯,都作了一对一的静态NAT

  2. 当客户端采用被动模式的FTP连接FTP服务器端时,FTP的控制通讯和数据通讯,发起端都在客户端:

    ----对于客户端侧防火墙来说,都是从高安全区到低安全区的访问,无需放通策略;

    ----对于服务端防火墙来说,控制通讯是从低安全区到高安全区的访问,因此,需要开放针对TCP21的策略;数据通讯也是从低安全区到高安全区的访问,端口随机,因此需要配置ftp审查。

  3. 当客户端采用主动模式的FTP连接FTP服务器端时,FTP的控制通讯发起端在客户端,FTP的数据通讯发起端在服务器端,此时的客户端防火墙必须配置FTP审查;经过验证,此时服务器端防火墙可以不用配置FTP审查

  4. 何为FTP主动模式和被动模式,FTP数据通讯如果主动发起端在Server,就是主动模式;FTP数据通讯如果主动发起端在Client,就是被动模式;


三.基本配置

  1. ftp服务器:

    IP:10.113.9.12/24

    GW:10.113.9.1

  2. FW1防火墙:

    interface Ethernet0
     nameif Inside
     security-level 100
     ip address 10.113.9.1 255.255.255.0 
    !
    interface Ethernet1
     nameif Outside
     security-level 0
     ip address 10.20.0.1 255.255.255.0


    access-list Outside extended permit icmp any any 
    access-group Outside in interface Outside

    -----为了测试方便,直接把所有的ICMP都开开,实际不建议


    static (Inside,Outside) 10.20.0.12 10.113.9.12 netmask 255.255.255.255

  3. FW2防火墙:

    interface Ethernet0
     nameif Inside
     security-level 100
     ip address 10.10.1.1 255.255.255.0 
    !
    interface Ethernet1
     nameif Outside
     security-level 0
     ip address 10.20.0.2 255.255.255.0 


    access-list Outside extended permit icmp any any 
    access-group Outside in interface Outside



    static (Inside,Outside) 10.20.0.5 10.10.1.5 netmask 255.255.255.255


  4. FTP客户端R1:

    interface Ethernet0/0
     ip address 10.10.1.5 255.255.255.0
     no shut

    ip route 0.0.0.0 0.0.0.0 10.10.1.1


    ip ftp username xll
    ip ftp password 1234qwer

四.FTP访问配置

1.客户端采用被动模式的FTP

A.FW2无需配置

B.FW1配置

   ----放策略

     access-list Outside extended permit tcp host 10.20.0.5 host 10.20.0.12 eq ftp

   ----配置FTP审查

     access-list ftp extended permit tcp host 10.20.0.5 host 10.113.9.12 eq ftp

     class-map myftp
         match access-list ftp
     policy-map myftppolicy
         class myftp
          inspect ftp 
     service-policy myftppolicy interface Inside

C.测试:

R1#copy ftp: flash:
Address or name of remote host []? 10.20.0.12
Source filename []? test
Destination filename [test]? 
Accessing ftp://10.20.0.12/test...
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Erase of flash: complete
Loading test 
[OK - 4/4096 bytes]

Verifying checksum...  OK (0x8248)
4 bytes copied in 7.368 secs (1 bytes/sec)
R1#dir flash:
Directory of flash:/

    1  -rw-           4                    <no date>  test

7864316 bytes total (7864248 bytes free)

-----路由器默认FTP客户端采用的是FTP被动模式

2.客户端采用主动模式的FTP

A.FW2不配置FTP审查测试

R1(config)#no ip ftp passive 
R1(config)#exit
R1#
*Mar  1 00:35:29.871: %SYS-5-CONFIG_I: Configured from console by console
R1#copy ftp: flash:
Address or name of remote host [10.20.0.12]? 
Source filename [test]? 
Destination filename [test]? 
%Warning:There is a file already existing with this name 
Do you want to over write? [confirm]
Accessing 
ftp://10.20.0.12/test...

----可以看到这时无法拷贝文件

B.FW2配置FTP审查并测试

----配置FTP审查

access-list ftp extended permit tcp 10.10.1.0 255.255.255.0 host 10.20.0.12 eq ftp 
class-map myftp
 match access-list ftp
policy-map myftppolicy
 class myftp
  inspect ftp           
service-policy myftppolicy interface Inside

----测试,可以看到现在能正常拷贝文件

R1(config)#no ip ftp passive 
R1(config)#exit
R1#copy ftp: flash:
Address or name of remote host [10.20.0.12]? 
Source filename [test]? 
Destination filename [test]? 
%Warning:There is a file already existing with this name 
Do you want to over write? [confirm]
Accessing ftp://10.20.0.12/test...
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Erase of flash: complete
Loading test 
[OK - 4/4096 bytes]

Verifying checksum...  OK (0x8248)
4 bytes copied in 7.856 secs (1 bytes/sec)
R1#

C.FW1取消FTP审查并测试

-----FW1取消FTP审查

FW1(config)#  no service-policy myftppolicy interface Inside

-----测试,可以看到如果客户端采用主动模式的FTP模式,FW1可以不配置FTP审查

R1(config)#no ip ftp passive 
R1(config)#exit
R1#

R1#copy ftp: flash:    
Address or name of remote host [10.20.0.12]? 
Source filename [test]? 
Destination filename [test]? 
%Warning:There is a file already existing with this name 
Do you want to over write? [confirm]
Accessing ftp://10.20.0.12/test...
Erase flash: before copying? [confirm]
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Erase of flash: complete
Loading test 
[OK - 4/4096 bytes]

Verifying checksum...  OK (0x8248)
4 bytes copied in 7.892 secs (1 bytes/sec)
R1#





本文转自 碧云天 51CTO博客,原文链接:http://blog.51cto.com/333234/1694238,如需转载请自行联系原作者

相关文章
|
2月前
|
安全 网络安全 数据安全/隐私保护
手把手教你用eNSP模拟器配置防火墙源NAT
手把手教你用eNSP模拟器配置防火墙源NAT
135 4
|
4月前
|
存储 运维 网络协议
穿越网络界限:探索NAT IPv4的神秘面纱
穿越网络界限:探索NAT IPv4的神秘面纱
94 1
|
5月前
|
弹性计算 监控 安全
通过NAT网关和云防火墙防护私网出站流量安全的最佳实践
针对云上企业出站流量安全攻击,企业可以通过采用“NAT网关+NAT边界防火墙”方案实现出向流量有效监控保护,有效降低恶意软件攻陷风险、内部人员风险、数据泄露风险、供应链风险、出站流量合规风险等
117 3
|
5月前
|
安全 网络协议 网络安全
如何获取静态IP进行测试?静态IP有什么优点?
本文介绍了如何获取静态IP用于测试,包括联系ISP、使用DDNS和利用VPN。静态IP具有稳定性、安全性和易用性的优点,适合网络测试和特定设置。
|
运维 Shell 网络安全
【运维知识进阶篇】iptables防火墙详解(iptables执行过程+表与链概述+iptables命令参数+配置filter表规则+NAT表实现共享上网、端口转发、IP映射)(三)
【运维知识进阶篇】iptables防火墙详解(iptables执行过程+表与链概述+iptables命令参数+配置filter表规则+NAT表实现共享上网、端口转发、IP映射)(三)
2196 0
|
运维 网络协议 网络安全
【运维知识进阶篇】iptables防火墙详解(iptables执行过程+表与链概述+iptables命令参数+配置filter表规则+NAT表实现共享上网、端口转发、IP映射)(二)
【运维知识进阶篇】iptables防火墙详解(iptables执行过程+表与链概述+iptables命令参数+配置filter表规则+NAT表实现共享上网、端口转发、IP映射)(二)
798 0
|
运维 网络协议 Linux
【运维知识进阶篇】iptables防火墙详解(iptables执行过程+表与链概述+iptables命令参数+配置filter表规则+NAT表实现共享上网、端口转发、IP映射)(一)
【运维知识进阶篇】iptables防火墙详解(iptables执行过程+表与链概述+iptables命令参数+配置filter表规则+NAT表实现共享上网、端口转发、IP映射)
1702 0
|
网络协议 网络安全 Android开发
防火墙NAT策略(二)
人类对计算机网路的使用已经拓展到各个领域,而计算机网络的设计者在当时无法想象网络能有今天的规模。任何一个接入互联网的计算机、lpad、手机及安卓电视,要想在互联网中畅游,必须有一个合法的IP地址。而IP地址,曾经认为足以容纳全球的计算机,但是在今天看来,已经严重枯竭。IPv6的出现就是为了解决地址不足的问题。但在IPv6普及之前,需要有一个过渡技术——NAT。NAT的出现缓解了地址不够用的情况,它可以让同一局域网内60000多用户同时使用一个合法P地址访问互联网。NAT技术不是新技术,对于我们来说也并不陌生,文本重点介绍华为的NAT技术。
防火墙NAT策略(二)
|
云安全 安全 Cloud Native
首家+满分+最高等级!阿里云通过《云防火墙能力要求》测试
近日,中国信通院牵头制定了《云防火墙能力要求》标准,并依据标准开展首批评估试点,阿里云成为国内首家满分通过最高等级增强级测试厂商,云上原生防火墙的高弹性、高安全、更智能的优势再次得到认证!
202 0
|
网络安全 网络虚拟化
VSR公网对接strongSwan NAT穿越
VSR公网对接strongSwan NAT穿越
VSR公网对接strongSwan NAT穿越