网络拓扑图搭建二——DHCP分配主机地址,中继路由配置

pepe实验需求:各PC通过交换机LSW5或者路由器AR4的DHCP服务静态获取IP地址,各PC之间可以正常访问彼此

一.实验拓扑图

网络拓扑图搭建二——DHCP分配主机地址,中继路由配置_第1张图片

 二.实验环境配置

各个PC配置如下

网络拓扑图搭建二——DHCP分配主机地址,中继路由配置_第2张图片

 LSW1配置:

e0/0/1 e0/0/2为access接口,g0/0/2为trunkj接口

LSW4配置类似LSW1

LSW5配置:

首先配置接口类型g0/0/2 g0/0/3 g0/0/1都是trunk接口

[Huawei]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]p	
[Huawei-GigabitEthernet0/0/2]port l	
[Huawei-GigabitEthernet0/0/2]port link-t	
[Huawei-GigabitEthernet0/0/2]port link-type t	
[Huawei-GigabitEthernet0/0/2]port link-type trunk 
[Huawei-GigabitEthernet0/0/2]p	
[Huawei-GigabitEthernet0/0/2]port t	
[Huawei-GigabitEthernet0/0/2]port trunk a	
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass v	
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan a	
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan all 
[Huawei-GigabitEthernet0/0/2]int g0/0/3
[Huawei-GigabitEthernet0/0/3]p	
[Huawei-GigabitEthernet0/0/3]port l	
[Huawei-GigabitEthernet0/0/3]port link-t	
[Huawei-GigabitEthernet0/0/3]port link-type t	
[Huawei-GigabitEthernet0/0/3]port link-type trunk 
[Huawei-GigabitEthernet0/0/3]p	
[Huawei-GigabitEthernet0/0/3]port t	
[Huawei-GigabitEthernet0/0/3]port trunk a	
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass v	
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan a	
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan all 
[Huawei-GigabitEthernet0/0/3]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p	
[Huawei-GigabitEthernet0/0/1]port l	
[Huawei-GigabitEthernet0/0/1]port link-t	
[Huawei-GigabitEthernet0/0/1]port link-type t	
[Huawei-GigabitEthernet0/0/1]port link-type trunk 
[Huawei-GigabitEthernet0/0/1]p	
[Huawei-GigabitEthernet0/0/1]port t	
[Huawei-GigabitEthernet0/0/1]port trunk a	
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass v	
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan a	
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all 

三层交换机设置vlanif接口地址实现不同之间的vlan和路由之间通信

[Huawei]int Vlanif 10
[Huawei-Vlanif10]ip add 192.168.10.254 24
[Huawei-Vlanif10]q
[Huawei]int v	
[Huawei]int Vlanif 20
[Huawei-Vlanif20]ip add 192.168.20.254 24
[Huawei-Vlanif20]
[Huawei-Vlanif20]int v	
[Huawei-Vlanif20]int v	
[Huawei-Vlanif20]int vl	
[Huawei-Vlanif20]q
[Huawei]int v	
[Huawei]int Vlanif 1
[Huawei-Vlanif1]ip add 15.0.0.5 24
[Huawei-Vlanif1]q

设置默认静态路由协议,实现与其他网段的通信

[Huawei]ip route-static 0.0.0.0 0 15.0.0.1

配置DHCP服务

[Huawei]dhcp enable 开启DHCP服务
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]ip p	
[Huawei]ip pool dhcp 10 配置DHCP地址池
                     ^
Error:Too many parameters found at '^' position.
[Huawei]ip pool dhcp10
Info:It's successful to create an IP address pool.
[Huawei-ip-pool-dhcp10]n	
[Huawei-ip-pool-dhcp10]ne	
[Huawei-ip-pool-dhcp10]net	
[Huawei-ip-pool-dhcp10]network 192.168.10.0 ma	
[Huawei-ip-pool-dhcp10]network 192.168.10.0 mask 24
[Huawei-ip-pool-dhcp10]gate	
[Huawei-ip-pool-dhcp10]gateway-list 192.168.10.254
[Huawei-ip-pool-dhcp10]d	
[Huawei-ip-pool-dhcp10]dns-list 8.8.8.8
[Huawei-ip-pool-dhcp10]e	
[Huawei-ip-pool-dhcp10]excluded-ip-address 192.168.10.254
Error:Only idle or expired IP address can be disabled.
[Huawei-ip-pool-dhcp10]l	
[Huawei-ip-pool-dhcp10]lease d	
[Huawei-ip-pool-dhcp10]lease day 2
[Huawei-ip-pool-dhcp10]q
[Huawei]ip pool d	
[Huawei]ip pool dhcp20
Info:It's successful to create an IP address pool.
[Huawei-ip-pool-dhcp20]n	
[Huawei-ip-pool-dhcp20]net	
[Huawei-ip-pool-dhcp20]network 192.168.20.0 m	
[Huawei-ip-pool-dhcp20]network 192.168.20.0 mask 24
[Huawei-ip-pool-dhcp20]gat	
[Huawei-ip-pool-dhcp20]gateway-list 192.168.20.254
[Huawei-ip-pool-dhcp20]d	
[Huawei-ip-pool-dhcp20]dns-list 8.8.8.8 
[Huawei-ip-pool-dhcp20]e	
[Huawei-ip-pool-dhcp20]excluded-ip-address 192.168.20.254
Error:Only idle or expired IP address can be disabled.
[Huawei-ip-pool-dhcp20]l	
[Huawei-ip-pool-dhcp20]lease da	
[Huawei-ip-pool-dhcp20]lease day 2
[Huawei-ip-pool-dhcp20]q
进入vlanif对应接口,开启地址池功能
[Huawei]int Vlanif 10
[Huawei-Vlanif10]d	
[Huawei-Vlanif10]dhcp s	
[Huawei-Vlanif10]dhcp seg	
[Huawei-Vlanif10]dhcp sse	
[Huawei-Vlanif10]dhcp se	
[Huawei-Vlanif10]dhcp select g	
[Huawei-Vlanif10]dhcp select global 
[Huawei-Vlanif10]q
[Huawei]int	
[Huawei]interface v	
[Huawei]interface Vlanif 20
[Huawei-Vlanif20]d	
[Huawei-Vlanif20]dhcp s	
[Huawei-Vlanif20]dhcp se 	
[Huawei-Vlanif20]dhcp select g	
[Huawei-Vlanif20]dhcp select global 
[Huawei-Vlanif20]q

AR1配置:

首先配置直连接口地址

[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.1 24

使用静态路由协议实现与其他网段互通

[Huawei]ip route-static 192.168.10.0 24 15.0.0.5
[Huawei]ip route-static 192.168.20.0 24 15.0.0.5
[Huawei]ip route-static 192.168.30.0 24 12.0.0.2
[Huawei]ip route-static 192.168.40.0 24 12.0.0.2
[Huawei]ip route-static 192.168.50.0 24 12.0.0.2
[Huawei]ip route-static 23.0.0.0 24 12.0.0.2

结果一;pc1 pc2 pc5 pc6通过DHCP获取地址,可以相互通信

使用ipconfig命令查看

网络拓扑图搭建二——DHCP分配主机地址,中继路由配置_第3张图片

网络拓扑图搭建二——DHCP分配主机地址,中继路由配置_第4张图片

 LSW7配置:

首先配置接口类型

[Huawei]vlan batch 30 40 50
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/4
[Huawei-Ethernet0/0/4]p	
[Huawei-Ethernet0/0/4]port l	
[Huawei-Ethernet0/0/4]port link-t	
[Huawei-Ethernet0/0/4]port link-type a	
[Huawei-Ethernet0/0/4]port link-type access 
[Huawei-Ethernet0/0/4]p	
[Huawei-Ethernet0/0/4]port de	
[Huawei-Ethernet0/0/4]port default v	
[Huawei-Ethernet0/0/4]port default vlan 30
[Huawei-Ethernet0/0/4]int e0/0/2
[Huawei-Ethernet0/0/2]p	
[Huawei-Ethernet0/0/2]port l	
[Huawei-Ethernet0/0/2]port link-t	
[Huawei-Ethernet0/0/2]port link-type a	
[Huawei-Ethernet0/0/2]port link-type access 
[Huawei-Ethernet0/0/2]p	
[Huawei-Ethernet0/0/2]port de	
[Huawei-Ethernet0/0/2]port default v	
[Huawei-Ethernet0/0/2]port default vlan 40
[Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]p	
[Huawei-Ethernet0/0/3]port l	
[Huawei-Ethernet0/0/3]port link-t	
[Huawei-Ethernet0/0/3]port link-type a	
[Huawei-Ethernet0/0/3]port link-type access 
[Huawei-Ethernet0/0/3]p	
[Huawei-Ethernet0/0/3]port d	
[Huawei-Ethernet0/0/3]port de	
[Huawei-Ethernet0/0/3]port default v	
[Huawei-Ethernet0/0/3]port default vlan 50
[Huawei-Ethernet0/0/3]int e0/0/1
[Huawei-Ethernet0/0/1]p	
[Huawei-Ethernet0/0/1]port l	
[Huawei-Ethernet0/0/1]port link-t	
[Huawei-Ethernet0/0/1]port link-type t	
[Huawei-Ethernet0/0/1]port link-type trunk 
[Huawei-Ethernet0/0/1]p	
[Huawei-Ethernet0/0/1]port t	
[Huawei-Ethernet0/0/1]port trunka	
[Huawei-Ethernet0/0/1]port trunk a	
[Huawei-Ethernet0/0/1]port trunk allow-pass v	
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan a	
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all 
[Huawei-Ethernet0/0/1]q

由于二层交换机不能实现互通,利用单臂路由服务

AR2配置:

首先配置接口

[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 23.0.0.2 24
[Huawei-GigabitEthernet0/0/2]q
[Huawei]ip route-static 192.168.10.0 24 12.0.0.1
[Huawei]ip route-static 192.168.20.0 24 12.0.0.1
[Huawei]ip route-static 15.0.0.0 24 12.0.0.1

进入g0/0/1的子接口下配置单臂路由服务,实现通信

[Huawei]int g0/0/1.1
[Huawei-GigabitEthernet0/0/1.1]ip add	
[Huawei-GigabitEthernet0/0/1.1]ip address  192.168.30.254 24
[Huawei-GigabitEthernet0/0/1.1]do	
[Huawei-GigabitEthernet0/0/1.1]dot1q t	
[Huawei-GigabitEthernet0/0/1.1]dot1q termination v	
[Huawei-GigabitEthernet0/0/1.1]dot1q termination vid 30
[Huawei-GigabitEthernet0/0/1.1]a 	
[Huawei-GigabitEthernet0/0/1.1]arp b	
[Huawei-GigabitEthernet0/0/1.1]arp broadcast e	
[Huawei-GigabitEthernet0/0/1.1]arp broadcast enable 
[Huawei-GigabitEthernet0/0/1.1]q
[Huawei]int g0/0/1.2
[Huawei-GigabitEthernet0/0/1.2]ip add	
[Huawei-GigabitEthernet0/0/1.2]ip address 192.168.40.254 24
[Huawei-GigabitEthernet0/0/1.2]do t v 40
[Huawei-GigabitEthernet0/0/1.2]a b e
[Huawei-GigabitEthernet0/0/1.2]q
[Huawei]int g0/0/1.3
[Huawei-GigabitEthernet0/0/1.3]ip add	
[Huawei-GigabitEthernet0/0/1.3]ip address 192.168.50.254 24
[Huawei-GigabitEthernet0/0/1.3]do	
[Huawei-GigabitEthernet0/0/1.3]dot1q  t	
[Huawei-GigabitEthernet0/0/1.3]dot1q  termination e	
[Huawei-GigabitEthernet0/0/1.3]dot1q  termination e
[Huawei-GigabitEthernet0/0/1.3]dot1q  termination v	
[Huawei-GigabitEthernet0/0/1.3]dot1q  termination vid 50
[Huawei-GigabitEthernet0/0/1.3]a b e
[Huawei-GigabitEthernet0/0/1.3]q

进入g0/0/1的子接口 ,开启DHCP服务,配置中继路由

[Huawei]int g0/0/1.1
[Huawei-GigabitEthernet0/0/1.1]dhcp s	
[Huawei-GigabitEthernet0/0/1.1]dhcp select r	
[Huawei-GigabitEthernet0/0/1.1]dhcp select relay 
[Huawei-GigabitEthernet0/0/1.1]d	
[Huawei-GigabitEthernet0/0/1.1]dh	
[Huawei-GigabitEthernet0/0/1.1]dhcp r	
[Huawei-GigabitEthernet0/0/1.1]dhcp relay s	
[Huawei-GigabitEthernet0/0/1.1]dhcp relay server-ip 20.0.0.3
[Huawei-GigabitEthernet0/0/1.1]undo dhcp r	
[Huawei-GigabitEthernet0/0/1.1]undo dhcp relay r	
[Huawei-GigabitEthernet0/0/1.1]undo dhcp relay s	
[Huawei-GigabitEthernet0/0/1.1]undo dhcp relay server-ip 20.0.0.3
[Huawei-GigabitEthernet0/0/1.1]d	
[Huawei-GigabitEthernet0/0/1.1]dh	
[Huawei-GigabitEthernet0/0/1.1]dhcp r	
[Huawei-GigabitEthernet0/0/1.1]dhcp relay s	
[Huawei-GigabitEthernet0/0/1.1]dhcp relay server-ip 23.0.0.3
[Huawei-GigabitEthernet0/0/1.1]q
[Huawei]int g0/0/1.2
[Huawei-GigabitEthernet0/0/1.2]d	
[Huawei-GigabitEthernet0/0/1.2]dh	
[Huawei-GigabitEthernet0/0/1.2]dhcp s	
[Huawei-GigabitEthernet0/0/1.2]dhcp select r	
[Huawei-GigabitEthernet0/0/1.2]dhcp select relay 
[Huawei-GigabitEthernet0/0/1.2]d	
[Huawei-GigabitEthernet0/0/1.2]dh	
[Huawei-GigabitEthernet0/0/1.2]dhcp r	
[Huawei-GigabitEthernet0/0/1.2]dhcp relay s	
[Huawei-GigabitEthernet0/0/1.2]dhcp relay server-ip 23.0.0.3
[Huawei-GigabitEthernet0/0/1.2]q
[Huawei]int g0/0/1.3
[Huawei-GigabitEthernet0/0/1.3]d	
[Huawei-GigabitEthernet0/0/1.3]dh	
[Huawei-GigabitEthernet0/0/1.3]dhcp s	
[Huawei-GigabitEthernet0/0/1.3]dhcp select r	
[Huawei-GigabitEthernet0/0/1.3]dhcp select relay 
[Huawei-GigabitEthernet0/0/1.3]d	
[Huawei-GigabitEthernet0/0/1.3]dh	
[Huawei-GigabitEthernet0/0/1.3]dhcp r	
[Huawei-GigabitEthernet0/0/1.3]dhcp relay s	
[Huawei-GigabitEthernet0/0/1.3]dhcp relay server-ip 23.0.0.3
[Huawei-GigabitEthernet0/0/1.3]q

AR4配置

首先配置接口和默认静态路由

[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 23.0.0.3 24
[Huawei-GigabitEthernet0/0/2]q
[Huawei]ip rou	
[Huawei]ip route	
[Huawei]ip route-static 0.0.0.0 0 23.0.0.2

 配置DHCP地址池,为PC7 PC3 PC4 分配IP地址

[Huawei]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]ip po	
[Huawei]ip pool d	
[Huawei]ip pool dhcp30
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-dhcp30]n	
[Huawei-ip-pool-dhcp30]netw	
[Huawei-ip-pool-dhcp30]network 192.168.30.0 m	
[Huawei-ip-pool-dhcp30]network 192.168.30.0 mask 24
[Huawei-ip-pool-dhcp30]gat	
[Huawei-ip-pool-dhcp30]gateway-list 192.168.30.254
[Huawei-ip-pool-dhcp30]d	
[Huawei-ip-pool-dhcp30]dn	
[Huawei-ip-pool-dhcp30]dns-list 8.8.8.8
[Huawei-ip-pool-dhcp30]e	
[Huawei-ip-pool-dhcp30]excluded-ip-address 192.168.30.254
Error:Only idle or expired IP address can be disabled.
[Huawei-ip-pool-dhcp30]l	
[Huawei-ip-pool-dhcp30]lease d	
[Huawei-ip-pool-dhcp30]lease day 2
[Huawei-ip-pool-dhcp30]q
[Huawei]ip pool d	
[Huawei]ip pool dhcp40
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-dhcp40]n	
[Huawei-ip-pool-dhcp40]ne	
[Huawei-ip-pool-dhcp40]network 192.168.40.0 m	
[Huawei-ip-pool-dhcp40]network 192.168.40.0 mask 24
[Huawei-ip-pool-dhcp40]g	
[Huawei-ip-pool-dhcp40]gateway-list 192.168.40.254
[Huawei-ip-pool-dhcp40]d	
[Huawei-ip-pool-dhcp40]dn	
[Huawei-ip-pool-dhcp40]dns-list 8.8.8.8
[Huawei-ip-pool-dhcp40]l	
[Huawei-ip-pool-dhcp40]lease d	
[Huawei-ip-pool-dhcp40]lease day 2
[Huawei-ip-pool-dhcp40]q
[Huawei]ip pool d	
[Huawei]ip pool dhcp50
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-dhcp50]net	
[Huawei-ip-pool-dhcp50]network 192.168.50.0 m	
[Huawei-ip-pool-dhcp50]network 192.168.50.0 mask 24
[Huawei-ip-pool-dhcp50]g	
[Huawei-ip-pool-dhcp50]gateway-list 192.168.50.254
[Huawei-ip-pool-dhcp50]d	
[Huawei-ip-pool-dhcp50]dn	
[Huawei-ip-pool-dhcp50]dns-list 8.8.8.8
[Huawei-ip-pool-dhcp50]l	
[Huawei-ip-pool-dhcp50]lease d	
[Huawei-ip-pool-dhcp50]lease day 2
[Huawei-ip-pool-dhcp50]q

进入g0/0/2接口,开启DHCP地址池功能

[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]d	
[Huawei-GigabitEthernet0/0/2]dh	
[Huawei-GigabitEthernet0/0/2]dhcp s	
[Huawei-GigabitEthernet0/0/2]dhcp select gobal

三.实验结果

各个pc之间都可以互相访问

四.实验总结

交换机配置vlanif实现通信;路由器配置单臂路由实现通信

交换机开启DHCP服务,配置DHCP地址池,在vlanif接口开启地址池功能,为PC分配IP地址

路由器开启DHCP服务,配置DHCP地址池,在对应接口开启地址池功能,为PC分配IP地址

中继路由开启DHCP服务,在子接口开启地址池功能;配置中继服务,使用此功能后DHCP报文通过中继发送到外部DHCP服务器,外部服务器分配地址,配置DHCP中继所代理的DHCP服务器地址

你可能感兴趣的:(网络,服务器,运维)