DCRS-5200配置(划分VLAN,根据每个VLAN通过DHCP分配IP地址)

更新时间:2023-12-21 18:35:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

划分VLAN,根据每个VLAN通过DHCP分配IP地址

一、新建立VLAN2并配置

switch>en //进入特权模式

switch#con //进入全局配置模式

switch(Config)#l3-forward enable //开启三层转发协议 switch(Config)#vlan 2 //建立VLAN2

switch(Config-Vlan2)#switchport interface ethernet 0/0/2-20 //给VLAN2分配端口 Set the port Ethernet0/0/2 access vlan 2 successfully Set the port Ethernet0/0/3 access vlan 2 successfully Set the port Ethernet0/0/4 access vlan 2 successfully Set the port Ethernet0/0/5 access vlan 2 successfully Set the port Ethernet0/0/6 access vlan 2 successfully Set the port Ethernet0/0/7 access vlan 2 successfully Set the port Ethernet0/0/8 access vlan 2 successfully Set the port Ethernet0/0/9 access vlan 2 successfully Set the port Ethernet0/0/10 access vlan 2 successfully Set the port Ethernet0/0/11 access vlan 2 successfully Set the port Ethernet0/0/12 access vlan 2 successfully Set the port Ethernet0/0/13 access vlan 2 successfully Set the port Ethernet0/0/14 access vlan 2 successfully Set the port Ethernet0/0/15 access vlan 2 successfully Set the port Ethernet0/0/16 access vlan 2 successfully Set the port Ethernet0/0/17 access vlan 2 successfully Set the port Ethernet0/0/18 access vlan 2 successfully Set the port Ethernet0/0/19 access vlan 2 successfully Set the port Ethernet0/0/20 access vlan 2 successfully

switch(Config-Vlan2)#interface vlan 2 //进入虚拟三层管理端口

%Jan 01 00:11:50 2001 %LINK-5-CHANGED: Interface Vlan2, changed state to UP

switch(Config-If-Vlan2)#ip address 192.168.2.1 255.255.255.0 //给VLAN2分配管理地址 switch(Config-If-Vlan2)#

~~~~~~~~~~~~~~~~~~~~~~~~vlan2配置完毕~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 二、建立VLAN3并配置

switch(Config)#vlan 3 //建立VLAN3

switch(Config-Vlan3)#switchport interface ethernet 0/0/21-52 //给VLAN3分配端口 Set the port Ethernet0/0/21 access vlan 3 successfully Set the port Ethernet0/0/22 access vlan 3 successfully Set the port Ethernet0/0/23 access vlan 3 successfully

Set the port Ethernet0/0/24 access vlan 3 successfully Set the port Ethernet0/0/25 access vlan 3 successfully Set the port Ethernet0/0/26 access vlan 3 successfully Set the port Ethernet0/0/27 access vlan 3 successfully Set the port Ethernet0/0/28 access vlan 3 successfully Set the port Ethernet0/0/29 access vlan 3 successfully Set the port Ethernet0/0/30 access vlan 3 successfully Set the port Ethernet0/0/31 access vlan 3 successfully Set the port Ethernet0/0/32 access vlan 3 successfully Set the port Ethernet0/0/33 access vlan 3 successfully Set the port Ethernet0/0/34 access vlan 3 successfully Set the port Ethernet0/0/35 access vlan 3 successfully Set the port Ethernet0/0/36 access vlan 3 successfully Set the port Ethernet0/0/37 access vlan 3 successfully Set the port Ethernet0/0/38 access vlan 3 successfully Set the port Ethernet0/0/39 access vlan 3 successfully Set the port Ethernet0/0/40 access vlan 3 successfully Set the port Ethernet0/0/41 access vlan 3 successfully Set the port Ethernet0/0/42 access vlan 3 successfully Set the port Ethernet0/0/43 access vlan 3 successfully Set the port Ethernet0/0/44 access vlan 3 successfully Set the port Ethernet0/0/45 access vlan 3 successfully Set the port Ethernet0/0/46 access vlan 3 successfully Set the port Ethernet0/0/47 access vlan 3 successfully Set the port Ethernet0/0/48 access vlan 3 successfully Set the port Ethernet0/0/49 access vlan 3 successfully Set the port Ethernet0/0/50 access vlan 3 successfully Set the port Ethernet0/0/51 access vlan 3 successfully Set the port Ethernet0/0/52 access vlan 3 successfully

switch(Config-Vlan3)#interface vlan 3 //进入虚拟三层管理端口

%Jan 01 00:09:14 2001 %LINK-5-CHANGED: Interface Vlan3, changed state to UP

switch(Config-If-Vlan3)#ip address 192.168.3.1 255.255.255.0 //给VLAN3分配管理地址 switch(Config-If-Vlan3)#

~~~~~~~~~~~~~~~~~~~~~~~~vlan3配置完毕~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 三、开启DHCP服务,并配置其为VLAN2分配IP地址

switch(Config)#service dhcp //全局配置模式下开启DCHP服务

switch(Config)#ip dhcp pool vlan2dhcp //建立DHCP分配地址池名称

switch(dhcp-vlan2dhcp-config)#network-address 192.168.2.0 255.255.255.0 //给新建立的地址池分配IP地址段

switch(dhcp-vlan2dhcp-config)#default-router 192.168.2.1 //给新建立的地址池分配网关 switch(dhcp-vlan2dhcp-config)#dns-server 202.96.209.133 202.96.209.5 //给新建立的地址池分配DNS服务器

switch(dhcp-vlan2dhcp-config)#lease 3 //设置地址租期为三天 switch(dhcp-vlan2dhcp-config)#exit //退出

switch(Config)#ip dhcp excluded-address 192.168.2.1 192.168.2.5 //设置排除的地址段 switch(Config)#exit //退出 switch#write //保存 四、给VLAN3分配IP地址

switch(Config)#ip dhcp pool vlan3dhcp //建立DHCP分配地址池名称

switch(dhcp-vlan3dhcp-config)#network-address 192.168.3.0 255.255.255.0 //给新建立的地址池分配IP地址段

switch(dhcp-vlan3dhcp-config)#default-router 192.168.3.1 //给新建立的地址池分配网关 switch(dhcp-vlan3dhcp-config)#dns-server 210.22.70.3 210.22.84.3 //给新建立的地址池分配DNS服务器

switch(dhcp-vlan3dhcp-config)#lease 3 //设置地址租期为三天 switch(dhcp-vlan3dhcp-config)#exit //退出

switch(Config)#ip dhcp excluded-address 192.168.3.1 192.168.3.5 //设置排除的地址段 switch(Config)#exit //退出 switch#write //保存

至此,全部配置完毕,当终端接到相应的VLAN端口时即可通过DCHP分配相应的IP地址

本文来源:https://www.bwwdw.com/article/1t85.html

Top