vlan技术实验

一.实验拓扑

二.实验需求

1.全网可达;

2.使用DHCP获取IP地址;

三、实验思路

1.配置交换机

创建vlan

更改交换机的接口链路类型

配置trunk干道,放通vlan

2.配置路由器

配置子接口

配置DHCP服务

子接口DHCP服务

四、实验步骤

(改名字省略)

1.创建vlan

以 sw 2 为例

[sw 2]
[sw 2]vlan 2
[sw 2-vlan2]quit

[sw 2]
[sw 2]vlan 3
[sw 2-vlan3]quit

2.更改链路类型

关闭系统日志

[sw 1]quit
<sw 1>undo ter    
<sw 1>undo terminal m    
<sw 1>undo terminal monitor 
Info: Current terminal monitor is off.

<sw 2>
<sw 2>un    
<sw 2>undo ter    
<sw 2>undo terminal m    
<sw 2>undo terminal monitor 
Info: Current terminal monitor is off.
<sw 2>

<sw 3>
<sw 3>undo    
<sw 3>undo ter    
<sw 3>undo terminal m    
<sw 3>undo terminal monitor 
Info: Current terminal monitor is off.
<sw 3>

[sw 1-GigabitEthernet0/0/2]port link-type access 

[sw 1-GigabitEthernet0/0/2]port default vlan 2

[sw 1]int g 0/0/3
[sw 1-GigabitEthernet0/0/3]po    
[sw 1-GigabitEthernet0/0/3]port li    
[sw 1-GigabitEthernet0/0/3]port link-t    
[sw 1-GigabitEthernet0/0/3]port link-type a    
[sw 1-GigabitEthernet0/0/3]port link-type access 
[sw 1-GigabitEthernet0/0/3]p    
[sw 1-GigabitEthernet0/0/3]portd   
[sw 1-GigabitEthernet0/0/3]port d    
[sw 1-GigabitEthernet0/0/3]port discard    
[sw 1-GigabitEthernet0/0/3]port default v    
[sw 1-GigabitEthernet0/0/3]port default vlan 3
[sw 1-GigabitEthernet0/0/3]
[sw 1-GigabitEthernet0/0/3]quit

[sw 1]int g 0/0/1
[sw 1-GigabitEthernet0/0/1]po    
[sw 1-GigabitEthernet0/0/1]port    
[sw 1-GigabitEthernet0/0/1]port l    
[sw 1-GigabitEthernet0/0/1]port link-t    
[sw 1-GigabitEthernet0/0/1]port link-type tru    
[sw 1-GigabitEthernet0/0/1]port link-type trunk 

[sw 1-GigabitEthernet0/0/1]port t    
[sw 1-GigabitEthernet0/0/1]port trunk a    
[sw 1-GigabitEthernet0/0/1]port trunk allow-pass vl    
[sw 1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw 1-GigabitEthernet0/0/1]port trunk allow-pass vlan 3
[sw 1-GigabitEthernet0/0/1]dis th
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 3

[sw 1-GigabitEthernet0/0/1]quit

[sw 2]int g 0/0/3
[sw 2-GigabitEthernet0/0/3]
[sw 2-GigabitEthernet0/0/3]po    
[sw 2-GigabitEthernet0/0/3]port li    
[sw 2-GigabitEthernet0/0/3]port link-t    
[sw 2-GigabitEthernet0/0/3]port link-type ac    
[sw 2-GigabitEthernet0/0/3]port link-type access 

[sw 2-GigabitEthernet0/0/3]port default v    
[sw 2-GigabitEthernet0/0/3]port default vlan 2
[sw 2-GigabitEthernet0/0/3]quit
[sw 2]int g0/0/4
[sw 2-GigabitEthernet0/0/4]po    
[sw 2-GigabitEthernet0/0/4]portl    
[sw 2-GigabitEthernet0/0/4]port l    
[sw 2-GigabitEthernet0/0/4]port link-t    
[sw 2-GigabitEthernet0/0/4]port link-type p    
[sw 2-GigabitEthernet0/0/4]port link-type ac    
[sw 2-GigabitEthernet0/0/4]port link-type access 

[sw 2-GigabitEthernet0/0/4]port de    
[sw 2-GigabitEthernet0/0/4]port default vl    
[sw 2-GigabitEthernet0/0/4]port default vlan 3

[sw 2-GigabitEthernet0/0/2]port l    
[sw 2-GigabitEthernet0/0/2]port link-t    
[sw 2-GigabitEthernet0/0/2]port link-type t    
[sw 2-GigabitEthernet0/0/2]port link-type trunk 
[sw 2-GigabitEthernet0/0/2]po    
[sw 2-GigabitEthernet0/0/2]port t    
[sw 2-GigabitEthernet0/0/2]port trunk a    
[sw 2-GigabitEthernet0/0/2]port trunk allow-pass v    
[sw 2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3
[sw 2-GigabitEthernet0/0/2]
[sw 2-GigabitEthernet0/0/2]int g0/0/1

[sw 2-GigabitEthernet0/0/1]po    
[sw 2-GigabitEthernet0/0/1]port l    
[sw 2-GigabitEthernet0/0/1]port link-t    
[sw 2-GigabitEthernet0/0/1]port link-type t    
[sw 2-GigabitEthernet0/0/1]port link-type trunk 
[sw 2-GigabitEthernet0/0/1]
[sw 2-GigabitEthernet0/0/1]
[sw 2-GigabitEthernet0/0/1]po    
[sw 2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[sw 2-GigabitEthernet0/0/1]quit

[sw 2]dis port v    
[sw 2]dis port vlan a    
[sw 2]dis port vlan active 
T=TAG U=UNTAG
-------------------------------------------------------------------------------
Port                Link Type    PVID    VLAN List
-------------------------------------------------------------------------------
GE0/0/1             trunk        1       U: 1
                                         T: 2 to 3
GE0/0/2             trunk        1       U: 1
                                         T: 2 to 3
GE0/0/3             access       2       U: 2
GE0/0/4             access       3       U: 3
GE0/0/5             hybrid       1       U: 1
GE0/0/6             hybrid       1       U: 1
GE0/0/7             hybrid       1       U: 1
GE0/0/8             hybrid       1       U: 1
GE0/0/9             hybrid       1       U: 1
GE0/0/10            hybrid       1       U: 1
GE0/0/11            hybrid       1       U: 1
GE0/0/12            hybrid       1       U: 1
GE0/0/13            hybrid       1       U: 1
GE0/0/14            hybrid       1       U: 1
GE0/0/15            hybrid       1       U: 1
GE0/0/16            hybrid       1       U: 1
GE0/0/17            hybrid       1       U: 1
GE0/0/18            hybrid       1       U: 1
GE0/0/19            hybrid       1       U: 1
GE0/0/20            hybrid       1       U: 1
GE0/0/21            hybrid       1       U: 1
GE0/0/22            hybrid       1       U: 1
  ---- More ----

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

[sw 3-GigabitEthernet0/0/3]int g0/0/1
[sw 3-GigabitEthernet0/0/1]port link-type t    
[sw 3-GigabitEthernet0/0/1]port link-type trunk 

[sw 3-GigabitEthernet0/0/1]port t    
[sw 3-GigabitEthernet0/0/1]port trunk a    
[sw 3-GigabitEthernet0/0/1]port trunk allow-pass v    
[sw 3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[sw 3-GigabitEthernet0/0/1]

3.配子接口

<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys    
[Huawei]sysname R1
[R1]

[R1-GigabitEthernet0/0/0.2]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0.2]do    
[R1-GigabitEthernet0/0/0.2]dot1q  t    
[R1-GigabitEthernet0/0/0.2]dot1q  termination 

[R1-GigabitEthernet0/0/0.2]dot1q termination vid 2
Jan 16 2024 22:58:08-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0.2 has entered the UP state. 
 

[R1-GigabitEthernet0/0/0.2]ar    
[R1-GigabitEthernet0/0/0.2]arp b    
[R1-GigabitEthernet0/0/0.2]arp broadcast e    
[R1-GigabitEthernet0/0/0.2]arp broadcast enable 
[R1-GigabitEthernet0/0/0.2]quit

[R1]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]ip add 192.168.2.254
                                                ^
Error:Incomplete command found at '^' position.
[R1-GigabitEthernet0/0/0.3]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/0.3]dot1q termination vid 3
Jan 16 2024 23:00:19-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0.3 has entered the UP state. 
[R1-GigabitEthernet0/0/0.3]arp broadcast enable
[R1-GigabitEthernet0/0/0.3]quit
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]ip add 192.168.3.254 24
[R1-GigabitEthernet0/0/1.2]dot1q termination vid 2
Jan 16 2024 23:01:24-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/1.2 has entered the UP state. 
[R1-GigabitEthernet0/0/1.2]arp broadcast enable
[R1-GigabitEthernet0/0/1.2]quit

[R1]int g0/0/1.3
[R1-GigabitEthernet0/0/1.3]ip add 192.168.4.254 24
[R1-GigabitEthernet0/0/1.3]dot1q termination vid 3
Jan 16 2024 23:02:32-08:00 R1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet0/0/1.3 has entered the UP state. 
[R1-GigabitEthernet0/0/1.3]arp broadcast enable
[R1-GigabitEthernet0/0/1.3]quit
[R1]

4.配地址池(4个)

[R1]dhcp en    
[R1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]ip po    
[R1]ip policy-based-route
[R1]ip pool
            ^
Error:Incomplete command found at '^' position.
[R1]ip pool z2
Info: It's successful to create an IP address pool.
[R1-ip-pool-z2]net    
[R1-ip-pool-z2]netbios-type
[R1-ip-pool-z2]network 192.168.1.0 mask 24
[R1-ip-pool-z2]ga
                  ^
Error:Incomplete command found at '^' position.
[R1-ip-pool-z2]gat    
[R1-ip-pool-z2]gateway-list 192.168.1.254
[R1-ip-pool-z2]dns-l    
[R1-ip-pool-z2]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-z2]quit
[R1]
[R1]
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp s    
[R1-GigabitEthernet0/0/0.2]dhcp select g    
[R1-GigabitEthernet0/0/0.2]dhcp select global 

[R1-GigabitEthernet0/0/1.2]quit

[R1]ip pool z3
Info: It's successful to create an IP address pool.
[R1-ip-pool-z3]    
[R1-ip-pool-z3]n    
[R1-ip-pool-z3]nbns-list
[R1-ip-pool-z3]netbios-type
[R1-ip-pool-z3]network 192.168.2.0 m    
[R1-ip-pool-z3]network 192.168.2.0 mask 2
Error:Invalid subnet mask.
[R1-ip-pool-z3]network 192.168.2.0 mask 24
[R1-ip-pool-z3]ga    
[R1-ip-pool-z3]gateway-list 192.168.2.254
[R1-ip-pool-z3]d    
[R1-ip-pool-z3]dialer
[R1-ip-pool-z3]display
[R1-ip-pool-z3]dns-list 8.8.8.8 114.114.114
                                ^
Error: Wrong parameter found at '^' position.
[R1-ip-pool-z3]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-z3]quit
[R1]int g0/0/0.3

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

[R1-GigabitEthernet0/0/0.3]quit

[R1]ip pool y3[R1]ip pool y2
Info: It's successful to create an IP address pool.
[R1-ip-pool-y2]ne    
[R1-ip-pool-y2]netbios-type
[R1-ip-pool-y2]network 192.168.3.0 m    
[R1-ip-pool-y2]network 192.168.3.0 mask 24
[R1-ip-pool-y2]ga    
[R1-ip-pool-y2]gateway-list 192.168.3.254
[R1-ip-pool-y2]dns    
[R1-ip-pool-y2]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-y2]quit
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]dhcp s    
[R1-GigabitEthernet0/0/1.2]dhcp select g    
[R1-GigabitEthernet0/0/1.2]dhcp select global 
[R1-GigabitEthernet0/0/1.2]quit

[R1]ip pool y3
[R1-ip-pool-y3]network 192.168.4.0 mask 24
[R1-ip-pool-y3]gateway-list 192.168.4.254
[R1-ip-pool-y3]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-y3]quit
[R1]int g0/0/1.3
[R1-GigabitEthernet0/0/1.3]dhcp select global
[R1-GigabitEthernet0/0/1.3]quit
[R1]

5.测试

  • 30
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值