0
点赞
收藏
分享

微信扫一扫

简单vlan配置

SPEIKE 03-14 13:00 阅读 2

1.连接拓扑图

2.交换机配置

2.1给每个交换机配置vlan

en

进入配置模式:

conf t

vtp mode server

vtp domain wencell(其他与之相连的交换机都会学习到vlan)

vlan 10   (创建名为10的vlan)

exit

vlan 20

exit

vlan 30

exit

vlan 40

exit

将每个端口加入到VLAN:

int f0/1

switchport  access  vlan  10

exit

显示vlan 信息:do sh vlan b

2.2给每个交换机的出接口配置:trunk

int range f0/4

switchport mode trunk

exit

   如果是多个出接口:

   int range f0/3-5

     sw m t

exit

3.路由器配置:

3.1 开启三层路由功能

en

  conf t

  ip routing   开启三层路由功能

  no ip routing  关闭三层路由功能

3.2  路由器虚拟接口配置标签(三层路由上才有)

int f0/0.1  

r1(config-subif)#encapsulation dot1Q 10

r1(config-subif)#ip add 10.1.1.254 255.255.255.0

r1(config-subif)#no sh

r1(config-subif)#exit

int f0/0.2  

r1(config-subif)#encapsulation dot1Q 10

r1(config-subif)#ip add 10.1.1.254 255.255.255.0

r1(config-subif)#no sh 

r1(config-subif)#exit

int f0/0.3  

r1(config-subif)#encapsulation dot1Q 10

r1(config-subif)#ip add 10.1.1.254 255.255.255.0

r1(config-subif)#no sh 

r1(config-subif)#exit

(开启总接口):

r1(config)#int f0/0

r1(config-if)#no sh

r1(config-if)#exit

3.2三层路由器上部署DHCP

conf t  (以下命令,直接复制粘贴)

 ip dhcp excluded-address 10.1.1.1 10.1.1.99(排除的Ip地址)

 ip dhcp pool v10  (地址池的名字是v10)

network 10.1.1.0 255.255.255.0

default-router 10.1.1.254

    dns-server 40.1.1.1

ip dhcp excluded-address 20.1.1.1 20.1.1.99

ip dhcp pool v20

network 20.1.1.0 255.255.255.0

default-router 20.1.1.254

    dns-server 40.1.1.1

ip dhcp excluded-address 30.1.1.1 30.1.1.99

ip dhcp pool v30

network 30.1.1.0 255.255.255.0

default-router 30.1.1.254

    dns-server 40.1.1.1

3.3 查看配置:

r1(config)#do sh run

点击每台pc 可以自动获取ip

3.4删除配置

no ip dhcp excluded-address 10.1.1.1 10.1.1.99

no ip dhcp pool v10

4.路由器不做DHCP,让服务器来做DHCP

4.1 删除配置

no ip dhcp excluded-address 10.1.1.1 10.1.1.99

no ip dhcp excluded-address 20.1.1.1 20.1.1.99

no ip dhcp excluded-address 30.1.1.1 30.1.1.99

no ip dhcp pool v10

no ip dhcp pool v20

no ip dhcp pool v30

(以上命令,直接粘贴复制到en模式下就行)

4.2 服务器配置dhcp

写完每一条后点击添加,不要点保存,最后不要忘了启用

4.3配置DHCP中继

配置dhcp中继,这样不用以广播的形式也能为pc分配ip

在路由器上配置dhcp帮助:

int f0/0.1 (该接口需要被帮助)

  ip helper-address  DHCP服务器的IP

  exit

int f0/0.2 (该接口需要被帮助)

  ip helper-address  40.1.1.1

  exit

int f0/0.3 (该接口需要被帮助)

  ip helper-address  40.1.1.1

  exit

5.Vtp:

举报

相关推荐

配置vlan & 配置trunk

VLAN原理+配置

VLAN的基本配置

vlan原理及配置

HCIA---VLAN基础配置

VLAN与Trunk的配置

0 条评论