DHCP+DHCP中继
- 实验拓扑
- 配置步骤
- 第一步 配置Eth-Trunk聚合链路&二层VLAN
- 第二步 配置IP地址
- 第三步 配置DHCP+DHCP中继
- 配置验证
- 查看PC1 PC2是否正确的获得了IP地址
实验拓扑
配置步骤
第一步 配置Eth-Trunk聚合链路&二层VLAN
SW1
sysname SW1
#
undo info-center enable //关闭日志信息
#
vlan batch 10 20 100 //创建多个vlan
#
interface Eth-Trunk1 //创建Eth-Trunk1,并放行相应的vlanport link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2 //配置accessport link-type accessport default vlan 100
#
interface GigabitEthernet0/0/3port link-type accessport default vlan 10
#
interface GigabitEthernet0/0/10eth-trunk 1
#
interface GigabitEthernet0/0/11eth-trunk 1
SW2
sysname SW2
#
undo info-center enable
#
vlan batch 10 20 100
#
interface Eth-Trunk1port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3 //把接终端的设备配置为trunk,也可以起到acess的效果port link-type trunkport trunk pvid vlan 20port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/10eth-trunk 1
#
interface GigabitEthernet0/0/11eth-trunk 1
第二步 配置IP地址
DHCP
interface GigabitEthernet0/0/0ip address 192.168.100.1 255.255.255.0
GW
interface GigabitEthernet0/0/0.10dot1q termination vid 10ip address 192.168.10.254 255.255.255.0 arp broadcast enable#
interface GigabitEthernet0/0/0.20dot1q termination vid 20ip address 192.168.20.254 255.255.255.0 arp broadcast enable#
interface GigabitEthernet0/0/0.100dot1q termination vid 100 ip address 192.168.100.254 255.255.255.0 arp broadcast enable
第三步 配置DHCP+DHCP中继
DHCP
sysname DHCP
#
dhcp enable //开启全局DHCP
#
ip pool VLAN10 //创建DHCP地址池 名称为 VLAN10gateway-list 192.168.10.254 //配置网关network 192.168.10.0 mask 255.255.255.0 //IPv4地址dns-list 1.1.1.1 2.2.2.2 //DNS
#
ip pool VLAN20 gateway-list 192.168.20.254 network 192.168.20.0 mask 255.255.255.0 dns-list 3.3.3.3 8.8.8.8
#
interface GigabitEthernet0/0/0dhcp select global //接口上启用这个DHCP
#
//给DHCP Server 配置一个默认网关 下一跳指向GW
//这条默认路由也可以理解为是PC的网关
ip route-static 0.0.0.0 0.0.0.0 192.168.100.254
GW
sysname GW
#
dhcp enable
#
interface GigabitEthernet0/0/0.10dhcp select relay //开启DHCP中继dhcp relay server-ip 192.168.100.1 //指向DHCP服务器的IP地址
#
interface GigabitEthernet0/0/0.20dhcp select relaydhcp relay server-ip 192.168.100.1
配置验证
查看PC1 PC2是否正确的获得了IP地址