三层交换机的DHCP实验

实验目的:
   学习DHCP原理,实现为不同的Vlan划分不同地址池.
实验思路:
   使用三层交换技术,使得不同VLAN之间的主机能够通信。
   为不同Vlan划分不同的地址池
 
 
拓扑图:

实验连线:
Switch 1 F 0/1 < -> VPC P0/1 VPC1
Switch 1 F 0/2 < -> VPC P0/2 VPC2
Switch 1 F 0/3 < -> VPCS V0/1 VPC3
Switch 1 F 0/4 < -> VPCS V0/2 VPC4
 
 
3L -SW1
 
初始配置:
Router>enable
Router#config terminal
Enter configuration commands, one per line. 
Router(config)#no ip domain lookup
Router(config)#line console 0
Router(config-line)#exec-time 0 0
Router(config-line)#logging sync
Router(config-line)#exit
Router(config)#hostname R1       
R1(config)#hostname 3L -SW1
 
VLAN 的创建 
3L -SW1(vlan)#vlan 2 name V2
   VLAN 2 added:
    Name: V2
3L -SW1(vlan)#vlan 3 name V3
  VLAN 3 added:
    Name: V3
3L -SW1(vlan)#vlan 4 name V4
   VLAN 4 added:
Name: V4
 
Vlan设置网关
3L -SW1(config)#interface vlan 2
3L -SW1(config-if)#ip add 192.168.2.1 255.255.255.0
3L -SW1(config-if)#no sh
3L -SW1(config-if)#inter vlan 3
3L -SW1(config-if)#ip add 192.168.3.1 255.255.255.0
3L -SW1(config-if)#no sh
3L -SW1(config-if)#inter vlan 4
3L -SW1(config-if)#ip add 192.168.4.1 255.255.255.0
 
接口划入相应的VLAN
3L -SW1#show vlan-s br
VLAN Name                             Status    Ports
- ――――――�C ――――――――――-
1    default           active     Fa0/0, Fa0/5, Fa0/6, Fa0/7
                                 Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
2    V2               active    Fa0/1
3    V3               active    Fa0/2
4    V4               active    Fa0/3, Fa0/4
 
设置速端口,实现快速转发
3L -SW1(config)#inter rang fa0/1 - 15
3L -SW1(config-if-range)#switchport mode access
3L -SW1(config-if-range)#spanning-tree portfast
 
DHCP 配置具体步骤:
 
3L -SW1(config)#ip dhcp pool Vlan2
3L -SW1(dhcp-config)#network 192.168.2.0 255.255.255.0
3L -SW1(dhcp-config)#dns-server 192.168.2.10
3L -SW1(dhcp-config)#default-router 192.168.2.1
3L -SW1(dhcp-config)#domain-name beyondx.cn
 
3L -SW1(config)#ip dhcp pool Vlan3
3L -SW1(dhcp-config)#network 192.168.3.0 255.255.255.0
33L -SW1(dhcp-config)#dns-server 192.168.3.10
3L -SW1(dhcp-config)#default-router 192.168.3.1
3L -SW1(dhcp-config)# lease 3       // 租约时间为3
3L -SW1(dhcp-config)#exit
 
3L -SW1(config)#ip dhcp pool vlan4
3L -SW1(dhcp-config)#network 192.168.4.0 255.255.255.0
3L -SW1(dhcp-config)#dns-server 192.168.4.10
3L -SW1(dhcp-config)#default-router 192.168.4.1
3L -SW1(dhcp-config)#import all
3L -SW1(dhcp-config)#exit
 
保留服务器地址
3L -SW1(config)# ip dhcp excluded-address 192.168.2.1 192.168.2.10
3L -SW1(config)#ip dhcp excluded-address 192.168.3.1 192.168.3.10
3L -SW1(config)#ip dhcp excluded-address 192.168.4.1 192.168.4.10
本文出自 “ 展望未来” 博客,请务必保留此出处 http://wjane.blog.51cto.com/916805/199700

你可能感兴趣的:(网络,休闲,思科,交换,CCNA)