企业部署了三个网络,其中R2连接的是公司总部网络,R1和R3分别为两个不同分支网络的设备,这三台路由器通过广域网相连。你需要控制员工使用Telnet和FTP服务的权限,R1所在分支的员工只允许访问公司总部网络中的Telnet服务器,R3所在分支的员工只允许访问FTP服务器。
S1
[S1]vlan 4
[S1-vlan4]
[S1-vlan4]quit
[S1]un in en
Info: Information center is disabled.
[S1]int vlan 4
[S1-Vlanif4]ip add 10.0.4.254 24
S2
[S2]un in en
Info: Information center is disabled.
[S2]vlan 6
[S2-vlan6]quit
[S2]int vlan 6
[S2-Vlanif6]ip add 10.0.6.254 24
[S2-Vlanif6]quit
R1
interface GigabitEthernet0/0/0
ip address 10.0.13.1 255.255.255.0
R2
interface GigabitEthernet0/0/0
ip address 10.0.13.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.4.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.6.2 255.255.255.0
R3
interface GigabitEthernet0/0/0
ip address 10.0.13.3 255.255.255.0
配置S1和S2连接路由器的端口为Trunk端口,并通过修改PVID使物理端口加入三层VLANIF逻辑接口。
S1
interface GigabitEthernet0/0/2
port link-type trunk
port trunk pvid vlan 4
port trunk allow-pass vlan 4
S2
interface GigabitEthernet0/0/2
port link-type trunk
port trunk pvid vlan 6
port trunk allow-pass vlan 2 to 4094
配置OSPF使网络互通
R1
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.0.13.0 0.0.0.255
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.0.13.0 0.0.0.255
network 10.0.4.0 0.0.0.255
network 10.0.6.0 0.0.0.255
R3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.0.13.0 0.0.0.255
在S1和S2上配置缺省静态路由,指定下一跳为各自连接的路由器网关
[S1]ip route-static 0.0.0.0 0.0.0.0 10.0.4.2
[S2]ip route-static 0.0.0.0 0.0.0.0 10.0.6.2
这里使用R3PingR1
网络出现环路
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=245 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=247 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=247 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=247 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=247 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=249 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=249 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=3 ttl=249 time=1110 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=3 ttl=249 time=1110 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=249 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=251 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=3 ttl=251 time=1110 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=3 ttl=251 time=1110 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=251 time=1690 ms (DUP!)
Reply from 10.0.13.1: bytes=56 Sequence=2 ttl=253 time=1690 ms (DUP!)
将R2的G0/0/0接口shutdown后环路消失。
将S1配置成Telnet服务器
[S1]telnet server enable
Info: The Telnet server has been enabled.
[S1]user-interface vty 0 4
[S1-ui-vty0-4]protocol inbound all
[S1-ui-vty0-4]aut
[S1-ui-vty0-4]authentication-mode password
[S1-ui-vty0-4]set au
[S1-ui-vty0-4]set authentication pass
[S1-ui-vty0-4]set authentication password cip
[S1-ui-vty0-4]set authentication password cipher huawei123
将S2配置成FTP服务器
[S2]ftp server enable
Info: Succeeded in starting the FTP server.
[S2]aaa
[S2-aaa]local-user huawei password cipher huawei123
Info: Add a new user.
[S2-aaa]
[S2-aaa]
[S2-aaa]local-user huawei priv
[S2-aaa]local-user huawei privilege l
[S2-aaa]local-user huawei privilege level 3
[S2-aaa]loc
[S2-aaa]local-user huawei service-ty
[S2-aaa]local-user huawei service-type ftp
[S2-aaa]local-user huawei ftp-dire
[S2-aaa]local-user huawei ftp-directory flash:/
在R2上配置ACL,只允许R1访问Telnet服务器,只允许R3访问FTP服务器
R2
ACL's step is 5
rule 5 permit 23 source 10.0.13.1 0 destination 10.0.4.254 0 (0 times matched)
rule 10 permit 22 source 10.0.13.2 0 destination 10.0.6.254 0 (0 times matched)
rule 15 permit ospf (0 times matched)
rule 20 deny ip (0 times matched)
在R2的G0/0/0接口上应用ACL
似乎在普通的ROUTER上不能将ACL应用到接口上。
默认情况下FTP协议使用TCP端口中的 20和21这两个端口,其中20用于传输数据,21用于传输控制信息。
但是,是否使用20作为传输数据的端口与FTP使用的传输模式有关,如果采用主动模式,那么数据传输端口就是20;如果采用被动模式,则具体最终使用哪个端口要服务器端和客户端协商决定。
基本ACL放置在目的端的路由器
高级ACL放置在源端的路由器