配置高级ACL过滤,使PCA无法访问192.168.2.0网络上的FTP服务:
[RTA]int G0/0
[RTA-G0/0]ip add 192.168.0.1 255.255.255.0
[RTA-G0/0]undo shutdown
[RTA-G0/0]int S6/0
[RTA-S6/0]ip add 192.168.1.1 24
[RTA-S6/0]undo shutdown
[RTA]rip
[RTA-rip-1]ver 2
[RTA-rip-1]undo summary
[RTA-rip-1]network 192.168.0.0
[RTA-rip-1]network 192.168.1.0
[RTB]int G0/0
[RTB-G0/0]ip add 192.168.2.1 255.255.255.0
[RTB-G0/0]undo shutdown
[RTB-G0/0]int S6/0
[RTB-S6/0]ip add 192.168.1.2 24
[RTB-S6/0]undo shutdown
[RTB]rip
[RTB-rip-1]ver 2
[RTB-rip-1]undo summary
[RTB-rip-1]network 192.168.1.0
[RTB-rip-1]network 192.168.2.0
PCA:192.168.0.2 255.255.255.0 GT:192.168.0.1
PCB:192.168.2.2 255.255.255.0 GT:192.168.2.1
[RTB]ftp server enable
[RTB]local-user ftp1
[RTB-luser-ftp1]password cipher ftp123456789
[RTB-luser-ftp1]level 3
[RTB-luser-ftp1]service-type ftp
此时网络已经互通,可以访问FTP服务:
C:\Documents and Settings\xiaofei>ping 192.168.2.1
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.1: bytes=32 time=16ms TTL=254
Reply from 192.168.2.1: bytes=32 time=1ms TTL=254
Reply from 192.168.2.1: bytes=32 time=2ms TTL=254
Reply from 192.168.2.1: bytes=32 time=1ms TTL=254
Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 16ms, Average = 5ms
C:\Documents and Settings\xiaofei>ftp 192.168.2.1
Connected to 192.168.2.1
220 FTP service ready.
User (192.168.2.1:(none)): ftp1
331 Password required for ftp1.
Password:
230 User logged in.
ftp> dir
200 Port command okay.
150 Opening ASCII mode data connection for /*.
drwxrwxrwx 1 noone nogroup 0 Aug 11 15:34 logfile
226 Transfer complete.
ftp: 收到 64 字节,用时 0.00Seconds 64000.00Kbytes/sec.
ftp>
定义高级ACL禁止PCA访问FTP服务,但可以正常通讯:
[RTA]firewall enable 开启防火墙功能
[RTA]firewall default permit 设置防火墙默认规则
[RTA]acl number 3000 定义高级ACL序号
[RTA-acl-adv-3000]rule 0 deny tcp source 192.168.0.2 0.0.0.0 destination 192.168.2.0 0.0.0.255 destination-port eq ftp 设置规则禁止访问FTP服务,0.0.0.0表示匹配主机。
[RTA-acl-adv-3000]rule 1 permit ip source 192.168.0.2 0.0.0.0 destination 192.168.2.0 0.0.0.255 设置规则,运行正常通讯
[RTA-acl-adv-3000]quit
[RTA-Ethernet0/1/0]firewall packet-filter 3000 inbound 在接口应用高级ACL。
[RTA]disp acl all
Advanced ACL 3000, named -none-, 2 rules,
ACL's step is 5
rule 0 deny tcp source 192.168.0.2 0 destination 192.168.2.0 0.0.0.255 destination-port eq ftp (14 times matched)
rule 1 permit ip source 192.168.0.2 0 destination 192.168.2.0 0.0.0.255 (2 times matched)
此时PCA可以和192.168.2.0网络正常通讯,但是无法访问FTP服务:
C:\Documents and Settings\xiaofei>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=1ms TTL=254
Reply from 192.168.2.2: bytes=32 time=1ms TTL=254
Reply from 192.168.2.2: bytes=32 time=1ms TTL=254
Reply from 192.168.2.2: bytes=32 time<1ms TTL=254
Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
C:\Documents and Settings\xiaofei>ftp 192.168.2.2
> ftp: connect :未知错误号