VLAN技术实验报告

1.实验拓扑

  • 实验要求

1.全网可达

2.使用DHCP获取地址

  • 实验思路
  1. 配置交换机,创建vlan,更改交换机的接口链路类型,配置trunk干道,放通vlan
  2. 配置路由器,配置DHCP服务,在子接口DHCP服务

  • 实验步骤
  1. 创建vlan

[sw1]vlan 2

[sw1-vlan2]quit

[sw1]vlan 3

[sw1-vlan3]quit

[sw2]vlan 2

[sw2-vlan2]quit

[sw2]vlan 3

[sw2-vlan3]quit

[sw3]vlan 2

[sw3-vlan2]quit

[sw3]vlan 3

[sw3-vlan3]quit

  1. 更改接口链路类型,把接口加入到相应的vlan中.

[sw1]int e0/0/2

[sw1-Ethernet0/0/2]port

[sw1-Ethernet0/0/2]port lint

[sw1-Ethernet0/0/2]port link-type ac

[sw1-Ethernet0/0/2]port link-type access

[sw1-Ethernet0/0/2]port de

[sw1-Ethernet0/0/2]port default vlan 2

[sw1-Ethernet0/0/2]quit

[sw1]int e0/0/3

[sw1-Ethernet0/0/3]port silk

[sw1-Ethernet0/0/3]port link-type ac

[sw1-Ethernet0/0/3]port link-type access

[sw1-Ethernet0/0/3]port

[sw1-Ethernet0/0/3]port de

[sw1-Ethernet0/0/3]port default

[sw1-Ethernet0/0/3]port default vlan 3

[sw1]

[sw1]int e0/0/1

[sw1-Ethernet0/0/1]port link-ty

[sw1-Ethernet0/0/1]port link-type tr

[sw1-Ethernet0/0/1]port link-type trunk

[sw1-Ethernet0/0/1]port t

[sw1-Ethernet0/0/1]port trunk

[sw1-port-group-trunk]

[sw1-port-group-trunk]quit

[sw2]int e0/0/3

[sw2-Ethernet0/0/3]

[sw2-Ethernet0/0/3]port link-ty

[sw2-Ethernet0/0/3]port link-type

[sw2-port-group-link-type]port link-type ac

[sw2-port-group-link-type]port link-type access

[sw2-port-group-link-type]port de

[sw2-port-group-link-type]port default vlan 2

[sw2-port-group-link-type]quit

[sw2]int e0/0/4

[sw2-Ethernet0/0/4]port link-ty

[sw2-Ethernet0/0/4]port link-type ac

[sw2-Ethernet0/0/4]port link-type access

[sw2-Ethernet0/0/4]port de

[sw2-Ethernet0/0/4]port default vlan 3

[sw2-Ethernet0/0/4]quit

[sw3]int e0/0/2

[sw3-Ethernet0/0/2]port link-ty

[sw3-Ethernet0/0/2]port link-type ac

[sw3-Ethernet0/0/2]port link-type access

[sw3-Ethernet0/0/2]

[sw3-Ethernet0/0/2]port de

[sw3-Ethernet0/0/2]port default vlan 2

[sw3-Ethernet0/0/2]

[sw3-Ethernet0/0/2]

[sw3-Ethernet0/0/2]quit

[sw3]int e0/0/3

[sw3-Ethernet0/0/3]port link-ty

[sw3-Ethernet0/0/3]port link-type ac

[sw3-Ethernet0/0/3]port link-type access

[sw3-Ethernet0/0/3]

[sw3-Ethernet0/0/3]port de

[sw3-Ethernet0/0/3]port default vlan 3

[sw3-Ethernet0/0/3]

[sw3-Ethernet0/0/3]quit

  1. 放通vlan

[sw1-Ethernet0/0/1]port tr

[sw1-Ethernet0/0/1]port trunk ai

[sw1-Ethernet0/0/1]port trunk al

[sw1-Ethernet0/0/1]port trunk allow-pass  vlan ?

  INTEGER<1-4094>  VLAN ID

  all              All

[sw1-Ethernet0/0/1]port trunk allow-pass  vlan

[sw1-Ethernet0/0/1]port trunk allow-pass  vlan 2 3

[sw1-Ethernet0/0/1]quit

[sw1]

dis port vlan active 可检查放通情况

[sw2]int e0/0/2

[sw2-Ethernet0/0/2]port link-ty

[sw2-Ethernet0/0/2]port link-type tr

[sw2-Ethernet0/0/2]port link-type trunk

[sw2-Ethernet0/0/2]port t

[sw2-Ethernet0/0/2]port trunk al

[sw2-Ethernet0/0/2]port trunk allow-pass vlan 2 3

[sw2-Ethernet0/0/2]quit

[sw2]

[sw2]int e0/0/1

[sw2-Ethernet0/0/1]dis th

[sw2-Ethernet0/0/1]dis this

#

interface Ethernet0/0/1

#

return

[sw2-Ethernet0/0/1]port link-ty

[sw2-Ethernet0/0/1]port link-type tr

[sw2-Ethernet0/0/1]port link-type trunk

[sw2-Ethernet0/0/1]

[sw2-Ethernet0/0/1]port trunk al

[sw3]int e0/0/1

[sw3-Ethernet0/0/1]port link-ty

[sw3-Ethernet0/0/1]port link-type tr

[sw3-Ethernet0/0/1]port link-type trunk

[sw3-Ethernet0/0/1]port t

[sw3-Ethernet0/0/1]port trunk al

[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2 3

  • 实验拓扑

  • 实验要求

1.全网可达

2.使用DHCP获取地址

  • 实验思路
  1. 配置交换机,创建vlan,更改交换机的接口链路类型,配置trunk干道,放通vlan
  2. 配置路由器,配置DHCP服务,在子接口DHCP服务

  • 实验步骤
  1. 创建vlan

[sw1]vlan 2

[sw1-vlan2]quit

[sw1]vlan 3

[sw1-vlan3]quit

[sw2]vlan 2

[sw2-vlan2]quit

[sw2]vlan 3

[sw2-vlan3]quit

[sw3]vlan 2

[sw3-vlan2]quit

[sw3]vlan 3

[sw3-vlan3]quit

  1. 更改接口链路类型,把接口加入到相应的vlan中.

[sw1]int e0/0/2

[sw1-Ethernet0/0/2]port

[sw1-Ethernet0/0/2]port lint

[sw1-Ethernet0/0/2]port link-type ac

[sw1-Ethernet0/0/2]port link-type access

[sw1-Ethernet0/0/2]port de

[sw1-Ethernet0/0/2]port default vlan 2

[sw1-Ethernet0/0/2]quit

[sw1]int e0/0/3

[sw1-Ethernet0/0/3]port silk

[sw1-Ethernet0/0/3]port link-type ac

[sw1-Ethernet0/0/3]port link-type access

[sw1-Ethernet0/0/3]port

[sw1-Ethernet0/0/3]port de

[sw1-Ethernet0/0/3]port default

[sw1-Ethernet0/0/3]port default vlan 3

[sw1]

[sw1]int e0/0/1

[sw1-Ethernet0/0/1]port link-ty

[sw1-Ethernet0/0/1]port link-type tr

[sw1-Ethernet0/0/1]port link-type trunk

[sw1-Ethernet0/0/1]port t

[sw1-Ethernet0/0/1]port trunk

[sw1-port-group-trunk]

[sw1-port-group-trunk]quit

[sw2]int e0/0/3

[sw2-Ethernet0/0/3]

[sw2-Ethernet0/0/3]port link-ty

[sw2-Ethernet0/0/3]port link-type

[sw2-port-group-link-type]port link-type ac

[sw2-port-group-link-type]port link-type access

[sw2-port-group-link-type]port de

[sw2-port-group-link-type]port default vlan 2

[sw2-port-group-link-type]quit

[sw2]int e0/0/4

[sw2-Ethernet0/0/4]port link-ty

[sw2-Ethernet0/0/4]port link-type ac

[sw2-Ethernet0/0/4]port link-type access

[sw2-Ethernet0/0/4]port de

[sw2-Ethernet0/0/4]port default vlan 3

[sw2-Ethernet0/0/4]quit

[sw3]int e0/0/2

[sw3-Ethernet0/0/2]port link-ty

[sw3-Ethernet0/0/2]port link-type ac

[sw3-Ethernet0/0/2]port link-type access

[sw3-Ethernet0/0/2]

[sw3-Ethernet0/0/2]port de

[sw3-Ethernet0/0/2]port default vlan 2

[sw3-Ethernet0/0/2]

[sw3-Ethernet0/0/2]

[sw3-Ethernet0/0/2]quit

[sw3]int e0/0/3

[sw3-Ethernet0/0/3]port link-ty

[sw3-Ethernet0/0/3]port link-type ac

[sw3-Ethernet0/0/3]port link-type access

[sw3-Ethernet0/0/3]

[sw3-Ethernet0/0/3]port de

[sw3-Ethernet0/0/3]port default vlan 3

[sw3-Ethernet0/0/3]

[sw3-Ethernet0/0/3]quit

  1. 放通vlan

[sw1-Ethernet0/0/1]port tr

[sw1-Ethernet0/0/1]port trunk ai

[sw1-Ethernet0/0/1]port trunk al

[sw1-Ethernet0/0/1]port trunk allow-pass  vlan ?

  INTEGER<1-4094>  VLAN ID

  all              All

[sw1-Ethernet0/0/1]port trunk allow-pass  vlan

[sw1-Ethernet0/0/1]port trunk allow-pass  vlan 2 3

[sw1-Ethernet0/0/1]quit

[sw1]

dis port vlan active 可检查放通情况

[sw2]int e0/0/2

[sw2-Ethernet0/0/2]port link-ty

[sw2-Ethernet0/0/2]port link-type tr

[sw2-Ethernet0/0/2]port link-type trunk

[sw2-Ethernet0/0/2]port t

[sw2-Ethernet0/0/2]port trunk al

[sw2-Ethernet0/0/2]port trunk allow-pass vlan 2 3

[sw2-Ethernet0/0/2]quit

[sw2]

[sw2]int e0/0/1

[sw2-Ethernet0/0/1]dis th

[sw2-Ethernet0/0/1]dis this

#

interface Ethernet0/0/1

#

return

[sw2-Ethernet0/0/1]port link-ty

[sw2-Ethernet0/0/1]port link-type tr

[sw2-Ethernet0/0/1]port link-type trunk

[sw2-Ethernet0/0/1]

[sw2-Ethernet0/0/1]port trunk al

[sw3]int e0/0/1

[sw3-Ethernet0/0/1]port link-ty

[sw3-Ethernet0/0/1]port link-type tr

[sw3-Ethernet0/0/1]port link-type trunk

[sw3-Ethernet0/0/1]port t

[sw3-Ethernet0/0/1]port trunk al

[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2 3

  1. 配路由器

[R1]int g0/0/0.2

[R1-GigabitEthernet0/0/0.2]ip add 192.168.1.254 24

[R1-GigabitEthernet0/0/0.2]

[R1-GigabitEthernet0/0/0.2]

[R1-GigabitEthernet0/0/0.2]do

[R1-GigabitEthernet0/0/0.2]dot1q

[R1-GigabitEthernet0/0/0.2]dot1q ter

[R1-GigabitEthernet0/0/0.2]dot1q termination vid 2

dot1q termination vid可开启识别vlan的功能

arp broadcast enable实现广播允许子接口向物理口记住mac地址

[R1]int g0/0/0.3

[R1-GigabitEthernet0/0/0.3]ip add 192.168.2.254 24

[R1-GigabitEthernet0/0/0.3]

[R1-GigabitEthernet0/0/0.3]dou

[R1-GigabitEthernet0/0/0.3]dot

[R1-GigabitEthernet0/0/0.3]dot1q ter

[R1-GigabitEthernet0/0/0.3]dot1q termination vid 3

Jan 17 2024 01:35:30-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP

on the interface GigabitEthernet0/0/0.3 has entered the UP state.

[R1-GigabitEthernet0/0/0.3]

[R1-GigabitEthernet0/0/0.3]arp b

[R1-GigabitEthernet0/0/0.3]arp broadcast en

[R1-GigabitEthernet0/0/0.3]arp broadcast enable

[R1-GigabitEthernet0/0/0.3]quit

[R1]

[R1]int g0/0/1.2

[R1-GigabitEthernet0/0/1.2]ip add 192.168.3.254 24

[R1-GigabitEthernet0/0/1.2]do

[R1-GigabitEthernet0/0/1.2]dot1q ter

[R1-GigabitEthernet0/0/1.2]dot1q termination vid 2

[R1]int g0/0/1.3

[R1-GigabitEthernet0/0/1.3]ip add 192.168.4.254 24

[R1-GigabitEthernet0/0/1.3]

[R1-GigabitEthernet0/0/1.3]do

[R1-GigabitEthernet0/0/1.3]dot1q ter

[R1-GigabitEthernet0/0/1.3]dot1q termination vid 3

[R1-GigabitEthernet0/0/1.3]arp b

[R1-GigabitEthernet0/0/1.3]arp broadcast en

[R1-GigabitEthernet0/0/1.3]arp broadcast enable

[R1-GigabitEthernet0/0/1.3]quit

在路由器上配置DRCP服务

[R1]dhcp en

[R1]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

后创建地址池

[R1]ip pool aa

Info: It's successful to create an IP address pool.

[R1-ip-pool-aa]

[R1-ip-pool-aa]

[R1-ip-pool-aa]netw

[R1-ip-pool-aa]network 192.168.1.0 mask 24

[R1-ip-pool-aa]

网关地址和DHCP服务器地址

[R1-ip-pool-aa]

网关:[R1-ip-pool-aa]ga

[R1-ip-pool-aa]gateway-list 192.168.1.254

[R1-ip-pool-aa]dn

DHCP服务器地址:[R1-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114

[R1-ip-pool-aa]quit

[R1]

[R1]int g0/0/0.2

[R1-GigabitEthernet0/0/0.2]dhcp se

[R1-GigabitEthernet0/0/0.2]dhcp select g

[R1-GigabitEthernet0/0/0.2]dhcp select global

[R1-GigabitEthernet0/0/0.2]quit

[R1]ip pool bb

Info: It's successful to create an IP address pool.

[R1-ip-pool-bb]ga

[R1-ip-pool-bb]net

[R1-ip-pool-bb]netw

[R1-ip-pool-bb]network 192.168.2.0 mask 24

[R1-ip-pool-bb]ga

[R1-ip-pool-bb]gateway-list 192.168.2.254

[R1-ip-pool-bb]de

[R1-ip-pool-bb]dn

[R1-ip-pool-bb]dns-list 8.8.8.8 114.114.114.114

[R1-ip-pool-bb]quit

[R1]int g0/0/0.3

[R1-GigabitEthernet0/0/0.3]dhcp se

[R1-GigabitEthernet0/0/0.3]dhcp select g

R1]ip pool cc

Info: It's successful to create an IP address pool.

[R1-ip-pool-cc]netw

[R1-ip-pool-cc]network 192.168.3.0 mask 24

[R1-ip-pool-cc]ga

[R1-ip-pool-cc]gateway-list 192.168.3.254

[R1-ip-pool-cc]dn

[R1-ip-pool-cc]dns-list 8.8.8.8 114.114.114.114

[R1-ip-pool-cc]quit

[R1]int g0/0/1.2

[R1-GigabitEthernet0/0/1.2]dhcp se

[R1-GigabitEthernet0/0/1.2]dhcp select g

[R1-GigabitEthernet0/0/1.2]dhcp select global

[R1-GigabitEthernet0/0/1.2]quit

[R1]

经检测PC之间可通.

  • 17
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值