eNSP新建拓扑
1、使用dis vlan命令我们可以看到交换机默认一个vlan
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW1
[SW1]dis
[SW1]display vl
[SW1]display vlan
2、使用默认的vlan1开启DHCP功能,让PC自动获取到IP地址
[SW1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[SW1]dis this
[SW1]int
[SW1]interface vlan
[SW1]interface Vlanif 1
[SW1-Vlanif1]ip addr
[SW1-Vlanif1]ip address 192.168.1.1 24
[SW1-Vlanif1]dhcp sel
[SW1-Vlanif1]dhcp select int
[SW1-Vlanif1]dhcp select interface
[SW1-Vlanif1]dis this
此时,PC使用DHCP就可以获取IP地址
PS: dhcp select interface 就是以“当前接口的IP与掩码”所处的IP地址范围作为地址池下发 无需手动指定地址范围, 网关为当前接口IP DNS在接口下配置。dhcp select global 需要调用一个全局模式下建立的地址池(ip pool) 网关 dns等在ip pool内配置。
3、其他设置
[SW1-Vlanif1]ip address 192.168.10.254 24
[SW1-Vlanif1]dhcp select interface
[SW1-Vlanif1]dhcp server lease day 30
[SW1-Vlanif1]dhcp server dns-list 114.114.114.114 8.8.8.8
[SW1-Vlanif1]dhcp server excluded-ip-address 192.168.10.200 192.168.10.253 //排除200-254 不分配
[SW1-Vlanif1]dis this
[SW1-Vlanif1]dhcp server excluded-ip-address 192.168.10.2 //排除10.2 不分配
[SW1-Vlanif1]dhcp server static-bind ip-address 192.168.10.9 mac-address 28d2-4469-5a55 // 绑定 IP 192.168.10.9 固定分配给MAC 为28d2-4469-5a55的机器
此时,PC就可以自动获取IP地址、网关和DNS地址