三、实验一相关知识点
DHCP 动态主机配置协议 —自动为上网的主机分配上网参数
主机第一次接入网络 —查看此网络有没有为自己分配上网参数的DHCP服务器
—发现阶段 discover 报文—广播方式
—提供阶段 offer 单播回应
—请求阶段 request 确定使用哪台服务器提供的参数-广播
—确认阶段 ACK /NOACK —单播
租期:分配的参数不是 永久的 有期限的 ,华为网络设备上 ,默认租期24小时
续租: 租期 50% 单播续租
租期 87.5% 广播续租
注意: 客户端和DHCP服务器 一般处于同一个网段, 如果DHCP服务器和分配参数的主机不在一个网段,需要主机借助和自己在同一个网段的中继来找到DHCP服务器
实验:DHCP服务器+中继
需求:
1,实现全网主机互相通信
2,主机地址都是通过一台DHCP服务器 获取到的 ,这个网络是个商场的网络,人流量比较大,请根据实际情况进行配置
拓扑:
配置思路:
1,配置基本的IP地址信息
2,配置静态路由
3,配置DHCP服务器
4,配置DHCP中继
5,测试验证
配置步骤:
1,配置基本的IP地址信息
<Huawei>un t m
<Huawei>sy
[Huawei]sy SW1
[SW1]vlan 10
[SW1-vlan10]q
[SW1]port-group group-member g0/0/1 to g0/0/3
[SW1-port-group]port link-type access
[SW1-port-group]port default vlan 10
<Huawei>sy
[Huawei]sy SW2
[SW2]vlan 100
[SW2-vlan100]q
[SW2]port-group group-member g0/0/1 to g0/0/3
[SW2-port-group]p l a
[SW2-port-group]p d v 100
2,配置静态路由
[R1]ip route-static 192.168.3.0 24 192.168.2.2
[R1]ip route-static 192.168.4.0 24 192.168.2.2
[R1]ip route-static 192.168.5.0 24 192.168.2.2
[R2]ip route-static 192.168.1.0 24 192.168.2.1
[R2]ip route-static 192.168.4.0 24 192.168.3.1
[R3]ip route-static 192.168.1.0 24 192.168.3.2
[R3]ip route-static 192.168.2.0 24 192.168.3.2
[R3]ip route-static 192.168.5.0 24 192.168.3.2
3,配置DHCP服务器
[R1]dhcp enable //开启DHCP功能
[R1]ip pool wt1.0 //配置地址池,名字wt1.0
[R1-ip-pool-wt1.0]network 192.168.1.0 mask 24 //配置分配的地址段
[R1-ip-pool-wt1.0]gateway-list 192.168.1.254 //配置分配的网关地址
[R1-ip-pool-wt1.0]dns-list 114.114.114.114 //配置分配的DNS
[R1-ip-pool-wt1.0]lease day 0 hour 2 //配置分配的租期
[R1-ip-pool-wt1.0]excluded-ip-address 192.168.1.253 192.168.1.253 //配置排除的地址段
[R1-ip-pool-wt1.0]excluded-ip-address 192.168.1.250
[R1]ip pool wt4.0
[R1-ip-pool-wt4.0]network 192.168.4.0 mask 24
[R1-ip-pool-wt4.0]gateway-list 192.168.4.254
[R1-ip-pool-wt4.0]dns-list 8.8.8.8
[R1-ip-pool-wt4.0]lease day 0 hour 2
[R1-ip-pool-wt4.0]excluded-ip-address 192.168.4.250 192.168.4.253
[R1-ip-pool-wt4.0]q
[R1]ip pool wt5.0
[R1-ip-pool-wt5.0]network 192.168.5.0 mask 24
[R1-ip-pool-wt5.0]gateway-list 192.168.5.254
[R1-ip-pool-wt5.0]dns-list 7.7.7.7
[R1-ip-pool-wt5.0]lease day 0 hour 2 minute 6
[R1-ip-pool-wt5.0]q
[R1]INT G0/0/1 //在与终端相连的接口方向开启DHCP功能
[R1-GigabitEthernet0/0/1]dhcp select global
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global
4,配置DHCP中继 (和获取参数的主机同一网段)
[R2]dhcp enable //开启DHCP 功能
[R2]in g0/0/2
[R2-GigabitEthernet0/0/2]dhcp select relay //与终端相连的网关接口开启中继
[R2-GigabitEthernet0/0/2]dhcp relay server-ip 192.168.2.1 //配置指向DHCP服务器的地址
[R3]dhcp enable
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]dhcp select relay
[R3-GigabitEthernet0/0/1]dhcp relay server-ip 192.168.2.1
5,测试验证
PC 点击 DHCP —应用
命令行 ipconfig
实验:链路聚合
需求“
1,SW1 和SW2 通过手动聚合 ,实现链路捆绑,增加带宽
2,SW2 和 SW3 通过动态LACP聚合,实现增加带宽的目的
三根线路只聚合两根: 7/8 ?
拓扑:
静态聚合配置思路:
1,配置终端IP地址信息
2,配置交换机
-创建VLAN
-配置链路聚合
-聚合类型
-将物理接口加入聚合口
-在逻辑的聚合口配置链路类型
3,验证
配置命令:
<Huawei>un t m
<Huawei>sy
[Huawei]sy SW1
[SW1]vlan batch 10 20
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 10
<Huawei>un t m
<Huawei>sy
[Huawei]sy SW2
[SW2]vlan batch 10 20
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 10
[SW2-GigabitEthernet0/0/1]q
[SW2]int g0/0/7
[SW2-GigabitEthernet0/0/7]port link-type access
[SW2-GigabitEthernet0/0/7]port default vlan 20
[SW2-GigabitEthernet0/0/7]q
<Huawei>SY
[Huawei]SY sw3
[sw3]vlan batch 10 20
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type access
[sw3-GigabitEthernet0/0/1]port default vlan 20
=====
配置静态聚合:
[SW1]interface Eth-Trunk 1
[SW1-Eth-Trunk1]mode manual load-balance
[SW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/2 to 0/0/3
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan all
[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]trunkport g0/0/2
[SW2-Eth-Trunk1]trunkport g0/0/3
[SW2-Eth-Trunk1]port link-type trunk
[SW2-Eth-Trunk1]port trunk allow-pass vlan all
[SW1]dis eth-trunk 1
Eth-Trunk1's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 2
PortName Status Weight
GigabitEthernet0/0/2 Up 1
GigabitEthernet0/0/3 Up 1
[SW1]dis interface Eth-Trunk 1
Eth-Trunk1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW:2G, Current BW: 2G, The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc7e-19f8
Current system time: 2023-04-27 15:41:54-08:00
Input bandwidth utilization : 0%
Output bandwidth utilization : 0%
PortName Status Weight
GigabitEthernet0/0/2 UP 1
GigabitEthernet0/0/3 UP 1
**[SW1]dis interface brief **
Interface PHY Protocol InUti OutUti inErrors outErrors
Eth-Trunk1 up up 0% 0% 0 0
GigabitEthernet0/0/2 up up 0% 0% 0 0
GigabitEthernet0/0/3 up up 0% 0% 0 0
GigabitEthernet0/0/1 up up 0% 0% 0 0
ping 测试 ping 192.168.10.3 将 其中一个接口 shutdown ,丢几个包后恢复通信 ,具有容错性
配置动态聚合:
动态聚合配置思路:
1,配置终端IP地址信息
2,配置交换机
-创建VLAN
-配置链路聚合
-聚合类型
-将物理接口加入聚合口
-在逻辑的聚合口配置链路类型
-配置动态聚合参数
-配置主动端
-最大活动链路数
-选取活动的链路-确定转发数据
-抢占功能
3,验证
动态聚合基本配置命令:
[SW2]interface Eth-Trunk 2
[SW2-Eth-Trunk2]mode lacp-static
[SW2-Eth-Trunk2]trunkport g0/0/4
[SW2-Eth-Trunk2]trunkport g0/0/5
[SW2-Eth-Trunk2]trunkport g0/0/6
[SW2-Eth-Trunk2]port link-type trunk
[SW2-Eth-Trunk2]port trunk allow-pass vlan all
[sw3]interface Eth-Trunk 2
[sw3-Eth-Trunk2]mode lacp-static
[sw3-Eth-Trunk2]trunkport g0/0/7
[sw3-Eth-Trunk2]trunkport g0/0/8
[sw3-Eth-Trunk2]trunkport g0/0/9
[sw3-Eth-Trunk2]port link-type trunk
[sw3-Eth-Trunk2]port trunk allow-pass vlan all
配置SW3为主动端:
[sw3]lacp priority 1000
配置最大的活动链路数—用来转发数据的链路舒朗
[sw3-Eth-Trunk2]max active-linknumber 2
选择活动的链路—具体用哪些链路转发数据(从三个接口中,选择哪两个接口转发数据)
[sw3]int g0/0/9
[sw3-GigabitEthernet0/0/9]lacp priority 1000
开启抢占功能 ,默认是关闭的
[sw3-Eth-Trunk2]lacp preempt enable
[sw3-Eth-Trunk2]lacp preempt delay 10
验证:
[sw3]dis eth-trunk 2
实验:单臂路由+三层交换+链路聚合+生成树+DHCP
配置文档:
<sw1>dis cur
#
sysname sw1
#
vlan batch 11 to 12
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 11
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 12
==============
<SW2>dis cu
#
sysname SW2
#
vlan batch 13 to 14
#
interface Vlanif1
ip address 192.168.3.1 255.255.255.0
#
interface Vlanif13
ip address 192.168.13.254 255.255.255.0
dhcp select relay
dhcp relay server-ip 192.168.2.1
#
interface Vlanif14
ip address 192.168.14.254 255.255.255.0
dhcp select relay
dhcp relay server-ip 192.168.2.1
#
interface GigabitEthernet0/0/1
port link-type access
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
ip route-static 0.0.0.0 0.0.0.0 192.168.3.2
============================
<SW3>dis cu
#
sysname SW3
#
vlan batch 13 to 14
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port hybrid pvid vlan 13
port hybrid untagged vlan 13
#
===============================
<SW4>dis cu
#
sysname SW4
#
vlan batch 13 to 14
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port hybrid pvid vlan 14
port hybrid untagged vlan 14
#
=================================
<SW9>dis cu
#
sysname SW9
#
vlan batch 17 to 18
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
mode lacp-static
lacp preempt enable
#
interface Eth-Trunk3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
mode lacp-static
lacp preempt enable
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
eth-trunk 1
#
interface GigabitEthernet0/0/3
eth-trunk 3
#
interface GigabitEthernet0/0/4
eth-trunk 1
#
interface GigabitEthernet0/0/5
eth-trunk 3
#
==========================
<SW10>dis cu
#
sysname SW10
#
vlan batch 17 to 18
#
stp instance 0 priority 4096
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
mode lacp-static
lacp preempt enable
#
interface Eth-Trunk2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
mode lacp-static
lacp preempt enable
#
interface GigabitEthernet0/0/1
eth-trunk 1
#
interface GigabitEthernet0/0/2
eth-trunk 2
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 17
#
interface GigabitEthernet0/0/4
eth-trunk 1
#
interface GigabitEthernet0/0/6
eth-trunk 2
#
===========================
<SW11>dis cur
#
sysname SW11
#
vlan batch 17 to 18
#
interface Eth-Trunk2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
mode lacp-static
lacp preempt enable
#
interface Eth-Trunk3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
mode lacp-static
lacp preempt enable
#
interface GigabitEthernet0/0/1
eth-trunk 3
#
interface GigabitEthernet0/0/2
eth-trunk 2
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 18
#
interface GigabitEthernet0/0/5
eth-trunk 3
#
interface GigabitEthernet0/0/6
eth-trunk 2
#
========================
<R1>dis cu
#
sysname R1
#
dhcp enable
#
interface GigabitEthernet0/0/0.11
dot1q termination vid 11
ip address 192.168.11.254 255.255.255.0
arp broadcast enable
dhcp select relay
dhcp relay server-ip 192.168.2.1
#
interface GigabitEthernet0/0/0.12
dot1q termination vid 12
ip address 192.168.12.254 255.255.255.0
arp broadcast enable
dhcp select relay
dhcp relay server-ip 192.168.2.1
#
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.2
#
=============================
<R2>dis cu
#
sysname R2
#
interface GigabitEthernet0/0/0
ip address 192.168.3.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.1.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.2.2 255.255.255.0
#
ip route-static 192.168.11.0 255.255.255.0 192.168.1.1
ip route-static 192.168.12.0 255.255.255.0 192.168.1.1
ip route-static 192.168.13.0 255.255.255.0 192.168.3.1
ip route-static 192.168.14.0 255.255.255.0 192.168.3.1
ip route-static 192.168.17.0 255.255.255.0 192.168.2.1
ip route-static 192.168.18.0 255.255.255.0 192.168.2.1
#
================================
<R3>dis cu
#
sysname R3
#
dhcp enable
#
ip pool wt11
gateway-list 192.168.11.254
network 192.168.11.0 mask 255.255.255.0
dns-list 1.1.1.1
#
ip pool wt12
gateway-list 192.168.12.254
network 192.168.12.0 mask 255.255.255.0
dns-list 2.2.2.2
#
ip pool wt13
gateway-list 192.168.13.254
network 192.168.13.0 mask 255.255.255.0
dns-list 3.3.3.3
#
ip pool wt14
gateway-list 192.168.14.254
network 192.168.14.0 mask 255.255.255.0
lease day 2 hour 0 minute 0
dns-list 4.4.4.4
#
ip pool wt17
gateway-list 192.168.17.254
network 192.168.17.0 mask 255.255.255.0
dns-list 7.7.7.7
#
ip pool wt18
gateway-list 192.168.18.254
network 192.168.18.0 mask 255.255.255.0
lease day 4 hour 0 minute 0
dns-list 8.8.8.8
#
interface GigabitEthernet0/0/0.17
dot1q termination vid 17
ip address 192.168.17.254 255.255.255.0
arp broadcast enable
dhcp select global
#
interface GigabitEthernet0/0/0.18
dot1q termination vid 18
ip address 192.168.18.254 255.255.255.0
arp broadcast enable
dhcp select global
#
interface GigabitEthernet0/0/1
ip address 192.168.2.1 255.255.255.0
dhcp select global
#
ip route-static 0.0.0.0 0.0.0.0 192.168.2.2
#
===========================