华为三层交换机 配置VLAN 基于全局开启DHCP

拓扑图

一、SW2 交换机设置

<Huawei>sys
[Huawei]sys SW2

# 关闭提示
[Huawei]un in en

# 批量创建 VLAN
[SW2]vlan batch 10 20

# 把接口加入 VLAN
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]p l a
[SW2-Ethernet0/0/1]p d v 10
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]p l a
[SW2-Ethernet0/0/2]p d v 20


[SW2-Ethernet0/0/2]int e0/0/3
[SW2-Ethernet0/0/3]p l t
[SW2-Ethernet0/0/3]p t a v a

二、SW1 交换机设置

1、创建 VLAN

<Huawei>sys
[Huawei]sys SW1

# 关闭消息提示
[SW1]un in en

# 批量创建 VLAN
[SW1]vlan batch 10 20

[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a

2、配置 DHCP 地址池

# 开启DHCP功能
[SW1]dhcp enable

# 创建地址池
[SW1]ip pool dhcp10
[SW1-ip-pool-dhcp10]network 192.168.10.0 mask 24
[SW1-ip-pool-dhcp10]gateway-list 192.168.10.1
[SW1-ip-pool-dhcp10]dns-list 114.114.114.114

[SW1]ip pool dhcp20
[SW1-ip-pool-dhcp20]network 192.168.20.0 mask 24
[SW1-ip-pool-dhcp20]gateway-list 192.168.20.1
[SW1-ip-pool-dhcp20]dns-list 114.114.114.114

3、配置IP并开启DHCP

# 配置IP
[SW1]int vlanif 10
[SW1-Vlanif10]ip addr 192.168.10.1 24

# 开启接口的全局DHCP
[SW1-Vlanif10]dhcp select global

[SW1-Vlanif10]int vlanif 20
[SW1-Vlanif20]ip addr 192.168.20.1 24
[SW1-Vlanif20]dhcp select global

4、查看地址池

<SW1>dis ip pool 
  -----------------------------------------------------------------------
  Pool-name      : dhcp10
  Pool-No        : 0
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.10.1    
  Mask           : 255.255.255.0
  VPN instance   : --

  -----------------------------------------------------------------------
  Pool-name      : dhcp20
  Pool-No        : 1
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.20.1    
  Mask           : 255.255.255.0
  VPN instance   : --


  IP address Statistic
    Total       :506   
    Used        :0          Idle        :506   
    Expired     :0          Conflict    :0          Disable   :0 

5、查看指定地址池

<SW1>dis ip pool name dhcp10 
  Pool-name      : dhcp10
  Pool-No        : 0
  Lease          : 1 Days 0 Hours 0 Minutes
  Domain-name    : -
  DNS-server0    : 114.114.114.114 
  NBNS-server0   : -               
  Netbios-type   : -               
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.10.1    
  Mask           : 255.255.255.0
  VPN instance   : --
 -----------------------------------------------------------------------------
         Start           End     Total  Used  Idle(Expired)  Conflict  Disable
 -----------------------------------------------------------------------------
    192.168.10.1  192.168.10.254   253     0        253(0)         0        0
 -----------------------------------------------------------------------------

7、查看指定地址池情况

<SW1>dis ip pool name dhcp10 used 

三、查看IP

PC1>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe2a:e09
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.1
Physical address..................: 54-89-98-2A-0E-09
DNS server........................: 114.114.114.114
PC2>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fee3:6765
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.1
Physical address..................: 54-89-98-E3-67-65
DNS server........................: 114.114.114.114
  • 9
    点赞
  • 55
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值