第一天实验

该实验涉及配置静态路由以确保网络中的所有路由器可达,并通过DHCP服务为R3下的PC分配IP地址。配置包括在各路由器上设定接口和环回地址,创建DHCP地址池并指定网关和DNS服务器,以及在路由器上配置静态路由以避免路由黑洞。此外,还设置了R6的telnet访问控制,并在R5上进行端口映射,以允许内网访问外网。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

静态路由实验

拓扑图如下 

 

 

 

给每台路由器配置环回地址和接口地址
R1:
环回地址:
192.168.1.33 28
192.168.1.49 28
接口地址:
g0/0/0接口:192.168.1.1 30
g0/0/1接口:192.168.1.5 30

R2:
环回地址:
192.168.1.65 28
192.168.1.81 28
接口地址:
g/0/0/0接口:192.168.1.2 30
g0/0/1接口:192.168.1.9 30

R3:
接口地址:
g0/0/0接口:192.168.1.6 30
g0/0/1接口:192.168.1.13 30
g0/0/2接口:192.168.1.97 27

R4:
环回地址:
192.168.1.129 28
192.168.1.145 28
接口地址:
g0/0/0接口:192.168.1.10 30
g0/0/1接口:192.168.1.14 30
g0/0/2接口:192.168.1.17 30
g4/0/0接口:192.168.1.21 30

R5:
环回地址:
192.168.1.161 27
接口地址:
g0/0/0接口:192.168.1.18 30
g0/0/1接口:12.0.0.1 24
g0/0/2接口:192.168.1.22 30

R6:
环回地址:
1.1.1.1 24
接口地址:
g0/0/0接口:12.0.0.2 24

R1:
[R1]inter g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[R1-GigabitEthernet0/0/0]inter g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.1.5 30
[R1-GigabitEthernet0/0/1]inter lo 0
[R1-LoopBack0]ip add 192.168.1.33 28
[R1-LoopBack0]inter lo 1
[R1-LoopBack1]ip add 192.168.1.49 28

R2:
[R2]inter g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
[R2-GigabitEthernet0/0/0]inter g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.1.9 30
[R2-GigabitEthernet0/0/1]inter lo 0
[R2-LoopBack0]ip add 192.168.1.65 28
[R2-LoopBack0]inter lo 1
[R2-LoopBack1]ip add 192.168.1.81 28

R3:
[R3]inter g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.1.6 30
[R3-GigabitEthernet0/0/0]inter g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.1.13 30
[R3-GigabitEthernet0/0/1]inter g0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.1.97 27

R4:
[R4]inter g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.1.10 30
[R4-GigabitEthernet0/0/0]inter g0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
[R4-GigabitEthernet0/0/1]inter g0/0/2
[R4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[R4-GigabitEthernet0/0/2]inter g4/0/0
[R4-GigabitEthernet4/0/0]ip add 192.168.1.21 30
[R4]inter lo 0
[R4-LoopBack0]ip add 192.168.1.129 28
[R4-LoopBack0]inter lo 1
[R4-LoopBack1]ip add 192.168.1.145 28

R5:
[R5]inter g0/0/0
[R5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
[R5-GigabitEthernet0/0/2]inter g0/0/1
[R5-GigabitEthernet0/0/1]ip add 12.0.0.1 24
[R5-GigabitEthernet0/0/0]inter g0/0/2
[R5-GigabitEthernet0/0/2]ip add 192.168.1.22 30
[R5-GigabitEthernet0/0/1]inter lo 0
[R5-LoopBack0]ip add 192.168.1.161 27

R6:
[R6]inter g0/0/0
[R6-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R6-GigabitEthernet0/0/0]inter lo 0
[R6-LoopBack0]ip add 1.1.1.1 24
 

R3下的两台pc通过DHCP自动获取IP地址

开启DHCP服务功能:

在这里插入图片描述

创建名字为aaa的DHCP地址池: 

 在这里插入图片描述

 定义下发地址的网段:

 在这里插入图片描述

 定义网关

在这里插入图片描述

指定DNS服务器地址 

在这里插入图片描述

 进入对应的接口选择接口支持同全局配置模式的DHCP服务功能:

在这里插入图片描述

在pc配置中勾选DHCP 

pc1自动获取了地址:

 命令配置:
[R3]dhcp enable
[R3]ip pool aaa
[R3-ip-pool-aaa]network 192.168.1.96 mask 27
[R3-ip-pool-aaa]gateway-list 192.168.1.97
[R3-ip-pool-aaa]dns-list 114.114.114.114
[R3-ip-pool-aaa]inter g0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
 

 

配置静态路由使全网可达
R1:
[R1]ip route-static 0.0.0.0 0 192.168.1.2
[R1]ip route-static 0.0.0.0 0 192.168.1.6
[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.8 30 192.168.1.2
[R1]ip route-static 192.168.1.12 30 192.168.1.6
[R1]ip route-static 192.168.1.96 27 192.168.1.6

R2:
[R2]ip route-static 0.0.0.0 0 192.168.1.10
[R2]ip route-static 192.168.1.96 27 192.168.1.10
[R2]ip route-static 192.168.1.96 27 192.168.1.1
[R2]ip route-static 192.168.1.4 30 192.168.1.1
[R2]ip route-static 192.168.1.32 27 192.168.1.1

R3:
[R3]ip route-static 0.0.0.0 0 192.168.1.14
[R3]ip route-static 192.168.1.64 27 192.168.1.14
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.0 30 192.168.1.5
[R3]ip route-static 192.168.1.32 27 192.168.1.5

R4:
[R4]ip route-static 0.0.0.0 0 192.168.1.18
[R4]ip route-static 0.0.0.0 0 192.168.1.22 pre
[R4]ip route-static 0.0.0.0 0 192.168.1.22 preference 70(修改优先级,使正常状态下,走1000M的链路,故障时走100M的链路)
[R4]ip route-static 192.168.1.96 27 192.168.1.13
[R4]ip route-static 192.168.1.4 30 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.9
[R4]ip route-static 192.168.1.0 30 192.168.1.9
[R4]ip route-static 192.168.1.64 27 192.168.1.9

R5:
[R5]ip route-static 0.0.0.0 0 12.0.0.2
[R5]ip route-static 192.168.1.0 24 192.168.1.17
[R5]ip route-static 192.168.1.0 24 192.168.1.21 pre
[R5]ip route-static 192.168.1.0 24 192.168.1.21 preference 70

4、为了避免路由黑洞,需要在黑洞路由器上写相应的空接口配置命令
R1:
[R1]ip route-static 192.168.1.32 27 NULL 0

R2:
[R2]ip route-static 192.168.1.64 27 NULL 0

R4:
[R4]ip route-static 192.168.1.128 27 NULL 0
R4ping不通R5的环回地址,则需要把静态路由直接写入(因为R4匹配到的是空接口路由,到达不了R5的环回地址)
[R4]ip route-static 192.168.1.160 27 192.168.1.18
[R4]ip route-static 192.168.1.160 27 192.168.1.20 pre
[R4]ip route-static 192.168.1.160 27 192.168.1.20 preference 70

R5:
[R5]ip route-static 192.168.1.0 24 NULL 0

5、R1—R5可以访问R6的环回(内网可以访问外网)
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5]inter g0/0/1
[R5-GigabitEthernet0/0/1]nat outbound 2000
 

 

R6telnetR5的公有IP地址时,实际登录到R1上
先开启R1上的telnet功能:
[R1]aaa
设置名字、权限等级、密码:
[R1-aaa]local-user admin privilege level 15 password cipher 123456(cipher表示密码是以密文形式存储)

[R1-aaa]local-user admin service-type telnet (用户是用来提供telnet服务的)

开启虚拟登录端口:
[R1]user-interface vty 0 4
选择认证类型是aaa(登录时按照aaa里创建的用户名、密码登录):
[R1-ui-vty0-4]authentication-mode aaa

在R5上做端口映射:
[R5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 inside 192.168.1.1 23
Warning:The port 23 is well-known port. If you continue it may cause function failure.
Are you sure to continue?[Y/N]:y

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值