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

思科三层交换机配置实例及命令思科三层交换机配置实例及命令交换机的命名一般是WS开头这个是固定的,再下一个字母有两种一个是C一个是X,C代表固化交换机或者机箱,X代表的是模块。
下面是店铺精心整理的思科三层交换机配置实例及命令,仅供参考,希望能够帮助到大家。
三层交换机是不是经常让你机器不好使,看看下面的三层交换机配置文章,一切问题都能解决。
本文详细介绍实例讲解:全面的三层交换机配置比较全面的三层交换机配置实例,带命令解释哟!三层交换机配置:Enable //进入私有模式Configure terminal //进入全局模式service password-encryption //对密码进行加密hostname Catalyst 3550-12T1 //给三层交换机定义名称enable password 123456. //enable密码Enable secret 654321 //enable的加密密码(应该是乱码而不是654321这样)Ip subnet-zero //允许使用全0子网(默认都是打开的)Ip name-server 172.16.8.1 172.16.8.2 //三层交换机名字Catalyst 3550-12T1对应的IP地址是172.16.8.1Service dhcp //提供DHCP服务ip routing //启用三层交换机上的路由模块Exit三层交换机配置:Vtp mode server //定义VTP工作模式为sever模式Vtp domain centervtp //定义VTP域的名称为centervtpVlan 2 name vlan2 //定义vlan并给vlan取名(如果不取名的话,vlan2的名字应该是vlan002)Vlan 3 name vlan3Vlan 4 name vlan4Vlan 5 name vlan5Vlan 6 name vlan6Vlan 7 name vlan7Vlan 8 name vlan8Vlan 9 name vlan9Exit三层交换机配置:interface Port-channel 1 //进入虚拟的以太通道组1switchport trunk encapsulation dot1q //给这个接口的trunk封装为802.1Q的帧格式switchport mode trunk //定义这个接口的工作模式为trunkswitchport trunk allowed vlan all //在这个trunk上允许所有的vlan通过Interface gigabitethernet 0/1 //进入模块0上的吉比特以太口1 switchport trunk encapsulation dotlq //给这个接口的trunk封装为802.1Q的帧格式switchport mode trunk //定义这个接口的工作模式为trunkswitchport trunk allowed vlan all //在这个trunk上允许所有的vlan通过channel-group 1 mode on //把这个接口放到快速以太通道组1中Interface gigabitethernet 0/2 //同上switchport trunk encapsulation dotlqswitchport mode trunkswitchport trunk allowed vlan allchannel-group 1 mode on三层交换机配置:port-channel load-balance src-dst-ip //定义快速以太通道组的负载均衡方式(依*源和目的IP的方式)interface gigabitethernet 0/3 //进入模块0上的.吉比特以太口3switchport trunk encapsulation dotlq //给trunk封装为802.1Qswitchport mode trunk //定义这个接口的工作模式为trunkswitchport trunk allowed vlan all //允许所有vlan信息通过interface gigabitethernet 0/4 //同上switchport trunk encapsulation dotlqswitchport mode trunkswitchport trunk allowed vlan allinterface gigbitethernet 0/5 //同上switchport trunk encapsulation dotlqswitchport mode trunkswitchport trunk allowed vlan allinterface gigbitethernet 0/6 //同上switchport trunk encapsulation dotlqswitchport mode trunkswitchprot trunk allowed vlan all三层交换机配置:interface gigbitethernet 0/7 //进入模块0上的吉比特以太口7 Switchport mode access //定义这个接口的工作模式为访问模式switchport access vlan 9 //定义这个接口可以访问哪个vlan(实际就是分配这个接口到vlan)no shutdownspanning-tree vlan 6-9 cost 1000 //在生成树中,vlan6-9的开销定义为10000interface range gigabitethernet 0/8 – 10 //进入模块0上的吉比特以太口8,9,10switchport mode access //定义这些接口的工作模式为访问模式switchport access vlan 8 //把这些接口都分配到vlan8中no shutdown三层交换机配置:spanning-tree portfast //在这些接口上使用portfast(使用portfast以后,在生成树的时候不参加运算,直接成为转发状态) interface gigabitethernet 0/11 //进入模块0上的吉比特以太口11switchport trunk encapsulation dotlq //给这个接口封装为802.1Qswitchport mode trunk //定义这个接口的工作模式为trunkswitchport trunk allowed vlan all //允许所有vlan信息通过interface gigabitethernet 0/12 //同上switchport trunk encapsulation dotlqswitchport mode trunkswitchport trunk allowed vlan allinterface vlan 1 //进入vlan1的逻辑接口(不是物理接口,用来给vlan做路由用)ip address 172.16.1.7 255.255.255.0 //配置IP地址和子网掩码no shutdown三层交换机配置:standby 1 ip 172.16.1.9 //开启了冗余热备份(HSRP),冗余热备份组1,虚拟路由器的IP地址为172.16.1.9standby 1 priority 110 preempt //定义这个三层交换机在冗余热备份组1中的优先级为110,preempt是用来开启抢占模式interface vlan 2 //同上ip address 172.16.2.252 255.255.255.0no shutdownstandby 2 ip 172.16.2.254standby 2 priority 110 preemptip access-group 101 in //在入方向上使用扩展的访问控制列表101interface vlan 3 //同上ip address 172.16.3.252 255.255.255.0 no shutdown三层交换机配置:standby 3 ip 172.16.3.254standby 3 priority 110 preemptip access-group 101 ininterface vlan 4 //同上ip address 172.16.4.252 255.255.255.0 no shutdownstandby 4 ip 172.16.4.254standby 4 priority 110 preemptip access-group 101 ininterface vlan 5ip address 172.16.5.252 255.255.255.0 no shutdownstandby 5 ip 172.16.5.254standby 5 priority 110 preemptip access-group 101 ininterface vlan 6ip address 172.16.6.252 255.255.255.0 no shutdown三层交换机配置:standby 6 ip 172.16.6.254standby 6 priority 100 preempt interface vlan 7ip address 172.16.7.252 255.255.255.0 no shutdownstandby 7 ip 172.16.7.254standby 7 priority 100 preemptinterface vlan 8ip address 172.16.8.252 255.255.255.0no shutdownstandby 8 ip 172.16.8.254standby 8 priority 100 preemptinterface vlan 9ip address 172.16.9.252 255.255.255.0no shutdown三层交换机配置:standby 9 ip 172.16.9.254standby 9 priority 100 preemptaccess-list 101 deny ip any 172.16.7.0 0.0.0.255 //扩展的访问控制列表101access-list 101 permit ip any anyInterface vlan 1 //进入vlan1这个逻辑接口Ip helper-address 172.16.8.1 //可以转发广播(helper-address 的作用就是把广播转化为单播,然后发向172.16.8.1)Interface vlan 2Ip helper-address 172.16.8.1Interface vlan 3ip helper-address 172.16.8.1interface vlan 4ip helper-address 172.16.8.1interface vlan 5ip helper-address 172.16.8.1interface vlan 6ip helper-address 172.16.8.1interface vlan 7ip helper-address 172.16.8.1interface vlan 9ip helper-address 172.16.8.1router rip//启用路由协议RIPversion 2//使用的是RIPv2,如果没有这句,则是使用RIPv1network 172.16.0.0//宣告直连的网段exit三层交换机配置:ip route 0.0.0.0 0.0.0.0 172.16.9.250//缺省路由,所有在路由表中没有办法匹配的数据包,都发向下一跳地址为172.16.9.250这个路由器line con 0line aux 0line vty 0 15//telnet线路(路由器只有5个,是0-4)password 12345678//login密码loginendcopy running-config startup-config 保存配置。
在思科交换机上配置dhcp实例

在思科交换机上配置dhcp实例解决方案:一,如果不用交换机的DHCP功能而是利用PC的DHCP功能!1.在交换机上配置DHCP服务器: ip dhcp-server 192.168.0.692.在交换机中为每个VLAN设置同样的DHCP服务器的IP地址: interface Vlan11 ip address 192.168.1.254 255.255.255.0 ip helper-address 192.168.0.69 DHCP Server IP interface Vlan12 ip address 192.168.2.254 255.255.255.0 ip helper-address 192.168.0.69 DHCP Server IP3.在DHCP服务器上设置网络地址分别为192.168.1.0、192.168.2.0的作用域,并将这些作用域的“路由器”选项设置为对应VLAN的接口IP地址。
二利用三层交换机自带的DHCP功能实现多VLAN的IP地址自动分配(一) 配置方法一1.同时为多个VLAN的客户机分配地址2.VLAN内有部分地址采用手工分配的方式3.为客户指定网关、Wins服务器等4.VLAN 2的地址租用有效期限为1天,其它为3天5.按MAC地址为特定用户分配指定的IP地址最终配置如下:ip dhcp excluded-address 10.1.1.1 10.1.1.19 //不用于动态地址分配的地址ip dhcp excluded-address 10.1.1.240 10.1.1.254ip dhcp excluded-address 10.1.2.1 10.1.2.19!ip dhcp pool global //global是pool name,由用户指定network 10.1.0.0 255.255.0.0 //动态分配的地址段domain-name //为客户机配置域后缀dns-server 10.1.1.1 10.1.1.2 //为客户机配置dns服务器netbios-name-server 10.1.1.5 10.1.1.6 //为客户机配置wins服务器netbios-node-type h-node //为客户机配置节点模式(影响名称解释的顺利,如h-node=先通过wins服务器解释...)lease 3 //地址租用期限: 3天ip dhcp pool vlan1network 10.1.1.0 255.255.255.0 //本pool是global的子pool, 将从global pool继承domain-name等optiondefault-router 10.1.1.100 10.1.1.101 //为客户机配置默认网关!ip dhcp pool vlan2 //为另一VLAN配置的poolnetwork 10.1.2.0 255.255.255.0default-router 10.1.2.100 10.1.2.101lease 1!ip dhcp pool vlan1_john //总是为MAC地址为...的机器分配...地址host 10.1.1.21 255.255.255.0client-identifier 010050.bade.6384 //client-identifier=01加上客户机网卡地址!ip dhcp pool vlan1_tomhost 10.1.1.50 255.255.255.0client-identifier 010010.3ab1.eac8相关的DHCP调试命令:no service dhcp //停止DHCP服务[默认为启用DHCP服务]sh ip dhcp binding //显示地址分配情况show ip dhcp conflict //显示地址冲突情况debug ip dhcp server {events | packets | linkage} //观察DHCP服务器工作情况如果DHCP客户机分配不到IP地址,常见的原因有两个。
cisco三层交换机配置vlan和DHCP攻略

cisco三层交换机配置vlan和DHCP攻略ip dhcp pool IT_WEIXIU //配置DHCP服务network 10.42.86.0 255.255.255.224 //配置DHCP网段default-router 10.42.86.30 //DHCP分配网关(应为vlan接口IP)dns-server 10.42.0.82 10.1.2.9 10.1.2.70 //DHCP分配DNSnetbios-name-server 10.1.2.9 10.1.2.70 10.1.2.222 //DHCP分配WINS!vlan 100 //建立vlanname IT_weixiu //vlan命名interface FastEthernet0/25switchport access vlan 100!interface FastEthernet0/26switchport access vlan 100!interface FastEthernet0/27switchport access vlan 100!interface FastEthernet0/28switchport access vlan 100!interface FastEthernet0/29switchport access vlan 100!interface FastEthernet0/30switchport access vlan 100 //端口指定vlan!!interface Vlan100 //配置vlan接口description IT_weixiuip address 10.42.86.30 255.255.255.224 //配置vlan接口IP为网关no ip proxy-arpip ospf 100 area 42 //加入ospf动态路由图(因下方已包含,本条不必要)!interface Vlan200description To_SongZiip address 10.42.85.30 255.255.255.224ip helper-address 10.42.0.16 //指定本网段DHCP服务器为分公司(不指定本条即由本网段内提供DHCP服务或不提供)no ip proxy-arpip ospf 100 area 42 ┗━DHCP服务采用广播协议,故:1不能跨网段;2同一网段只能一台DHCP服务! “ip helper-address”命令即专用来解决DHCP不能跨网段问题。
实验1:三层交换机配置和DHCP中继

实验1:三层交换机配置和DHCP中继
实验环境如下:
需求描述:
在SW1上创建VLAN10和VLAN20,并将端口F0/1划分到VLAN10,将端口F0/14划分到VLAN20。
在SW1和SW2上配置路由,是全网互通。
在R1上配置DHCP,在SW1上配置DHCP中继,使PC机能自动获取到IP地址和默认网关。
在PC机上能够ping通R1和L0.
具体操作:
第一步:创建VLAN10,VLAN20。
并将相应的端口加入到VLAN中(如图)。
第二步:在路由器R2上建立端口:L0:192.168.1.1/32。
并且将F0/0端口的IP地址设置为:192.168.0.2/30 ,并配置静态路由。
(如图)
第三步:将SW1上的VLAN10与VLAN20配上相应的IP(pc与R1的网关地址),如:VLAN10 IP:192.168.10.254/24,VLAN20 IP:192.168.20.254/24.还有F0/15的IP:192.168.0.1/30。
然后再配置一条默认路由指向R2,并在SW1上开启路由功能。
最后在VLAN10的接口模式下键入:IP help-address 192.168.20.1 (如图)
第四部:将R1上的F0/0接口配置IP地址:192.168.20.1/24.并创建DHCP地址池:192.168.10.0/24并配置相关参数。
最后写一条默认路由指向SW1。
(如图)
第五步:验证PC是否得到相应的IP地址并进行全网PING通。
到此本实验全部完成!!!。
如何在三层交换机配置DHCP

51CTO首页我的博客搜索社区:论坛博客下载读书更多登录注册首页|微软活动|Cisco |Security |VoIP |Office |Windows Server |Windows 7|IT职业生涯51cto 51cto博客之星博客之星 用户名:hackerjx 文章数:61 评论数:489 访问量:232011 无忧币:2031 博客积分:3371 博客等级:7注册日期:2008-05-18[Win 7]原来的桌面属性那.. 追梦五年-我和51CTO的那些事 Windows 7 中的“亮.. Windows XP Mode,发布应.. Office 2010 Beta 简体中.. 802.1X认证+DHCP+ACS Ser.. 配置在一台三层交换上,.. 揭秘Cisco NBAR封杀BT和.. 解密Windows 7中的XP Mode 企业网络中部署Cisco ACS.. 配置多台三层交换VLAN间.. [Win 7]安装Windows 7好.. 大中型企业中部署应用AAA.. Cisco SSL VPN 配置详解 配置Cisco IOS EASY VPN ..ISCW实验3:配置Cisco PP.. Cisco IP Communicator .. 使用SDM配置Cisco Easy VPN博客博客统计统计统计信息信息热门热门文章文章hackerjx 的BLOG写留言邀请进圈子发消息加友情链接进家园 加好友MSN/QQ 论坛 开心 人人 豆瓣 新浪微博 分享到:博主的更多文章>>标签:DHCP 多层交换配置 Cisco原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。
否则将追究法律责任。
/383839/215400通过本实验实验掌握掌握掌握,,如何在如何在Cisco Catalyst Cisco Catalyst Cisco Catalyst 3550 3550 3550交交换机来配置配置DHCP DHCP DHCP服服务,实现对实现对内内网主机分配IP IP地址地址地址,,网关,DNS DNS,,WINS WINS,,租期租期,,域名等域名等。
鸿鹄论坛_思科锐捷三层交换机配置DHCP

需求:vlan 10中的PC能自动获取到192.168.10.0网段,vlan 20中的PC能自动获取到192.168.20.0的网段。
预配:Switch>enSwitch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#no ip domain loSwitch(config)#lin con 0Switch(config-line)#exeSwitch(config-line)#exec-timeout 0 0Switch(config-line)#loggSwitch(config-line)#logging sSwitch(config-line)#logging synchronous第一步:在三层交换机上配置VLAN并配IP地址作为网关Switch(config)#vlan 10Switch(config-vlan)#name banggongSwitch(config-vlan)#exitSwitch(config)#vlan 20Switch(config-vlan)#name shengchangSwitch(config-vlan)#exitSwitch(config)#intvlan 10Switch(config-if)#ip add 192.168.10.1 255.255.255.0Switch(config-if)#no shSwitch(config-if)#exitSwitch(config)#intvlan 20Switch(config-if)#ip add 192.168.20.1 255.255.255.0Switch(config-if)#no sh第二步:在三层交换机上配置DHCP服务Switch(config)#ipdhcp excluded-address 192.168.10.1Switch(config)#ipdhcp excluded-address 192.168.20.1排除作为网关的地址Switch(config)#ipdhcp pool vlan10Switch(dhcp-config)#network 192.168.10.0 255.255.255.0Switch(dhcp-config)#default-router 192.168.10.1有DNS服务器的话还要填写DNS服务器的地址Switch(dhcp-config)#dns-serverx.x.x.xSwitch(dhcp-config)#exitSwitch(config)#ipdhcp pool vlan20Switch(dhcp-config)#network 192.168.20.0 255.255.255.0Switch(dhcp-config)#default-router 192.168.20.1第三步:在二层交换机上创建VLAN 10和VLAN 20Switch(config)#vlan 10Switch(config-vlan)#exitSwitch(config)#vlan 20Switch(config-vlan)#exitSwitch(config)#int range f0/2 - 4Switch(config-if-range)#switchport mode accessSwitch(config-if-range)#switchport access vlan 10Switch(config-if-range)#exitSwitch(config)#int range f0/5 - 7Switch(config-if-range)#switchport mode accessSwitch(config-if-range)#switchport access vlan 20锐捷系列与思科配置完全一样,但是要注意配置前一定要开启DHCP服务service dhcp上次在配置的时候忘了配置这条命令,结果怎么也获取不到IP。
锐捷三层交换机DHCP配置实例和思科模拟器上的DHCP配置

S3760(dhcp-config)# network 192.168.3.0 255.255.255.0
S3760(dhcp-config)# dns-server 202.101.115.55
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
步骤一:配置VLAN网关IP地址,及将相关端口划入相应的VLAN中
S3760#con t
S3760(config)#vlan 2 ----创建VLAN2
S3760(config-vlan)#exit ----退回到全局配置模式下
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(config)#vlan 3 ----创建VLAN3
S3760(config-vlan)#exit ----退回到全局配置模式下
S3760(config)#int vlan 2 ----进入配置VLAN2
[原创]Cisco三层交换机与Routeros OSPF+DHCP服务器配置实例
![[原创]Cisco三层交换机与Routeros OSPF+DHCP服务器配置实例](https://img.taocdn.com/s3/m/21bf0b42a8956bec0975e343.png)
[原创]Cisco三层交换机与Routeros OSPF+DHCP服务器配置实例本案例使用Cisco三层交换机结合Mikrotik Routeros配置OSPF动态路由及多Vlan Dhcp服务器中继配置。
使用设备如下三层交换机:Cisco 3550 EMI接入层交换机:HUAWEI Quidway S2008Mikrotik RouterOs 3.13网络拓扑如下:配置目的:验证Routeros OSPF动态路由及DHCP中继配置文档:CISCO 3550ip routing#开启路由功能#ip dhcp excluded-address 10.100.0.100#设置dhcp服务器ip地址#interface FastEthernet0/2switchport trunk encapsulation dot1qswitchport mode trunk#设置与2层交换机互联的trunk端口#interface FastEthernet0/23switchport access vlan 2switchport mode accessspanning-tree portfast#设置与ros连接的端口的vlan#interface Vlan2description serverip address 10.100.0.1 255.255.255.0#设置3层交换机vlan接口ip#!interface Vlan3description officeip address 10.100.3.1 255.255.255.0ip helper-address 10.100.0.100!#设置3层交换机vlan接口ip及配置dhcp中继# interface Vlan4description salesip address 10.100.4.1 255.255.255.0ip helper-address 10.100.0.100!#设置3层交换机vlan接口ip及配置dhcp中继# interface Vlan5description usersip address 10.100.5.1 255.255.255.0ip helper-address 10.100.0.100!#设置3层交换机vlan接口ip及配置dhcp中继# router ospf 10router-id 10.100.0.1log-adjacency-changesnetwork 10.100.0.0 0.0.255.255 area 10.100.0.0 #配置ospf进程及area信息#HUAWEI Quidway S2008 配置:interface Ethernet0/6switchport access vlan 5!#配置用户端口#interface Ethernet0/7switchport access vlan 3!#配置用户端口#interface Ethernet0/8switchport access vlan 4#配置用户端口#interface Ethernet0/9switchport mode trunkswitchport trunk allowed vlan all!#设置与3层交换机互联的trunk端口#Mikrotik Routeros:/ip pooladd name="vlan3" ranges=10.100.3.2-10.100.3.254add name="vlan4" ranges=10.100.4.2-10.100.4.254add name="vlan5" ranges=10.100.5.2-10.100.5.254#设置不同Vlan的地址池#/ip dhcp-serveradd address-pool=vlan3 authoritative=after-2sec-delay bootp-support=static \ disabled=no interface=in lease-time=3d name="vlan3" relay=10.100.3.1 add address-pool=vlan4 authoritative=after-2sec-delay bootp-support=static \ disabled=no interface=in lease-time=3d name="vlan4" relay=10.100.4.1 add address-pool=vlan5 authoritative=after-2sec-delay bootp-support=static \ disabled=no interface=in lease-time=3d name="vlan5" relay=10.100.5.1#设置Dhcp-server 使之支持Dhcp中继#/routing ospf areaadd area-id=0.0.0.0 authentication=none disabled=no name="backbone" \ type=defaultadd area-id=10.100.0.0 authentication=none disabled=no name="area1" \ type=default#配置ospf area#/ip addressadd address=10.100.0.100/24 broadcast=10.100.0.255 comment="" disabled=no \interface=in network=10.100.0.0#配置内部IP地址#/ip dnsset allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB \ max-udp-packet-size=512 primary-dns=192.168.100.208 \#配置dns#/ip firewall natadd action=masquerade chain=srcnat comment="" disabled=no \ src-address=10.100.0.0/16#配置NAT#/routing ospfset distribute-default=always-as-type-2 metric-bgp=20 metric-connected=20 \ metric-default=1 metric-rip=20 metric-static=20 mpls-te-area=unspecified \ mpls-te-router-id=unspecified redistribute-bgp=no \redistribute-connected=no redistribute-rip=no redistribute-static=no \router-id=10.100.100.2/routing ospf interfaceadd authentication=none authentication-key="" cost=10 dead-interval=40s \ disabled=no hello-interval=10s interface=in network-type=broadcast \passive=no priority=1 retransmit-interval=5s transmit-delay=1s/routing ospf networkadd area=area1 disabled=no network=10.100.0.0/16#配置OSPF路由协议#。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
如对您有帮助,请购买打赏,谢谢您!
如何在设备上开启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 ----设置VLAN2的IP地址
S3760(config-if)#exit ----退回到全局配置模式下
S3760(config)#int vlan 3 ----进入配置VLAN3
S3760(config-if)#ip add ----设置VLAN3的IP地址
S3760(config-if)#exit ----退回到全局配置模式下
S3760(config)#int f 0/2 ----进入接口f0/2
S3760(config-if)#switchport vlan 2 ----设置f0/2口属于VLAN2
S3760(config-if)#exit
S3760(config)#int f 0/3 ----进入接口f0/3
S3760(config-if)#switchport 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
----设置排斥地址为
S3760 (config)#ip dhcp excluded-address
----设置排斥地址为
S3760 (config)#ip dhcp pool test2 ----新建一个dhcp名为test2
S3760 (dhcp-config)# lease ----租期时间设置为永久
S3760 (dhcp-config)# network ----给客户端分配的地址段
S3760 (dhcp-config)# dns-server ----给客户端分配的DNS
S3760(dhcp-config)# default-router ----客户端的网关
S3760(dhcp-config)#exit
S3760(config)#ip dhcp pool test3 ----新建一个dhcp名为test3
S3760(dhcp-config)# lease ----租期时间设置为永久
S3760(dhcp-config)# network
S3760(dhcp-config)# dns-server
S3760(dhcp-config)# default-router
S3760(dhcp-config)#end
S3760#wr。