案例描述:  某公司的网络中有一个三层交换机SW1, 在公司的网络中每个部门一个VLAN、服务器一个独立的VLAN. ◆ Server处于VLAN10中,网段为192.168.1.0/24,其中DHCP服务的IP地址为192.168.1.2 ◆ Sales部门处于VLAN20中,网段为192.168.2.0/24 ◆ HR部门处于VLAN30中,网段为192.168.3.0/24 案例目的: 实现Sales和HR部门的所有的客户机能自动到DHCP服务上获得IP地址 案例注意点: 在部署环境的时候,所有的计算机使用微软的操作系统,其中 DHCP服务器使用微软的Windows Server 2008 R2操作系统;交换机使用Cisco 3560三层交换机。 案例实现: 一.按照要求连接好网络设备。 二.网络配置 交换机的基本配置 Switch>enable Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. sw1(config)#hostname sw1 sw1(config)#no ip domain lookup sw1(config)#line console 0 sw1(config-line)#exec-timeout 0 0 sw1(config-line)#logging synchronous 2. 创建VLAN 方法一: SW1(config)#vlan 10 SW1(config-vlan)#name Server SW1(config-vlan)#vlan 20 SW1(config-vlan)#name Sales SW1(config-vlan)#vlan 30 SW1(config-vlan)#name HR 方法二: SW1#vlan database % Warning: It is recommended to configure VLAN from config mode, as VLAN database mode is being deprecated. Please consult user documentation for configuring VTP/VLAN in config mode. SW1(vlan)#vlan 10 name Server VLAN 10 modified: Name: Server SW1(vlan)#vlan 20 name Sales VLAN 20 modified: Name: Sales SW1(vlan)#vlan 30 name HR VLAN 30 modified: Name: HR SW1(vlan)#exit APPLY completed. Exiting.... 把相应的接口加入的相应VLAN中 SW1(config)#interface fastEthernet 0/4 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 10 SW1(config-if)#exit SW1(config)#interface fastEthernet 0/5 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 20 SW1(config-if)#exit SW1(config)#interface fastEthernet 0/6 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 30 查看配置 SW1#sh vlan brief VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/7 Fa0/8, Fa0/9, Fa0/10, Fa0/11 Fa0/12, Fa0/13, Fa0/14, Fa0/15 Fa0/16, Fa0/17, Fa0/18, Fa0/19 Fa0/20, Fa0/21, Fa0/22, Fa0/23 Fa0/24 10 Server active Fa0/4 20 Sales active Fa0/5 30 HR active Fa0/6 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active 5. 配置SVI端口 SW1(config)#interface vlan 10 %LINK-5-CHANGED: Interface Vlan10, changed state to up SW1(config-if)#ip address 192.168.1.1 255.255.255.0 SW1(config-if)#no shutdown SW1(config-if)#int vlan 20 %LINK-5-CHANGED: Interface Vlan20, changed state to up SW1(config-if)#ip address 192.168.2.1 255.255.255.0 SW1(config-if)#int vlan 30 %LINK-5-CHANGED: Interface Vlan30, changed state to up SW1(config-if)#ip add 192.168.3.1 255.255.255.0 SW1(config-if)#no sh 验证 SW1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set C 192.168.1.0/24 is directly connected, Vlan10 C 192.168.2.0/24 is directly connected, Vlan20 C 192.168.3.0/24 is directly connected, Vlan30 为客户机所属VLAN配置中继代理 SW1(config)#int vlan 20 SW1(config-if)#ip helper-address 192.168.1.2 SW1(config-if)#int vlan 30 SW1(config-if)#ip helper-address 192.168.1.2 三.系统配置 四.配置完成后的测试 本文档由联科教育(http://www.iLync.cn)原创提供,如有问题请咨询我们的专家团队! |