计算机网络-ACL实验

一、NAT实验配置

NAT实验配置

通过基本ACL匹配VLAN 10网段,然后在出口设备NAT转换只要匹配到VLAN10地址则进行转换。

核心交换机

复制代码
# 配置VLAN和默认路由,配置Trunk和Access接口
interface Vlanif10
 ip address 192.168.10.254 255.255.255.0
#
interface Vlanif20
 ip address 192.168.20.254 255.255.255.0
#
interface Vlanif30
 ip address 10.0.0.2 255.255.255.252

interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 30
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 20

# 路由
ip route-static 0.0.0.0 0.0.0.0 10.0.0.1

出口路由器

复制代码
# 配送路由和ACL以及NAT
acl number 2000  
 rule 10 permit source 192.168.10.0 0.0.0.255 

# 配置路由
ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
ip route-static 192.168.10.0 255.255.255.0 10.0.0.2
ip route-static 192.168.20.0 255.255.255.0 10.0.0.2

# 配置接口地址,配置NAT与ACL匹配
interface GigabitEthernet0/0/0
 ip address 12.1.1.1 255.255.255.252 
 nat outbound 2000
#
interface GigabitEthernet0/0/1
 ip address 10.0.0.1 255.255.255.252 

中间路由器:

复制代码
interface GigabitEthernet0/0/0
 ip address 12.1.1.2 255.255.255.252 
#
interface GigabitEthernet0/0/1
 ip address 23.1.1.2 255.255.255.252 
#
ip route-static 8.8.8.8 255.255.255.255 23.1.1.1

AR3:

复制代码
interface GigabitEthernet0/0/1
 ip address 23.1.1.1 255.255.255.252 
#
interface LoopBack0
 ip address 8.8.8.8 255.255.255.255 
#
ip route-static 0.0.0.0 0.0.0.0 23.1.1.2

PC1:正常访问8.8.8.8

PC2:没有进行NAT转换,访问超时

二、ACL流量过滤实验

流量过滤

正常配置access接口,划分VLAN,创建高级ACL匹配流量,然后调用过滤策略。

复制代码
# 创建高级ACL,先匹配拒绝,然后再允许其它的访问流量
acl number 3000
 rule 5 deny ip source 192.168.10.1 0 destination 192.168.20.2 0
 rule 10 permit ip source 192.168.10.1 0

# 接口配置
#
interface Vlanif10
 ip address 192.168.10.254 255.255.255.0
#
interface Vlanif20
 ip address 192.168.20.254 255.255.255.0
#
interface Vlanif30
 ip address 10.0.0.2 255.255.255.252
 
# 应用过滤策略
# 可以在全局应用流量过滤
traffic-filter inbound acl 3000

# 或者在入接口和出接口应用,在G0/0/2,入方向过滤或者在G0/0/4出方向过滤
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 10
 traffic-filter inbound acl 3000

#
interface GigabitEthernet0/0/4
 port link-type access
 port default vlan 20
 traffic-filter outbound acl 3000

结果:

本文由mdnice多平台发布

相关推荐
Apifox.12 小时前
如何在 Apifox 中通过 AI 一键生成几十个测试用例?
人工智能·程序人生·ai·测试用例·ai编程
程序员Aries1 天前
自定义网络协议与序列化/反序列化
linux·网络·c++·网络协议·程序人生
立志成为大牛的小牛1 天前
数据结构——十七、线索二叉树找前驱与后继(王道408)
数据结构·笔记·学习·程序人生·考研·算法
菠萝吹雪ing1 天前
GUI 自动化与接口自动化:概念、差异与协同落地
运维·笔记·程序人生·自动化·接口测试·gui测试
郝学胜-神的一滴1 天前
Linux下的阻塞与非阻塞模式详解
linux·服务器·开发语言·c++·程序人生·软件工程
润 下2 天前
C语言——深入解析C语言指针:从基础到实践从入门到精通(三)
c语言·开发语言·经验分享·笔记·学习·程序人生·其他
润 下2 天前
C语言——深入解析C语言指针:从基础到实践从入门到精通(二)
c语言·开发语言·经验分享·笔记·学习·程序人生
li星野2 天前
打工人日报#20251010
笔记·程序人生·fpga开发·学习方法
郝学胜-神的一滴3 天前
Effective Python 第44条:用纯属性与修饰器取代旧式的 setter 与 getter 方法
开发语言·python·程序人生·软件工程