VLAN实验

本文详细描述了如何通过配置VLAN、接口类型、子接口以及DHCP服务,在交换机和路由器上构建一个全网可达的网络环境,确保设备通过DHCP获取IP地址并进行通信。
摘要由CSDN通过智能技术生成

实验拓补

 实验要求:

 全网可达 

 使用dhcp获取IP地址

实验思路

  1. 在交换机中建立vlan,根据接口不同更改接口的默认vlan和类型
  2. 在路由器配置子接口并下发dhcp服务

实验步骤

[sw1]vlan 2

[sw1-vlan2]quit

[sw1]vlan 3

[sw1]int e0/0/2

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

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

[sw1-Ethernet0/0/2]int e0/0/3

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

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

[sw1-Ethernet0/0/3]int e0/0/1

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

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

[sw1-Ethernet0/0/1] User interface con0 is available

[sw2]vlan 2

[sw2]vlan 3

[sw2]int e0/0/3

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

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

[sw2-Ethernet0/0/3]int e0/0/4

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

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

[sw2-Ethernet0/0/4]int e0/0/1

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

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

[sw2-Ethernet0/0/1]int e0/0/2

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

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

[sw3]vlan 2

[sw3-vlan2]quit

[sw3]vlan 3

[sw3-vlan3] User interface con0 is available

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

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

[sw3-Ethernet0/0/2]int e0/0/3

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

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

[sw3-Ethernet0/0/3]int e0/0/1

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

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

[R1]int g0/0/0.2

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

termination vid 2

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

[R1]int g0/0/0.3

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

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

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

[R1]dhcp enable

[R1]ip pool 1

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

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

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

[R1-ip-pool-1]quit

[R1]int g0/0/0.2

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

[R1]ip pool 2

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

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

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

[R1-ip-pool-2]quit

[R1]int g0/0/0.3

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

[R1]ip pool 3

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

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

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

[R1]int g0/0/1.2

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

[R1]ip pool 4

[R1-ip-pool-4]network 192.168.4.0 mask 24

[R1-ip-pool-4]gateway-list 192.168.4.254

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

[R1-ip-pool-4]int g0/0/1.3

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

全网通测试

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值