华为设备三层交换DHCP服务器+DHCP中继实验,实现全网互通

三层交换DHCP服务器+DHCP中继:实现全网互通
1.配置思路:
1).二层交换创建对应的vlan,与PC相连设置access,与交换互联设置trunk
2).三层交换创建vlan,与路由互联设置access,与交换互联设置trunk
3).设置DHCP,在vlanif25的虚接口上开启全局DHCP,在其他虚接口上开启基于端口的DHCP
4).在路由器上设置DHCP中继
5).测试验证:ipconfig,ping
2.实验拓扑图:华为设备三层交换DHCP服务器+DHCP中继实验,实现全网互通_第1张图片
3.实验步骤及命令:
1).LSW2配置命令:
system-view ----进入系统视图
[Huawei]sysname SW2 ----更改设备名字为SW2
[SW2]vlan batch 5 10 ----创建vlan
[SW2]interface Ethernet 0/0/1 ----进入端口
[SW2-Ethernet0/0/1]port link-type access ----更改链路类型为access
[SW2-Ethernet0/0/1]port default vlan 5 ----端口加入vlan
[SW2-Ethernet0/0/1]interface Ethernet 0/0/2 ----进入端口
[SW2-Ethernet0/0/2]port link-type access ----更改链路类型为access
[SW2-Ethernet0/0/2]port default vlan 10 ----端口加入vlan
[SW2-Ethernet0/0/2]interface Ethernet 0/0/3 ----进入端口
[SW2-Ethernet0/0/3]port link-type trunk ----更改链路类型为trunk
[SW2-Ethernet0/0/3]port trunk allow-pass vlan all ----允许所有vlan通过
2).LSW3配置命令:
system-view ----进入系统视图
[Huawei]sysname SW3 ----更改设备名字为SW3
[SW3]vlan batch 15 20 ----创建vlan
[SW3]interface Ethernet 0/0/1 ----进入端口
[SW3-Ethernet0/0/1]port link-type access ----更改链路类型为access
[SW3-Ethernet0/0/1]port default vlan 20 ----端口加入vlan
[SW3-Ethernet0/0/1]interface Ethernet 0/0/2 ----进入端口
[SW3-Ethernet0/0/2]port link-type access ----更改链路类型为access
[SW3-Ethernet0/0/2]port default vlan 15 ----端口加入vlan
[SW3-Ethernet0/0/2]interface Ethernet 0/0/3 ----进入端口
[SW3-Ethernet0/0/3]port link-type trunk ----更改链路类型为trunk
[SW3-Ethernet0/0/3]port trunk allow-pass vlan all ----允许所有vlan通过
3).LSW4(DHCP服务器)配置命令:
system-view ----进入系统视图
[Huawei]sysname DHCP ----更改设备名字为DHCP
[DHCP]vlan batch 5 10 15 20 25 ----创建vlan
[DHCP]port-group 1 ----创建组 1
[DHCP-port-group-1]group-member g0/0/1 g0/0/2 ----端口加入组
[DHCP-port-group-1]port link-type trunk ----组内端口更改链路类型为trunk
[DHCP-port-group-1]port trunk allow-pass vlan all ----允许所有vlan通过
[DHCP-port-group-1]quit -----返回上一视图
[DHCP]dhcp enable -----开启DHCP功能
[DHCP]ip pool 30 ----创建地址池 30
[DHCP-ip-pool-30]network 30.0.1.0 mask 24 -----宣告主网络
[DHCP-ip-pool-30]gateway 30.0.1.254 ----设置网关
[DHCP-ip-pool-30]dns-list 6.6.6.6 ----设置DNS地址
[DHCP-ip-pool-30]interface vlanif 5 ----进入虚接口
[DHCP-Vlanif5]ip address 10.0.5.254 24 ----设置IP和子网掩码
[DHCP-Vlanif5]dhcp select interface ----基于接口开启DHCP功能
[DHCP-Vlanif5]interface vlanif 10 ----进入虚接口
[DHCP-Vlanif10]ip address 10.0.10.254 24 ----设置IP和子网掩码
[DHCP-Vlanif10]dhcp select interface ----基于接口开启DHCP功能
[DHCP-Vlanif10]interface vlanif 15 ----进入虚接口
[DHCP-Vlanif15]ip address 10.0.15.254 24 ----设置IP和子网掩码
[DHCP-Vlanif15]dhcp select interface ----基于接口开启DHCP功能
[DHCP-Vlanif15]interface vlanif 20 ----进入虚接口
[DHCP-Vlanif20]ip address 10.0.20.254 24 ----设置IP和子网掩码
[DHCP-Vlanif20]dhcp select interface ----基于接口开启DHCP功能
[DHCP-Vlanif20]interface vlanif 25 ----进入虚接口
[DHCP-Vlanif25]ip address 10.0.25.1 24 ----设置IP和子网掩码
[DHCP-Vlanif25]dhcp select global ----基于全局开启DHCP功能
[DHCP-Vlanif25]quit ----返回上一视图
[DHCP]ip route-static 30.0.1.0 24 10.0.25.2 ----设置静态路由条目
4).AR3(DHCP中继)配置命令:
system-view ----进入系统视图
[Huawei]sysname DHCP zj ----更改设备名字为DHCP zj
[DHCP zj]dhcp enable -----开启DHCP功能
[DHCP zj]interface GigabitEthernet 0/0/0 ----进入端口
[DHCP zj-GigabitEthernet0/0/0]ip address 10.0.25.2 24 ----设置IP和子网掩码
[DHCP zj-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1 ----进入端口
[DHCP zj-GigabitEthernet0/0/1]ip address 30.0.1.254 24 ----设置IP和子网掩码
[DHCP zj-GigabitEthernet0/0/1]dhcp select relay ----启用DHCP中继功能
[DHCP zj-GigabitEthernet0/0/1]dhcp relay server-ip 10.0.25.1 -----指向DHCP服务器IP地址
[DHCP zj-GigabitEthernet0/0/1]quit ----返回上一视图
[DHCP zj]ip route-static 0.0.0.0 0.0.0.0 10.0.25.1 ----设置默认路由条目
5).测试验证:ipconfig,ping
华为设备三层交换DHCP服务器+DHCP中继实验,实现全网互通_第2张图片

你可能感兴趣的:(网络运维)