华为s5700交换机配置全局地址池dhcp
SW1配置如下:
Enter system view, return user view with Ctrl+Z.
[Huawei]sy
[Huawei]sysname SW1 ( 设备命名)
[SW1]
[SW1]d
[SW1]dhcp en
[SW1]dhcp enable (使用DHCP功能)
Info: The operation may take a few seconds. Please wait for a moment.done.
[SW1]
[SW1]ip pool 10 (创建全局地址池,同时进入全局地址池视图)
Info:It's successful to create an IP address pool.
[SW1-ip-pool-10]netw
[SW1-ip-pool-10]network 192.168.10.0 m [SW1-ip-pool-10]network 192.168.10.0 mask 24(配置全局地址池可动态分配的IP地址范围)
[SW1-ip-pool-10]
[SW1-ip-pool-10]dns-list 8.8.8.8 (配置DNS )
[SW1-ip-pool-10]
[SW1-ip-pool-10]gateway-list 192.168.10.1 (配置网关)
[SW1-ip-pool-10]ex
[SW1-ip-pool-10]excluded-ip-address
192.168.10.201 192.168.10.254 (保留不被分
配的地址)
[SW1-ip-pool-10]
[SW1-ip-pool-10]lease d
[SW1-ip-pool-10]lease day 7 (IP租约期限)[SW1-ip-pool-10]
[SW1-ip-pool-10]dis this (查询当前模式的配置)
#
ip pool 10
gateway-list 192.168.10.1 (网关)
network 192.168.10.0 mask 255.255.255.0 (IP地址范围)
excluded-ip-address 192.168.10.201 192.168.10.254 (保留IP地址范围)
lease day 7 hour 0 minute 0 (IP租约周期) dns-list 8.8.8.8
#
return
[SW1-ip-pool-10]
[SW1-ip-pool-10]
[SW1-ip-pool-10]quit (退出)
[SW1]
[SW1]
[SW1]
[SW1]ip pool 20
Info:It's successful to create an IP address pool.
[SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]netw
[SW1-ip-pool-20]network 192.168.20.0 m [SW1-ip-pool-20]network 192.168.20.0 mask 24
[SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]d
[SW1-ip-pool-20]dns-list 8.8.8.8
[SW1-ip-pool-20]
[SW1-ip-pool-20]g
[SW1-ip-pool-20]gateway-list 192.168.20.1 [SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]ex
[SW1-ip-pool-20]excluded-ip-address
192.168.20.201 192.168.20.254
[SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]l
[SW1-ip-pool-20]lease d
[SW1-ip-pool-20]lease day 7
[SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]dis this
#
ip pool 20
gateway-list 192.168.20.1
network 192.168.20.0 mask 255.255.255.0 excluded-ip-address 192.168.20.201 192.168.20.254
lease day 7 hour 0 minute 0
dns-list 8.8.8.8
#
return
[SW1-ip-pool-20]
[SW1-ip-pool-20]
[SW1-ip-pool-20]q
[SW1]
[SW1]
[SW1]v
[SW1]vlan b
[SW1]vlan batch 10 20 (批量创建vlan)Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]
[SW1]
[SW1]int
[SW1]interface g
[SW1]interface GigabitEthernet 0/0/1 (进入port 1)
[SW1-GigabitEthernet0/0/1]por
[SW1-GigabitEthernet0/0/1]port l
[SW1-GigabitEthernet0/0/1]port link-t
[SW1-GigabitEthernet0/0/1]port link-type a
[SW1-GigabitEthernet0/0/1]port link-type access (配置port 1 类型)
[SW1-GigabitEthernet0/0/1]
[SW1-GigabitEthernet0/0/1]
[SW1-GigabitEthernet0/0/1]port
[SW1-GigabitEthernet0/0/1]port def
[SW1-GigabitEthernet0/0/1]port default v
[SW1-GigabitEthernet0/0/1]port default vlan 10 (配置port 1 vlan)
[SW1-GigabitEthernet0/0/1]
[SW1-GigabitEthernet0/0/1]quit (退出)[SW1]
[SW1]int
[SW1]interface g
[SW1]interface GigabitEthernet 0/0/2 [SW1-GigabitEthernet0/0/2]
[SW1-GigabitEthernet0/0/2]
[SW1-GigabitEthernet0/0/2]
[SW1-GigabitEthernet0/0/2]por
[SW1-GigabitEthernet0/0/2]port l
[SW1-GigabitEthernet0/0/2]port link-t [SW1-GigabitEthernet0/0/2]port link-type a
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]
[SW1-GigabitEthernet0/0/2]por
[SW1-GigabitEthernet0/0/2]port def
[SW1-GigabitEthernet0/0/2]port default v
[SW1-GigabitEthernet0/0/2]port default vlan 20
[SW1-GigabitEthernet0/0/2]
[SW1-GigabitEthernet0/0/2]quit
[SW1]
[SW1]
[SW1]
[SW1]int
[SW1]interface v (配置VLANIF10接口下的
客户端从全局地址池中获取IP地址)
[SW1]interface Vlanif 10 (创建vlanif 10) [SW1-Vlanif10]
[SW1-Vlanif10]
[SW1-Vlanif10]ip add
[SW1-Vlanif10]ip address 192.168.10.1 24 (配置IP地址)
[SW1-Vlanif10]
[SW1-Vlanif10]dhcp sel
[SW1-Vlanif10]dhcp select g
[SW1-Vlanif10]dhcp select global (在vlanif 10模式下调用全局地址池)
[SW1-Vlanif10]
[SW1-Vlanif10]
[SW1-Vlanif10]dis
[SW1-Vlanif10]display this (查询当前配置参数)
#
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
dhcp select global
#
return
[SW1-Vlanif10]
[SW1-Vlanif10]
[SW1-Vlanif10]quit
[SW1]
[SW1]
[SW1]int
[SW1]interface v
[SW1]interface Vlanif 20
[SW1-Vlanif20]
[SW1-Vlanif20]
[SW1-Vlanif20]ip add
[SW1-Vlanif20]ip address 192.168.20.1 24 [SW1-Vlanif20]
[SW1-Vlanif20]dhcp
[SW1-Vlanif20]dhcp sel
[SW1-Vlanif20]dhcp select g
[SW1-Vlanif20]dhcp select global
[SW1-Vlanif20]
[SW1-Vlanif20]dis this
#
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
dhcp select global
#
return
[SW1-Vlanif20]
[SW1-Vlanif20]
[SW1-Vlanif20]quit
[SW1]
[SW1]dis
[SW1]display ip pool (查看IP地址池配置情
况)
-----------------------------------------
------------------------------
Pool-name : 10
Pool-No : 0
Position : Local Status : Unlocked
Gateway-0 : 192.168.10.1
Mask : 255.255.255.0
VPN instance : --
-----------------------------------------
------------------------------
Pool-name : 20
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 :398
Expired :0 Conflict :0 Disable :108
[SW1]
[SW1]
[SW1]quit
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Now saving the current configuration to the slot 0.
Mar 18 2017 13:30:47-08:00 SW1 %%01CFM/4/SAVE(l)[63]:The user chose Y when decid
ing whether to save the configuration to the device.
Save the configuration successfully.
PC情况如下