VLAN配置实验

目录

 步骤一:第一个交换机上创建VLAN

 步骤二:将两个接口划分到对应VLAN中

 步骤三:给pc1 2 3配ip

步骤四:另一个交换机上创建VLAN

步骤五:给pc5配ip

步骤六:trunk干道(左边)

 步骤七:trunk干道(右边)

 步骤八:在第一个交换机上连一个路由器,路由器与交换机trunk

 步骤九:单臂路由——route子接口

步骤十:自动获取ip  DHCP


 

 步骤一:第一个交换机上创建VLAN

[sw1]vlan 2
[sw1-vlan2]q
[sw1]vlan 3
[sw1-vlan3]

[sw1]display vlan

 步骤二:将两个接口划分到对应VLAN中

[sw1]interface Eth0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 2

[sw1]interface Eth0/0/2
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 2

 [sw1]display vlan

 步骤三:给pc1 2 3配ip

 pc1 ping pc3

 可知pc1与pc3不在一个广播域


步骤四:另一个交换机上创建VLAN

[sw2]vlan batch 2 to 3

[sw2]interface Eth0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 2

[sw2]interface Eth0/0/2
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 2

 [sw1]display vlan

步骤五:给pc5配ip

 pc1 ping pc5

 可知pc1与pc5也不通

步骤六:trunk干道(左边)

[sw1]interface Eth0/0/5
[sw1-Ethernet0/0/5]port link-type trunk
[sw1-Ethernet0/0/5]port trunk allow-pass vlan 2 to 3

 步骤七:trunk干道(右边)

[sw2]interface Eth0/0/3
[sw2-Ethernet0/0/3]port link-type trunk
[sw2-Ethernet0/0/3]port trunk allow-pass vlan 2 to 3

 然后用pc1 ping pc5 

 可知pc1与pc5通了


 步骤八:在第一个交换机上连一个路由器,路由器与交换机trunk

[sw1]interface Eth0/0/6
[sw1-Ethernet0/0/6]port link-type trunk
[sw1-Ethernet0/0/6]port trunk allow-pass vlan 2 to 3

 步骤九:单臂路由——route子接口

配置路由器

[route]interface G0/0/0.1
[route-GigabitEthernet0/0/0.1]dot1q termination vid 2
[route-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24
[route-GigabitEthernet0/0/0.1]arp broadcast enable
[route-GigabitEthernet0/0/0.1]q
[route]interface g0/0/0.2
[route-GigabitEthernet0/0/0.2]dot1q termination vid 3
[route-GigabitEthernet0/0/0.2]ip address 192.168.2.254 24
[route-GigabitEthernet0/0/0.2]arp broadcast enable

[route]display ip interface brief  路由器有两个接口出现

 [route]display ip routing-table

步骤十:自动获取ip  DHCP

 把六台pc的配置改为DHCP

然后 PC>ipconfig   

  • 24
    点赞
  • 159
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

妳的大青

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值