From 9fdea7f887c1e19e21bcc5abbe6dec99c0d995fa Mon Sep 17 00:00:00 2001 From: Noriu Date: Fri, 30 Aug 2024 15:59:38 +0800 Subject: [PATCH] =?UTF-8?q?2024=E5=B9=B48=E6=9C=8830=E6=97=A5=2015:59:40?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B. 第二阶段/拓扑练习/0830_ACL + Telnet.md | 206 ++++++++++++++++++++++ B. 第二阶段/拓扑练习/0830_高级ACL.md | 7 +- 2 files changed, 211 insertions(+), 2 deletions(-) create mode 100644 B. 第二阶段/拓扑练习/0830_ACL + Telnet.md diff --git a/B. 第二阶段/拓扑练习/0830_ACL + Telnet.md b/B. 第二阶段/拓扑练习/0830_ACL + Telnet.md new file mode 100644 index 0000000..ecefda9 --- /dev/null +++ b/B. 第二阶段/拓扑练习/0830_ACL + Telnet.md @@ -0,0 +1,206 @@ +# ACL + Telnet + +![image-20240830093604188](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240830093604188.png) + +### 一 、IP & Routing + +- **PC、Client、Server** + +- **AR1** + + ``` + [AR1]int g0/0/0 + [AR1-GigabitEthernet0/0/0]ip add 192.168.12.1 24 + [AR1-GigabitEthernet0/0/0]int g0/0/2 + [AR1-GigabitEthernet0/0/2]ip add 192.168.1.254 24 + [AR1-GigabitEthernet0/0/2]quit + [AR1]ip route-static 192.168.2.0 24 192.168.12.2 + [AR1]ip route-static 192.168.3.0 24 192.168.12.2 + [AR1]ip route-static 192.168.23.0 24 192.168.12.2 + ``` + +- **AR2** + + ``` + [AR2]int g0/0/0 + [AR2-GigabitEthernet0/0/0]ip add 192.168.12.2 24 + [AR2-GigabitEthernet0/0/0]int g0/0/1 + [AR2-GigabitEthernet0/0/1]ip add 192.168.23.2 24 + [AR2-GigabitEthernet0/0/1]int g0/0/2 + [AR2-GigabitEthernet0/0/2]ip add 192.168.2.254 24 + [AR2-GigabitEthernet0/0/2]quit + [AR2]ip route-static 192.168.1.0 24 192.168.12.1 + [AR2]ip route-static 192.168.3.0 24 192.168.23.3 + ``` + +- **AR3** + + ``` + [AR3]int g0/0/0 + [AR3-GigabitEthernet0/0/0]ip add 192.168.23.3 24 + [AR3-GigabitEthernet0/0/0]int g0/0/2 + [AR3-GigabitEthernet0/0/2]ip add 192.168.3.254 24 + [AR3-GigabitEthernet0/0/2]quit + [AR3]ip route-static 192.168.1.0 24 192.168.23.2 + [AR3]ip route-static 192.168.2.0 24 192.168.23.2 + [AR3]ip route-static 192.168.12.0 24 192.168.23.2 + ``` + +- **连通性测试** + + > 三个终端全部互通 + +### 二、Telnet + +- **AR2** + + ``` + [AR2]user-interface vty 0 4 + [AR2-ui-vty0-4]authentication-mode password + Please configure the login password (maximum length 16):123456 + [AR2-ui-vty0-4]protocol inbound all + ``` + +- **AR3** + + ``` + [AR3]user-interface vty 0 4 + [AR3-ui-vty0-4]authentication-mode password + Please configure the login password (maximum length 16):123456 + [AR3-ui-vty0-4]protocol inbound all + ``` + +- **远程连接测试** + + - AR1 远程 AR2 + + ``` + telnet -a 192.168.1.254 192.168.12.2 【Success】 + telnet -a 192.168.1.254 192.168.23.2 【Success】 + telnet -a 192.168.1.254 192.168.2.254 【Success】 + + telnet -a 192.168.12.1 192.168.12.2 【Success】 + telnet -a 192.168.12.1 192.168.23.2 【Success】 + telnet -a 192.168.12.1 192.168.2.254 【Success】 + ``` + + - AR3 远程 AR2 + + ``` + telnet -a 192.168.3.254 192.168.12.2 【Success】 + telnet -a 192.168.3.254 192.168.23.2 【Success】 + telnet -a 192.168.3.254 192.168.2.254 【Success】 + + telnet -a 192.168.23.3 192.168.12.2 【Success】 + telnet -a 192.168.23.3 192.168.23.2 【Success】 + telnet -a 192.168.23.3 192.168.2.254 【Success】 + ``` + + - AR1 远程 AR3 + + ``` + telnet -a 192.168.1.254 192.168.23.3 【Success】 + telnet -a 192.168.1.254 192.168.3.254 【Success】 + + telnet -a 192.168.12.1 192.168.23.3 【Success】 + telnet -a 192.168.12.1 192.168.3.254 【Success】 + ``` + +### 三、ACL + +- **AR2** + + ``` + [AR2]acl 2000 + [AR2-acl-basic-2000]rule 10 permit source 192.168.1.254 0.0.0.0 + [AR2-acl-basic-2000]quit + [AR2]user-interface vty 0 4 + [AR2-ui-vty0-4]acl 2000 inbound + ``` + + - 注释 + + 1. `[AR2]acl 2000`:这条命令创建了一个编号为2000的基本ACL。 + 2. `[AR2-acl-basic-2000]rule 10 permit source 192.168.1.254 0.0.0.0`:在ACL 2000中添加了一条规则,规则编号为10,这条规则允许源IP地址为192.168.1.254的所有数据包通过。`0.0.0.0`表示对源IP地址进行精确匹配。 + 3. `[AR2-acl-basic-2000]quit`:退出ACL 2000的配置模式。 + 4. `[AR2]user-interface vty 0 4`:进入VTY行0到4的配置模式。VTY是Virtual Teletype的缩写,通常用于远程登录设备。 + 5. `[AR2-ui-vty0-4]acl 2000 inbound`:将之前创建的ACL 2000应用到VTY行0到4的入方向。这意味着只有当远程登录的源IP地址匹配ACL 2000中的规则时,才能访问这些VTY行。 + + > 这样配置后,只有来自192.168.1.254的远程登录请求才能通过VTY 0到4访问设备。其他地址的请求将被拒绝。 + + - 远程连接测试 + + - AR1 远程 AR2 + + ``` + telnet -a 192.168.1.254 192.168.12.2 【Success】 + telnet -a 192.168.1.254 192.168.23.2 【Success】 + telnet -a 192.168.1.254 192.168.2.254 【Success】 + + telnet -a 192.168.12.1 192.168.12.2 【Defeat】 + telnet -a 192.168.12.1 192.168.23.2 【Defeat】 + telnet -a 192.168.12.1 192.168.2.254 【Defeat】 + ``` + + > AR1只有1.254可以远程AR2,12.1不可以远程AR2 + + - AR3 远程 AR2 + + ``` + telnet -a 192.168.3.254 192.168.12.2 【Defeat】 + telnet -a 192.168.3.254 192.168.23.2 【Defeat】 + telnet -a 192.168.3.254 192.168.2.254 【Defeat】 + + telnet -a 192.168.23.3 192.168.12.2 【Defeat】 + telnet -a 192.168.23.3 192.168.23.2 【Defeat】 + telnet -a 192.168.23.3 192.168.2.254 【Defeat】 + ``` + + > AR3不可以远程AR2 + +- **AR3** + + ``` + [AR3]acl 2000 + [AR3-acl-basic-2000]rule 10 deny source 192.168.1.254 0.0.0.0 + [AR3-acl-basic-2000]rule 20 deny source 192.168.12.1 0.0.0.0 + [AR3-acl-basic-2000]rule 30 permit source any + [AR3-acl-basic-2000]quit + [AR3]user-interface vty 0 4 + [AR3-ui-vty0-4]acl 2000 inbound + ``` + + - 注释 + + 1. `[AR3]acl 2000`:这条命令指示设备创建一个新的基本ACL,编号为2000。 + 2. `[AR3-acl-basic-2000]rule 10 deny source 192.168.1.254 0.0.0.0`:在ACL 2000中添加了一条规则,编号为10,该规则用于拒绝源IP地址为192.168.1.254的所有数据包。 + 3. `[AR3-acl-basic-2000]rule 20 deny source 192.168.12.1 0.0.0.0`:接着添加了一条规则,编号为20,该规则用于拒绝源IP地址为192.168.12.1的所有数据包。 + 4. `[AR3-acl-basic-2000]rule 30 permit source any`:最后添加了一条规则,编号为30,允许任何源IP地址的数据包通过。这条规则通常放在ACL的末尾,作为默认规则,匹配所有未被之前规则拒绝的流量。 + 5. `[AR3]user-interface vty 0 4`:进入VTY行0到4的配置界面,这些界面用于远程登录设备。 + 6. `[AR3-ui-vty0-4]acl 2000 inbound`:将之前创建的ACL 2000应用到VTY行0到4的入方向。这意味着只有当远程登录的源IP地址不匹配ACL 2000中规则10和规则20所拒绝的地址时,才能通过这些VTY行进行远程登录。 + + > 配置的ACL将拒绝来自192.168.1.254和192.168.12.1的远程登录请求,而允许来自其他所有地址的请求。这样的配置有助于增强网络设备的安全性。 + + - 远程连接测试 + + - AR1 远程 AR3 + + ``` + telnet -a 192.168.1.254 192.168.23.3 【Defeat】 + telnet -a 192.168.1.254 192.168.3.254 【Defeat】 + + telnet -a 192.168.12.1 192.168.23.3 【Defeat】 + telnet -a 192.168.12.1 192.168.3.254 【Defeat】 + ``` + + - AR2 远程 AR3 + + ``` + telnet -a 192.168.3.254 192.168.23.3 【Success】 + telnet -a 192.168.3.254 192.168.3.254 【Success】 + + telnet -a 192.168.23.3 192.168.23.3 【Success】 + telnet -a 192.168.23.3 192.168.3.254 【Success】 + ``` + + \ No newline at end of file diff --git a/B. 第二阶段/拓扑练习/0830_高级ACL.md b/B. 第二阶段/拓扑练习/0830_高级ACL.md index f988f2d..3837e15 100644 --- a/B. 第二阶段/拓扑练习/0830_高级ACL.md +++ b/B. 第二阶段/拓扑练习/0830_高级ACL.md @@ -121,6 +121,9 @@ ![image-20240830112318917](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240830112318917.png) - - \ No newline at end of file + + + + +