给个锐捷三层交换机DHCP配置实例和思科模拟器上的DHCP配置实例

如何在设备上开启DHCP服务,让不同VLAN下的电脑获得相应的IP地址?
步骤一:配置VLAN网关IP地址,及将相关端口划入相应的VLAN中
S3760#con t
S3760(config)#vlan 2                                   ----创建VLAN2
S3760(config-vlan)#exit                                ----退回到全局配置模式下
S3760(config)#vlan 3                                   ----创建VLAN3
S3760(config-vlan)#exit                                ----退回到全局配置模式下
S3760(config)#int vlan 2                               ----进入配置VLAN2
S3760(config-if)#ip add 192.168.2.1 255.255.255.0      ----设置VLAN2的IP地址
S3760(config-if)#exit                                  ----退回到全局配置模式下
S3760(config)#int vlan 3                               ----进入配置VLAN3
S3760(config-if)#ip add 192.168.3.1 255.255.255.0      ----设置VLAN3的IP地址
S3760(config-if)#exit                                  ----退回到全局配置模式下

S3760(config)#int f 0/2                                ----进入接口f0/2
S3760(config-if)#switchport access vlan 2              ----设置f0/2口属于VLAN2
S3760(config-if)#exit
S3760(config)#int f 0/3                                ----进入接口f0/3
S3760(config-if)#switchport access vlan 3              ----设置f0/3口属于VLAN3
S3760(config-if)#exit


步骤二:配置DHCP server
S3760 (config)#service dhcp                            ----开启dhcp server功能
S3760 (config)#ip dhcp ping packets 1                  ----在dhcp server分配IP时会先去检测将要分配的IP地址是否已有人使用,如果没人使用则分配,若已有人使用则再分配下一个IP
S3760 (config)#ip dhcp excluded-address 192.168.2.1 192.168.2.10
                                                       ----设置排斥地址为192.168.2.1至192.168.2.10的ip地址不分配给客户端(可选配置)
S3760 (config)#ip dhcp excluded-address 192.168.3.1 192.168.3.10
                                                       ----设置排斥地址为192.168.3.1至192.168.3.10的ip地址不分配给客户端(可选配置)
S3760 (config)#ip dhcp pool test2                      ----新建一个dhcp地址池名为test2
S3760 (dhcp-config)# lease infinite                    ----租期时间设置为永久
S3760 (dhcp-config)# network 192.168.2.0 255.255.255.0 ----给客户端分配的地址段
S3760 (dhcp-config)# dns-server 202.101.115.55         ----给客户端分配的DNS
S3760(dhcp-config)# default-router 192.168.2.1         ----客户端的网关
S3760(dhcp-config)#exit
S3760(config)#ip dhcp pool test3                       ----新建一个dhcp地址池名为test3
S3760(dhcp-config)# lease infinite                     ----租期时间设置为永久
S3760(dhcp-config)# network 192.168.3.0 255.255.255.0
S3760(dhcp-config)# dns-server 202.101.115.55
S3760(dhcp-config)# default-router 192.168.3.1
S3760(dhcp-config)#end
S3760#wr
 

你可能感兴趣的:(模拟,实例,DHCP,交换机,思科)