首页 > 其他分享 >二十四. vlan综合实验

二十四. vlan综合实验

时间:2022-12-04 23:24:36浏览次数:40  
标签:R2 int ip vlan GigabitEthernet0 实验 二十四 port

1. 实验图

img

2. 配置流程

第1个里程: 配置SW1

1接口配置

<Huawei>sys
<Huawei>sysname S1
[Huawei]vlan batch 10 20
[Huawei]int e0/0/1
[Huawei]port link-type access
[Huawei]port default vlan 10

2接口配置

[Huawei]int e0/0/2
[Huawei]port link-type access
[Huawei]port default vlan 20

3接口配置

[Huawei]int e0/0/3
[Huawei]port link-type trunk
[Huawei]port trunk allow-pass vlan 10 20

第2个里程: 配置SW2

1接口配置

<Huawei>sys
[Huawei]sysname R2
开启dhcp
[R2]dhcp enable
创建vlan
[R2]vlan batch 10 20
[R2]int g0/0/1
配置vlan接口类型
[R2-GigabitEthernet0/0/1]port link-type trunk
允许vlan10 和vlan 20通过
[R2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
配置vlanif接口
[R2-GigabitEthernet0/0/1]int Vlanif 10
[R2-Vlanif10]ip add 192.168.10.1 24
[R2-Vlanif10]dhcp select interface
[R2-Vlanif10]int Vlanif 20
[R2-Vlanif20]ip add 192.168.20.1 24
[R2-Vlanif20]dhcp select interface

2接口配置

[R2]vlan batch 23
[R2]int g0/0/2
[R2-GigabitEthernet0/0/2]port link-type access
[R2-GigabitEthernet0/0/2]port default vlan 23
[R2-GigabitEthernet0/0/2]int vlanif 23
[R2-Vlanif23]ip add 23.0.0.2 24

第3个里程: 配置SW3

1接口配置

<Huawei>sys
[Huawei]sysname R3
[R3]vlan batch 23 13
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]port link-type access
[R3-GigabitEthernet0/0/1]port default vlan 23
[R3-GigabitEthernet0/0/1]int vlanif 23
[R3-Vlanif23]ip add 23.0.0.3 24

2接口配置

[R3-Vlanif23]int g0/0/2
[R3-GigabitEthernet0/0/2]port link-type access
[R3-GigabitEthernet0/0/2]port default vlan 13
[R3-GigabitEthernet0/0/2]int vlanif 13
[R3-Vlanif13]ip add 13.0.0.3 24

第4个里程: 配置路由器R1

<Huawei>sys
[Huawei]sysname R1
切换到接口配置ip
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 13.0.0.1 24

配置第1个子接口
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1]int g0/0/1.100
[R1-GigabitEthernet0/0/1.100]ip add 192.168.100.1 24
[R1-GigabitEthernet0/0/1.100]dot1q termination vid 100
[R1-GigabitEthernet0/0/1.100]arp broadcast enable
配置第2个子接口
[R1-GigabitEthernet0/0/1.100]int g0/0/1.200
[R1-GigabitEthernet0/0/1.200]ip add 192.168.200.1 24
[R1-GigabitEthernet0/0/1.200]dot1q termination vid 200
[R1-GigabitEthernet0/0/1.200]arp broadcast enable

第5个里程: 配置SW4

2接口配置

<Huawei>sys
[Huawei]sysname S4
创建vlan
[S4]vlan batch 100 200
[S4]int g0/0/2
设置vlan接口类型为access
[S4-GigabitEthernet0/0/2]port link-type access
加入到vlan 100
[S4-GigabitEthernet0/0/2]port default vlan 100

3接口配置

[S4-GigabitEthernet0/0/2]int g0/0/3
[S4-GigabitEthernet0/0/3]port link-type access
[S4-GigabitEthernet0/0/3]port default vlan 200

1接口配置

[S4-GigabitEthernet0/0/3]int g0/0/1
设置vlan接口类型为trunk
[S4-GigabitEthernet0/0/1]port link-type trunk
允许vlan 100 和 vlan 200通过
[S4-GigabitEthernet0/0/1]port trunk allow-pass vlan 100 200

第6个里程: 配置服务器IP地址和网关

server1
img
server2
img

第7个里程: 配置pc去往服务器的路由

sw2配置路由

[R2]ip route-s 13.0.0.0 24 23.0.0.3
[R2]ip route-s 192.168.100.0 24 23.0.0.3
[R2]ip route-s 192.168.200.0 24 23.0.0.3

SW3配置路由

<R3>sys
[R3]ip route-s 192.168.100.0 24 13.0.0.1
[R3]ip route-s 192.168.200.0 24 13.0.0.1
[R3]ip route-s 192.168.10.0 24 23.0.0.2
[R3]ip route-s 192.168.20.0 24 23.0.0.2

R1配置路由

<R1>sys
[R1]ip route-s 23.0.0.0 24 13.0.0.3
[R1]ip route-s 192.168.10.0 24 13.0.0.3
[R1]ip route-s 192.168.20.0 24 13.0.0.3

测试pc和服务器是否互通

标签:R2,int,ip,vlan,GigabitEthernet0,实验,二十四,port
From: https://www.cnblogs.com/yufenchi/p/16951168.html

相关文章

  • 2022-2023-1学期 20221417 《计算机基础与程序设计》实验七-缓冲区溢出
    1.实验指导书内容2.缓冲区溢出的原理3.缓冲区溢出的防范实验指导书内容https://blog.csdn.net/weixin_43771137/article/details/128063046缓冲区溢出原理缓冲......
  • 实验5
    #pragmaonce#include<iostream>#include<iomanip>#include<string>usingnamespacestd;classMachinePets{public: MachinePets(){}; MachinePets(conststri......
  • 实验6
    #include<iostream>#include<fstream>#include<array>#defineN5intmain(){usingnamespacestd;array<int,N>x{97,98,99,100,101};o......
  • 实验六
    实验三task3_1.cpp1#include<iostream>2#include<fstream>3#include<array>4#defineN556intmain(){7usingnamespacestd;89......
  • 实验六 模板类和文件I/O
    task3_1:1#include<iostream>2#include<fstream>3#include<array>4#defineN556intmain(){7usingnamespacestd;89array<......
  • 实验6 模板类和文件I/O
    实验任务31#include<iostream>2#include<fstream>3#include<array>4#defineN55intmain(){6usingnamespacestd;7array<int,N>x{......
  • 实验6 模板类和文件IO
    一、实验任务三1.源代码:task3_1.cpp#include<iostream>#include<fstream>#include<array>#defineN5intmain(){usingnamespacestd;array<int,N>x{97,9......
  • 实验6 模板类和文件I/O
    实验任务3task3_11#include<iostream>2#include<fstream>3#include<array>4#defineN556intmain(){7usingnamespacestd;8array<in......
  • 实验六
    #include<iostream>#include<fstream>#include<array>#defineN5intmain(){usingnamespacestd;array<int,N>x{97,98,99,100,101};o......
  • 实验6
    task3.1#include<iostream>#include<fstream>#include<array>#defineN5intmain(){usingnamespacestd;array<int,N>x{97,98,99,100,101}......