实验目的:
根据如上拓扑,使得电脑pc1通过dhcp的第一种接口方式自动获取ip从而和pc2互通,反之pc2也一样用dhcp第二种全局地址池的方式自动获得ip。
交换机lsw1交换机配置如下:
[s5700]dis cu
#
sysname s5700
#
undo info-center enable
#
vlan batch 10 20
#
dhcp enable
#
ip pool v20
gateway-list 192.168.20.254
network 192.168.20.0 mask 255.255.255.0
lease day 8 hour 0 minute 0
dns-list 8.8.8.8
#
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
dhcp select interface
dhcp server excluded-ip-address 192.168.10.101 192.168.10.253
dhcp server lease day 8 hour 0 minute 0
dhcp server dns-list 8.8.8.8
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
dhcp select global
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
[s5700]
第一种方式:接口方式获取ip
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
dhcp select interface //启用接口方式获取地址
dhcp server excluded-ip-address 192.168.10.101 192.168.10.253 //排除的地址范围101-253除外
dhcp server lease day 8 hour 0 minute 0 //租期
dhcp server dns-list 8.8.8.8 //dns
第二种方式:dhcp全局地址池方式获取ip
ip pool v20
gateway-list 192.168.20.254 //网关
network 192.168.20.0 mask 255.255.255.0
lease day 8 hour 0 minute 0 //租期
dns-list 8.8.8.8 //dns
pc1获取到ip:我们可以看到被排除的dhcp server excluded-ip-address 192.168.10.101 192.168.10.253 //排除的地址范围101-253除外
pc2获取到ip
pc1通过获得的地址和pc2可以互通实验完成。