锐捷网管交换机IP 扩展 ACL 配置举例

一、组网需求
如下图:Device A(VLAN 1)、Device B(VLAN 2)和Device C(VLAN 3)直连Device D,Device D是所有主机的网关。
需求1:VLAN2与VLAN3之间不可以Ping通,VLAN1与VLAN2可以Ping通,VLAN1与VLAN3可以Ping通。
需求2:VLAN1与VLAN2的DHCP报文互相不可达,其他正常通信。需求3:VLAN1不能通过Telnet或者SSH访问VLAN3,其他正常通信。

二、 组网图
IP 扩展 ACL 配置组网图

三、配置要点
● Device D配置IP扩展ACL并添加访问规则,过滤UDP端口号67或者68可以实现需求2。Device C配置IP扩展ACL并添加访问规则,过滤TCP端口23和22可以实现需求3。
●Device D将IP扩展ACL分别应用在VLAN1接口、VLAN2接口和VLAN3接口上。Device C将IP扩展ACL应用在与Device D相线路上。

四、 配置步骤
(1) 配置所有设备接口的IP地址(略)。
(2) 配置IP扩展ACL并添加访问规则。
# Device D配置IP扩展ACL并添加访问规则。
DeviceD> enable
DeviceD# configure terminal
DeviceD(config)# ip access-list extended inter_vlan_access1
DeviceD(config-ext-nacl)# deny udp any eq bootps any eq bootpc
DeviceD(config-ext-nacl)# deny udp any eq bootpc any eq bootps
DeviceD(config-ext-nacl)# remark 拒绝 DHCP 报文
DeviceD(config-ext-nacl)# permit ip any any
DeviceD(config-ext-nacl)# remark 允许其他报文通信
DeviceD(config-ext-nacl)# exit
DeviceD(config)# ip access-list extended inter_vlan_access2
DeviceD(config-ext-nacl)# deny ip 192.168.2.0 0.0.0.255 192.168.3.0 0.0.0.255
DeviceD(config-ext-nacl)# remark 拒绝 VLNN2 和 VLAN3 之间互 ping
DeviceD(config-ext-nacl)# deny udp any eq bootpc any eq bootps
DeviceD(config-ext-nacl)# deny udp any eq bootps any eq bootpc
DeviceD(config-ext-nacl)# remark 拒绝 DHCP 报文
DeviceD(config-ext-nacl)# permit ip any any
DeviceD(config-ext-nacl)# remark 允许其他报文通信
DeviceD(config-ext-nacl)# exit
DeviceD(config)# ip access-list extended inter_vlan_access3
DeviceD(config-ext-nacl)# deny ip 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255
DeviceD(config-ext-nacl)# remark 拒绝 VLNN3 和 VLAN2 之间互 ping
DeviceD(config-ext-nacl)# permit ip any any
DeviceD(config-ext-nacl)# remark 允许其他报文通信
DeviceD(config-ext-nacl)# exit

# Device C配置IP扩展ACL并添加访问规则。
DeviceC> enable
DeviceC# configure terminal
DeviceC(config)# ip access-list extended access_deny
DeviceC(config-ext-nacl)# deny tcp 192.168.1.0 0.0.0.255 eq telnet any eq telnet
DeviceC(config-ext-nacl)# remark 拒绝 VLAN1 通过 Telnet 访问 VLAN 3
DeviceC(config-ext-nacl)# deny tcp 192.168.1.0 0.0.0.255 eq 22 any eq 22
DeviceC(config-ext-nacl)# remark 拒绝 VLAN1 通过 SSH 访问 VLAN 3
DeviceC(config-ext-nacl)# exit

(3) 应用IP扩展ACL。
# Device D将IP扩展ACL应用到对应接口上。
DeviceD(config)# interface vlan 1
DeviceD(config-if-VLAN 1)# ip access-group inter_vlan_access1 in
DeviceD(config-if-VLAN 1)# exit
DeviceD(config)# interface vlan 2
DeviceD(config-if-VLAN 2)# ip access-group inter_vlan_access2 in
DeviceD(config-if-VLAN 2)# exit
DeviceD(config)# interface vlan 3
DeviceD(config-if-VLAN 3)# ip access-group inter_vlan_access3 in
DeviceD(config-if-VLAN 3)# exit

# Device C将IP扩展ACL应用到与Device D相连线路上。
DeviceC(config)# line vty 0
DeviceC(config-line)# access-class access_deny in
DeviceC(config-line)# exit

五、验证配置结果
(1) 验证连通性。
# VLAN 1与VLAN 2之间可以Ping通,VLAN 1与VLAN 3之间可以Ping通。
DeviceA# ping 192.168.2.2
Sending 5, 100-byte ICMP Echoes to 192.168.2.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/8/10 ms
DeviceA#
DeviceA# ping 192.168.3.2
Sending 5, 100-byte ICMP Echoes to 192.168.3.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/8/10 ms

# VLAN 2与VLAN 3之间不可以Ping通。
DeviceB# ping 192.168.3.2
Sending 5, 100-byte ICMP Echoes to 192.168.3.2, timeout is 2 seconds:
< press Ctrl+C to break >
…..
Success rate is 0 percent (0/5)

(2) VLAN 1不能通过Telnet访问VLAN 3。
DeviceA# ping 192.168.3.2
Sending 5, 100-byte ICMP Echoes to 192.168.3.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/8/10 ms
DeviceA#
DeviceA# telnet 192.168.3.2
Trying 192.168.3.2, 23…
% Destination unreachable; gateway or host down

六、 配置文件
●Device D的配置文件
hostname DeviceD
!
vlan 1
!
vlan 2
!
vlan 3
!
ip access-list extended inter_vlan_access1
10 deny udp any eq bootps any eq bootpc
20 deny udp any eq bootpc any eq bootps
remark 拒绝 DHCP 报文
30 permit ip any any
remark 允许其他报文通信
!
ip access-list extended inter_vlan_access2
10 deny ip 192.168.2.0 0.0.0.255 192.168.3.0 0.0.0.255
remark 拒绝 VLNN2 和 VLAN3 之间互 ping
20 deny udp any eq bootpc any eq bootps
30 deny udp any eq bootps any eq bootpc
remark 拒绝 DHCP 报文
40 permit ip any any
remark 允许其他报文通信
!
ip access-list extended inter_vlan_access3
10 deny ip 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255
remark 拒绝 VLNN3 和 VLAN2 之间互 ping
20 permit ip any any
remark 允许其他报文通信
!
interface GigabitEthernet 1/0
switchport access vlan 1
description link_to_DeviceA
!
interface GigabitEthernet 1/1
switchport access vlan 2
description link_to_DeviceB
!
interface GigabitEthernet 1/2
switchport access vlan 3
description link_to_DeviceC
!
interface VLAN 1
ip access-group inter_vlan_access1 in
ip address 192.168.1.1 255.255.255.0
!
interface VLAN 2
ip access-group inter_vlan_access2 in
ip address 192.168.2.1 255.255.255.0
!
interface VLAN 3
ip access-group inter_vlan_access3 in
ip address 192.168.3.1 255.255.255.0
!

● Device A的配置文件
hostname DeviceA
!
interface GigabitEthernet 0/1
ip address 192.168.1.2 255.255.255.0
!

● Device B的配置文件
hostname DeviceB
!
interface GigabitEthernet 0/1
ip address 192.168.2.2 255.255.255.0
!

● Device C的配置文件
hostname DeviceC
!
ip access-list extended access_deny
10 deny tcp 192.168.1.0 0.0.0.255 eq telnet any eq telnet
remark 拒绝 VLAN1 通过 Telnet 访问 VLAN 3
20 deny tcp 192.168.1.0 0.0.0.255 eq 22 any eq 22
remark 拒绝 VLAN1 通过 SSH 访问 VLAN 3
!
interface GigabitEthernet 0/1
ip address 192.168.3.2 255.255.255.0
!
line vty 0
access-class access_deny in
login
password abcdef
!

 

ICP备案号:晋ICP备18007549号-1
站长微信:13613567205