HCIA-DHCP+DHCP中继

DHCP+DHCP中继

  • 实验拓扑
  • 配置步骤
    • 第一步 配置Eth-Trunk聚合链路&二层VLAN
    • 第二步 配置IP地址
    • 第三步 配置DHCP+DHCP中继
  • 配置验证
    • 查看PC1 PC2是否正确的获得了IP地址

实验拓扑

HCIA-DHCP+DHCP中继_第1张图片

配置步骤

第一步 配置Eth-Trunk聚合链路&二层VLAN

SW1

sysname SW1
#
undo info-center enable //关闭日志信息
#
vlan batch 10 20 100   //创建多个vlan
#
interface Eth-Trunk1  //创建Eth-Trunk1,并放行相应的vlan
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2   //配置access
 port link-type access
 port default vlan 100
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/10
 eth-trunk 1
#
interface GigabitEthernet0/0/11
 eth-trunk 1

SW2

sysname SW2
#
undo info-center enable
#
vlan batch 10 20 100
#
interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3  //把接终端的设备配置为trunk,也可以起到acess的效果
 port link-type trunk
 port trunk pvid vlan 20
 port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/10
 eth-trunk 1
#
interface GigabitEthernet0/0/11
 eth-trunk 1

第二步 配置IP地址

DHCP

interface GigabitEthernet0/0/0
 ip address 192.168.100.1 255.255.255.0 

GW

interface GigabitEthernet0/0/0.10
 dot1q termination vid 10
 ip address 192.168.10.254 255.255.255.0 
 arp broadcast enable
 #
interface GigabitEthernet0/0/0.20
 dot1q termination vid 20
 ip address 192.168.20.254 255.255.255.0 
 arp broadcast enable
 #
interface GigabitEthernet0/0/0.100
 dot1q 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地址池 名称为 VLAN10
 gateway-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/0
 dhcp 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.10
 dhcp select relay    //开启DHCP中继
 dhcp relay server-ip 192.168.100.1   //指向DHCP服务器的IP地址
#
interface GigabitEthernet0/0/0.20
 dhcp select relay
 dhcp relay server-ip 192.168.100.1

配置验证

查看PC1 PC2是否正确的获得了IP地址

HCIA-DHCP+DHCP中继_第2张图片
HCIA-DHCP+DHCP中继_第3张图片

你可能感兴趣的:(华为HCIA,网络)