Advertisement

实验:VLAN环境下DHCP的配置

阅读量:

虚拟情景:

企业有多个部门,这些部门的主机都连接在一台多接口交换机上,不同的部门分别被划分在不同的VLAN中,为了尽快部署,要求使用DHCP对这些属于不同VLAN的主机进行IP地址分配。

实验拓扑如下:

[

image

](http://tiger506.blog.51cto.com/attachment/200811/16/318536_1226814388Te6Y.png)

配置步骤概述:

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

[

image

](http://tiger506.blog.51cto.com/attachment/200811/16/318536_1226814390kLHx.png)

[

image

](http://tiger506.blog.51cto.com/attachment/200811/16/318536_1226814392rg6o.png)

二、在路由器上的配置:

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”

[

image

](http://tiger506.blog.51cto.com/attachment/200811/16/318536_1226814394RJiI.png) PC0

[

image

](http://tiger506.blog.51cto.com/attachment/200811/16/318536_1226814395OMfb.png) PC1

[

image

](http://tiger506.blog.51cto.com/attachment/200811/16/318536_122681440037aY.png) PC2

好了,实验结束了。希望能用得着。

本文转自 tiger506 51CTO网站上的博客文章, 原文链接为 http://blog.51cto.com/tiger506/113080, 如转载此篇文章, 请直接联系原作者获取授权

全部评论 (0)

还没有任何评论哟~