如何使用 ACL 拒绝向 GRE 隧道发送数据包?

网络工程 路由 acl 隧道 格雷
2022-02-24 04:39:52

我需要做一个小实验室。拓扑如下图所示: 拓扑

我需要做的是制作静态路由,以便所有路由器都可以 ping 每个邻居的物理接口,在 R0 和 R2 之间配置 GRE 隧道,通过隧道制作到 PC 子网的静态路由并配置 ACL,它拒绝从 PC0 发送数据包子网到隧道(在 R0 上)和另一个,它拒绝将数据包从 PC1 子网发送到隧道(在 R1 上)。这是我到目前为止所做的:

R0运行配置:

interface Tunnel0
 ip address 10.0.0.17 255.255.255.252
 mtu 1476
 tunnel source GigabitEthernet0/1
 tunnel destination 192.168.1.2
!
!
interface GigabitEthernet0/0
 ip address 172.16.0.2 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.0.1 255.255.255.0
 duplex auto
 speed auto
!
ip classless
ip route 192.168.1.0 255.255.255.0 192.168.0.2 
ip route 172.17.0.0 255.255.255.0 10.0.0.18 

R1运行配置:

interface GigabitEthernet0/0
 ip address 192.168.0.2 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
!

R2运行配置:

interface Tunnel0
 ip address 10.0.0.18 255.255.255.252
 mtu 1476
 tunnel source GigabitEthernet0/0
 tunnel destination 192.168.0.1
!
!
interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 172.17.0.2 255.255.255.0
 duplex auto
 speed auto
!
ip classless
ip route 192.168.0.0 255.255.255.0 192.168.1.1 
ip route 172.16.0.0 255.255.255.0 10.0.0.17 

问题是我不知道如何为最后一个任务配置 ACL。任何帮助将不胜感激。

1个回答

在 R0 上,您需要

deny ip 172.16.0.0/24 172.17.0.0/24

对于适当的端口/VLAN,在 R1 上反之亦然

deny ip 172.17.0.0/24 172.16.0.0/24

确保你放了一个

9999 permit ip any any

(或任何你想允许的)在新 ACL 的末尾,因为它在最后是隐含deny ip any any的。

或者,您可以过滤子网之间的任何点,但您会希望尽快丢弃不需要的流量。您也可以使用两侧的两条deny线路来确保 100% 确保没有通信,即使它确实进入了隧道。