初步学习acl配置
如图:
路由器地址配置:
#R1
interface gigabitethernet 0/0/0
ip addr 10.0.13.1 24
interface loopback 0
ip addr 1.1.1.1 32
#R2
interface gigabitethernet 0/0/0
ip addr 10.0.23.2 24
#R3
interface gigabitethernet 0/0/0
ip addr 10.0.13.3 24
interface gigabitethernet 0/0/1
ip addr 10.0.23.3 24
interface gigabitethernet 0/0/2
ip addr 10.0.34.3 24
interface loopback 0
ip addr 3.3.3.3 32
#R4
interface gigabitethernet 0/0/0
ip addr 10.0.34.4 24
interface loopback 0
ip addr 4.4.4.4 32
interface loopback 1
ip addr 44.44.44.44 32
路由器动态路由协议配置:
#R1
ospf 1
area 0
network 10.0.13.0 0.0.0.255
network 1.1.1.1 0.0.0.0
#R2
ospf 1
area 0
network 10.0.23.0 0.0.0.255
#R3
ospf 1
area 0
network 10.0.13.0 0.0.0.255
network 10.0.23.0 0.0.0.255
network 10.0.34.0 0.0.0.255
network 3.3.3.3 0.0.0.0
#R4
ospf 1
area 0
network 10.0.34.0 0.0.0.255
network 4.4.4.4 0.0.0.0
network 44.44.44.44 0.0.0.0
R4路由器配置:
user-interface vty 0 4
user privilege level 2
authentication-mode password
set authentication password simple hehe
acl 3000
rule permit ip source 1.1.1.1 0.0.0.0 destination 4.4.4.4 0.0.0.0a
最后再R1路由器执行命令查看效果
//可以访问
ping -a 1.1.1.1 4.4.4.4
//不可以访问
ping -a 1.1.1.1 44.44.44.44