配置交换机作为DHCP服务器

配置交换机作为DHCP服务器,第1张

目录

一、相关知识

1、基本配置命令

二、拓扑图

三、配置命令

1、ZY-Switch-1交换机配置命令

2、ZY-Switch-2交换机配置命令

四、验证过程


一、相关知识 1、基本配置命令

开启交换机DHCP服务:Service DHCP

配置DHCP服务地址池:IP DHCP pool name

配置分配的网段地址:default-router IP

配置分配的DNS地址:dns-server IP

排除不分配的地址:IP DHCP exclude-address IP

二、拓扑图

三、配置命令 1、ZY-Switch-1交换机配置命令
Switch>enable 
Switch#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname ZY-Switch-1
ZY-Switch-1(config)#vlan 10
ZY-Switch-1(config-vlan)#exit
ZY-Switch-1(config)#vlan 20
ZY-Switch-1(config-vlan)#exit
ZY-Switch-1(config)#interface fastEthernet 0/1
ZY-Switch-1(config-if)#switchport access vlan 10
ZY-Switch-1(config-if)#exit
ZY-Switch-1(config)#interface fastEthernet 0/2
ZY-Switch-1(config-if)#switchport access vlan 20
ZY-Switch-1(config-if)#exit
ZY-Switch-1(config)#interface fastEthernet 0/24
ZY-Switch-1(config-if)#switchport mode trunk 
2、ZY-Switch-2交换机配置命令
Switch>enable 
Switch#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname ZY-Switch-2
ZY-Switch-2(config)#vlan 10
ZY-Switch-2(config)#exit
ZY-Switch-2(config)#vlan 20
ZY-Switch-2(config-vlan)#exit
ZY-Switch-2(config)#interface fastEthernet 0/24
ZY-Switch-2(config-if)#switchport trunk encapsulation do
ZY-Switch-2(config-if)#switchport trunk encapsulation dot1q 
ZY-Switch-2(config-if)#switchport mode trunk 
ZY-Switch-2(config)#interface vlan 10
ZY-Switch-2(config-if)#ip address 192.168.10.1 255.255.255.0
ZY-Switch-2(config-if)#exit
ZY-Switch-2(config)#interface vlan 20
ZY-Switch-2(config-if)#ip address 192.168.20.1 255.255.255.0
ZY-Switch-2(config-if)#exit
ZY-Switch-2(config)#service dhcp 
ZY-Switch-2(config)#ip dhcp pool vlan10
ZY-Switch-2(dhcp-config)#network 192.168.10.0 255.255.255.0
ZY-Switch-2(dhcp-config)#default-router 192.168.10.1
ZY-Switch-2(dhcp-config)#dns-server 172.16.1.1
ZY-Switch-2(dhcp-config)#exit
ZY-Switch-2(config)#ip dhcp pool vlan20
ZY-Switch-2(dhcp-config)#network 192.168.20.0 255.255.255.0
ZY-Switch-2(dhcp-config)#default-router 192.168.20.1
ZY-Switch-2(dhcp-config)#dns-server 172.16.1.1
ZY-Switch-2(dhcp-config)#exit
ZY-Switch-2(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.9
ZY-Switch-2(config)#ip dhcp excluded-address 192.168.10.201 192.168.10.254
ZY-Switch-2(config)#ip dhcp excluded-address 192.168.20.1 192.168.20.9
ZY-Switch-2(config)#ip dhcp excluded-address 192.168.20.201 192.168.20.254
四、验证过程

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/874420.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-13
下一篇 2022-05-13

发表评论

登录后才能评论

评论列表(0条)

保存