一,实验需求
1,实现全网可达
2,实验PC的IP地址通过DHCP获取
3,R6可以登录到R1
二,实验目的
1,掌握DHCP服务器配置
2,掌握DHCP客户端配置
3,掌握Telnet登录配置
4,掌握静态IP配置
三,实验步骤
1,新建拓扑,布置器件,连线开机
2,划分网段
3,每个接口配置IP地址并更改名字(记得保存配置)
r6进行配置
<Huawei>sysEnter system view, return user view with Ctrl+Z.
[Huawei]int g
[Huawei]int GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip ad
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.254 24Sep 24 2023 17:33:03-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]sysn
[Huawei]sysname r6
[r6]q
<r6>save
The current configuration will be written to the device. Are you sure to continue? (y/n)[n]:y It will take several minutes to save configuration file, please wait....... Configuration file had been saved successfully Note: The configuration file will take effect after being activated
r1进行配置
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]int g
[Huawei]int GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip ad
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 24
Sep 24 2023 17:34:48-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]int GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.2
Sep 24 2023 17:35:09-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]int GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.3
[Huawei-GigabitEthernet0/0/2]
Sep 24 2023 17:35:22-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[2]:The line protocol
IP on the interface GigabitEthernet0/0/2 has entered the UP state.
[Huawei-GigabitEthernet0/0/2]q
[Huawei]sysn
[Huawei]sysname r1
[r1]q
<r1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
r2进行配置
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn
[Huawei]sysname r2
[r2]int g
[r2]int GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
Sep 24 2023 17:41:57-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]int g
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add
[r2-GigabitEthernet0/0/1]ip address 192.168.4.1 24
Sep 24 2023 17:42:31-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]q
[r2]q
<r2>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
r3进行配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn
[Huawei]sysname
^
Error:Incomplete command found at '^' position.
[Huawei]sysname r3
[r3]int g
[r3]int GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip add
[r3-GigabitEthernet0/0/0]ip address 192.168.3.2 24
Sep 24 2023 17:52:12-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.5.1 24
Sep 24 2023 17:52:39-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]q
[r3]q
<r3>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
r4进行配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn
[Huawei]sysname r4
[r4]int g
[r4]int GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip ad
[r4-GigabitEthernet0/0/0]ip address 192.168.5.2 24
Sep 24 2023 17:54:48-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.4.2 24
Sep 24 2023 17:55:03-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int GigabitEthernet 0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.6.1 24
Sep 24 2023 17:55:17-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]q
[r4]q
<r4>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
四,配置PC通过DHCP自动获取
1,启动DHCP(r1,r5)
2,创建IP地址池
3,配置IP地址池
4,接口全局配置
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]dhcp e
[r1]dhcp enable
[r1]ip pool aa
Info: It's successful to create an IP address pool.
[r1-ip-pool-aa]net
[r1-ip-pool-aa]network 192.168.1.0 mask 24
[r1-ip-pool-aa]gate
[r1-ip-pool-aa]gateway-list 192.168.1.1
[r1-ip-pool-aa]dns
[r1-ip-pool-aa]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-aa]int g 0/0/0
[r1-GigabitEthernet0/0/0]dhcp s
[r1-GigabitEthernet0/0/0]dhcp select g
[r1-GigabitEthernet0/0/0]dhcp select global
[r1-GigabitEthernet0/0/0]q
[r1]q
<r1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r4]dhcp enable
[r4]ip pool bb
Info: It's successful to create an IP address pool.
[r4-ip-pool-bb]net w
[r4-ip-pool-bb]netw
[r4-ip-pool-bb]network 192.168.6.0 mask 24
[r4-ip-pool-bb]ga
[r4-ip-pool-bb]gateway-list 192.168.6.1
[r4-ip-pool-bb]dns
[r4-ip-pool-bb]dns-list 114.114.114.114 8.8.8.8
[r4-ip-pool-bb]int g 0/0/2
[r4-GigabitEthernet0/0/2]dhcp select global
结果展示:
五,配置R6可以登录到R1
1,配置aaa
1.1,创建用户密码,权限级别1.2,定义用户类型
2,配置虚拟的登录端口
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]aaa
[r1-aaa]local
[r1-aaa]local-user abc s
[r1-aaa]local-user abc pr
[r1-aaa]local-user abc privilege l
[r1-aaa]local-user abc privilege level 15 p
[r1-aaa]local-user abc privilege level 15 password c
[r1-aaa]local-user abc privilege level 15 password cipher 123456
Info: Add a new user.
[r1-aaa]lo
[r1-aaa]local-user abc s
[r1-aaa]local-user abc service-type t
[r1-aaa]local-user abc service-type terminal
[r1-aaa]local-user abc service-type telnet
[r1-aaa]q
[r1]user-i
[r1]user-interface vty 0 4
[r1-ui-vty0-4]au
[r1-ui-vty0-4]authentication-mode aaa
效果展示:
六,实现全网可达
1.对r1,已经有三条直接连接,需要配置三条静态路由,分别是4,5,6.(配置完成查看一下路由表,看是否缺少)
[r1]ip route-static 192.168.4.0 24 192.168.2.2
[r1]ip route-static 192.168.5.0 24 192.168.3.2
[r1]ip route-static 192.168.6.0 24 192.168.2.2
[r1]ip route-static 192.168.6.0 24 192.168.3.2
[r1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 16 Routes : 17
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet
0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.1 GigabitEthernet
0/0/1
192.168.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.3.0/24 Direct 0 0 D 192.168.3.1 GigabitEthernet
0/0/2
192.168.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.4.0/24 Static 60 0 RD 192.168.2.2 GigabitEthernet
0/0/1
192.168.5.0/24 Static 60 0 RD 192.168.3.2 GigabitEthernet
0/0/2
192.168.6.0/24 Static 60 0 RD 192.168.2.2 GigabitEthernet
0/0/1
Static 60 0 RD 192.168.3.2 GigabitEthernet
0/0/2
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
2.对r2,已经有两条直接连接,需要配置四条静态路由,分别是1,3,5,6.
<r2>sys
Enter system view, return user view with Ctrl+Z.
[r2]ip route-static 192.168.1.0 24 192.168.2.1
[r2]ip route-static 192.168.3.0 24 192.168.2.1
[r2]ip route-static 192.168.5.0 24 192.168.4.2
[r2]ip route-static 192.168.6.0 24 192.168.4.2
[r2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Static 60 0 RD 192.168.2.1 GigabitEthernet
0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.2 GigabitEthernet
0/0/0
192.168.2.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.3.0/24 Static 60 0 RD 192.168.2.1 GigabitEthernet
0/0/0
192.168.4.0/24 Direct 0 0 D 192.168.4.1 GigabitEthernet
0/0/1
192.168.4.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.4.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.5.0/24 Static 60 0 RD 192.168.4.2 GigabitEthernet
0/0/1
192.168.6.0/24 Static 60 0 RD 192.168.4.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
3.对r3,已经有两条直接连接,需要配置四条静态路由,分别是1,2,4,6.
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]ip ro
[r3]ip route
[r3]ip route-static 192.168.1.0 24 192.168.3.1
[r3]ip route-static 192.168.2.0 24 192.168.3.1
[r3]ip route-static 192.168.4.0 24 192.168.5.2
[r3]ip route-static 192.168.6.0 24 192.168.5.2
[r3]display ip r
[r3]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Static 60 0 RD 192.168.3.1 GigabitEthernet
0/0/0
192.168.2.0/24 Static 60 0 RD 192.168.3.1 GigabitEthernet
0/0/0
192.168.3.0/24 Direct 0 0 D 192.168.3.2 GigabitEthernet
0/0/0
192.168.3.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.4.0/24 Static 60 0 RD 192.168.5.2 GigabitEthernet
0/0/1
192.168.5.0/24 Direct 0 0 D 192.168.5.1 GigabitEthernet
0/0/1
192.168.5.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.5.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.6.0/24 Static 60 0 RD 192.168.5.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
4.对r4,已经有三条直接连接,需要配置三条静态路由,分别是1,2,3
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ip r
[r4]ip rd-filter
[r4]ip ro
[r4]ip route-s
[r4]ip route-static 192.168.1.0 24 192.168.4.1
[r4]ip route-static 192.168.1.0 24 192.168.5.1
[r4]ip route-static 192.168.3.0 24 192.168.5.1
[r4]ip route-static 192.168.2.0 24 192.168.4.1
[r4]display ip r
[r4]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 16 Routes : 17
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Static 60 0 RD 192.168.4.1 GigabitEthernet
0/0/1
Static 60 0 RD 192.168.5.1 GigabitEthernet
0/0/0
192.168.2.0/24 Static 60 0 RD 192.168.4.1 GigabitEthernet
0/0/1
192.168.3.0/24 Static 60 0 RD 192.168.5.1 GigabitEthernet
0/0/0
192.168.4.0/24 Direct 0 0 D 192.168.4.2 GigabitEthernet
0/0/1
192.168.4.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.4.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.5.0/24 Direct 0 0 D 192.168.5.2 GigabitEthernet
0/0/0
192.168.5.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.5.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.6.0/24 Direct 0 0 D 192.168.6.1 GigabitEthernet
0/0/2
192.168.6.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.6.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
测试全网可达(由于篇幅设置,就展示两个结果,作者亲测,全网可达)