您的位置:首页 > 其它

实验:VLAN环境下DHCP的配置

2008-11-16 13:46 736 查看
虚拟情景:
企业有多个部门,这些部门的主机都连接在一台多接口交换机上,不同的部门分别被划分在不同的VLAN中,为了尽快部署,要求使用DHCP对这些属于不同VLAN的主机进行IP地址分配。
实验拓扑如下:



配置步骤概述:
1.在交换机上创建VLAN。在该实验中我们创建了VLAN 10,20,30。
2.在将换机上将连接不同部门的端口分配到所属的VLAN上。如上图示。
3.将交换机与路由器相连的端口配置为TRUNK模式。默认的封装模式为802.1Q。
4.在路由器上的F0/0配置子接口,并将子接口封装在特定的VLAN中。
5.在用户主机上启用“自动获取IP地址”

具体配置如下:
一、交换机上的配置:
Switch#sh run
Building configuration...
Current configuration : 967 bytes
!
version 12.1
no service password-encryption
!
hostname Switch
!
!
!
interface FastEthernet0/1
switchport access vlan 10
!
interface FastEthernet0/2
switchport access vlan 20
!
interface FastEthernet0/3
switchport access vlan 30
!
...略
!
interface FastEthernet0/24
switchport mode trunk
!
interface Vlan1
no ip address
shutdown
!
line con 0
!
line vty 0 4
login
line vty 5 15
login
!
!
end









二、在路由器上的配置:
Router#sh run
Building configuration...
Current configuration : 772 bytes
!
version 12.2
no service password-encryption
!
hostname Router
!
!
!
!
!
ip ssh version 1
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.1
encapsulation dot1Q 10
ip address 192.168.10.254 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation dot1Q 20
ip address 192.168.20.254 255.255.255.0
!
interface FastEthernet0/0.3
encapsulation dot1Q 30
ip address 192.168.30.254 255.255.255.0
!
ip classless
!
!
!
!
ip dhcp pool vlan10
network 192.168.10.0 255.255.255.0
default-router 192.168.10.254
ip dhcp pool vlan20
network 192.168.20.0 255.255.255.0
default-router 192.168.20.254
ip dhcp pool vlan30
network 192.168.30.0 255.255.255.0
default-router 192.168.30.254
!
line con 0
line vty 0 4
login
!
!
end

三、在主机上启用“自动获取IP”


PC0


PC1


PC2
好了,实验结束了。希望能用得着。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  配置 DHCP VLAN 环境 休闲