VLAN实验

1.拓扑图

 2.需求分析

  • 全网可达
  • PC通过DHCP获取地址

3.配置内容

<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw1
[sw1]
May 13 2023 22:42:05-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]
May 13 2023 22:42:25-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]int	
[sw1]interface g	
[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]port l	
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-GigabitEthernet0/0/1]
May 13 2023 22:43:25-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-GigabitEthernet0/0/1]port tr	
[sw1-GigabitEthernet0/0/1]port trunk all	
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[sw1-GigabitEthernet0/0/1]
May 13 2023 22:43:55-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095. User interface con0 is available



Please Press ENTER.

<sw1>sys
Enter system view, return user view with Ctrl+Z.
[sw1]int	
[sw1]interface g 0/0/2
[sw1-GigabitEthernet0/0/2]por	
[sw1-GigabitEthernet0/0/2]portlink	
[sw1-GigabitEthernet0/0/2]portlink-	
[sw1-GigabitEthernet0/0/2]port link-t	
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port
May 13 2023 23:06:15-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095. 
                               ^
Error:Incomplete command found at '^' position.
[sw1-GigabitEthernet0/0/2]port de	
[sw1-GigabitEthernet0/0/2]port default vlan 10
[sw1-GigabitEthernet0/0/2]
May 13 2023 23:06:35-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-GigabitEthernet0/0/2]display
                                  ^
Error:Incomplete command found at '^' position.
[sw1-GigabitEthernet0/0/2]display vlan
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:GE0/0/1(U)      GE0/0/3(U)      GE0/0/4(D)      GE0/0/5(D)      
                GE0/0/6(D)      GE0/0/7(D)      GE0/0/8(D)      GE0/0/9(D)      
                GE0/0/10(D)     GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)     
                GE0/0/14(D)     GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)     
                GE0/0/18(D)     GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)     
                GE0/0/22(D)     GE0/0/23(D)     GE0/0/24(D)                     

10   common  UT:GE0/0/2(U)                                                      
             TG:GE0/0/1(U)                                                      

20   common  TG:GE0/0/1(U)                                                      


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020                         
[sw1-GigabitEthernet0/0/2]int g 0/0/3
[sw1-GigabitEthernet0/0/3]port link-t	
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port de
May 13 2023 23:07:35-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 10, the 
change loop count is 0, and the maximum number of records is 4095.	
[sw1-GigabitEthernet0/0/3]port default vlan 20
[sw1-GigabitEthernet0/0/3]
May 13 2023 23:07:45-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the 
change loop count is 0, and the maximum number of records is 4095. User interface 
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw2
[sw2]
May 13 2023 23:07:59-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2]int g 0/0/1
[sw2-GigabitEthernet0/0/1]port link-t	
[sw2-GigabitEthernet0/0/1]q
[sw2]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]
May 13 2023 23:09:29-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2]int g 0/0/1
[sw2-GigabitEthernet0/0/1]port link-t	
[sw2-GigabitEthernet0/0/1]port link-type trunk
[sw2-GigabitEthernet0/0/1]
May 13 2023 23:09:49-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2-GigabitEthernet0/0/1]port trunk all	
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[sw2-GigabitEthernet0/0/1]
May 13 2023 23:10:39-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2-GigabitEthernet0/0/1]q
[sw2]int g 0/0/2
[sw2-GigabitEthernet0/0/2]port link-t	
[sw2-GigabitEthernet0/0/2]port link-type access
[sw2-GigabitEthernet0/0/2]port
May 13 2023 23:11:19-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.
                               ^
Error:Incomplete command found at '^' position.
[sw2-GigabitEthernet0/0/2]port de	
[sw2-GigabitEthernet0/0/2]port default vlan 10
[sw2-GigabitEthernet0/0/2]int g 0/0/3
May 13 2023 23:11:39-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2-GigabitEthernet0/0/3]port link-t	
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/3]port d	
[sw2-GigabitEthernet0/0/3]port discard	
[sw2-GigabitEthernet0/0/3]port default 
May 13 2023 23:12:09-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 10, the 
change loop count is 0, and the maximum number of records is 4095.
[sw2-port-group-default]port de	
[sw2-port-group-default]port default v
May 13 2023 23:12:19-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the 
change loop count is 0, and the maximum number of records is 4095.la
                                         ^
Error:Incomplete command found at '^' position.
[sw2-port-group-default]port de	
[sw2-port-group-default]port default vlan 20
[sw2-port-group-default] User interface con0 is available

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
            ^
Error:Incomplete command found at '^' position.
[Huawei]sys r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]int g 0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip add	
[r1-GigabitEthernet0/0/0.1]ip address 192.168.10.1 24
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 10
[r1-GigabitEthernet0/0/0.1]
May 13 2023 23:17:06-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0.1 has entered the UP state. 
[r1-GigabitEthernet0/0/0.1]
May 13 2023 23:17:07-08:00 r1 ARP/4/ARP_IPCONFLICT_TRAP:OID 16777216.50331648.10
0663296.16777216.67108864.16777216.3674669056.83886080.419430400.2063597568.3355
4432.100663296 ARP detects IP conflict. (IP address=1.10.168.192, Local interfac
e=GigabitEthernet0/0/0.1, Local MAC=00e0-fcf5-2b08, Local vlan=0, Local CE vlan=
0, Receive interface=GigabitEthernet0/0/0.1, Receive MAC=5489-9861-0757, Receive
 vlan=167772160, Receive CE vlan=0, IP conflict type=Local IP conflict). 
[r1-GigabitEthernet0/0/0.1]
May 13 2023 23:17:07-08:00 r1 %%01ARP/4/ARP_DUPLICATE_IPADDR(l)[1]:Received an A
RP packet with a duplicate IP address from the interface. (IpAddress=1.10.168.19
2, InterfaceName=GigabitEthernet0/0/0.1, MacAddress=5489-9861-0757) 
[r1-GigabitEthernet0/0/0.1]arp bro	
[r1-GigabitEthernet0/0/0.1]arp broadcast en	
[r1-GigabitEthernet0/0/0.1]arp broadcast enable 
[r1-GigabitEthernet0/0/0.1]int g 0/0/0.2
[r1-GigabitEthernet0/0/0.2]ip add	
[r1-GigabitEthernet0/0/0.2]ip address 192.168.20.1 24
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 20
May 13 2023 23:18:34-08:00 r1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/0.2 has entered the UP state. 
[r1-GigabitEthernet0/0/0.2]
May 13 2023 23:18:34-08:00 r1 ARP/4/ARP_IPCONFLICT_TRAP:OID 16777216.50331648.10
0663296.16777216.67108864.16777216.3674669056.83886080.419430400.2063597568.3355
4432.100663296 ARP detects IP conflict. (IP address=1.20.168.192, Local interfac
e=GigabitEthernet0/0/0.2, Local MAC=00e0-fcf5-2b08, Local vlan=0, Local CE vlan=
0, Receive interface=GigabitEthernet0/0/0.2, Receive MAC=5489-984c-1531, Receive
 vlan=335544320, Receive CE vlan=0, IP conflict type=Local IP conflict). 
[r1-GigabitEthernet0/0/0.2]
May 13 2023 23:18:34-08:00 r1 %%01ARP/4/ARP_DUPLICATE_IPADDR(l)[3]:Received an A
RP packet with a duplicate IP address from the interface. (IpAddress=1.20.168.19
2, InterfaceName=GigabitEthernet0/0/0.2, MacAddress=5489-984c-1531) 
[r1-GigabitEthernet0/0/0.2]arp bro	
[r1-GigabitEthernet0/0/0.2]arp broadcast en	
[r1-GigabitEthernet0/0/0.2]arp broadcast enable 
[r1-GigabitEthernet0/0/0.2]int g 0/0/1.1
[r1-GigabitEthernet0/0/1.1]ip add	
[r1-GigabitEthernet0/0/1.1]ip address 192.168.10.2
                                                   ^
Error:Incomplete command found at '^' position.
[r1-GigabitEthernet0/0/1.1]ip address 192.168.10.2 24
Error: The specified address conflicts with another address.
[r1-GigabitEthernet0/0/1.1]ip add	
[r1-GigabitEthernet0/0/1.1]ip address 192.168.30.1 24
[r1-GigabitEthernet0/0/1.1]dot1q termination vid 10
May 13 2023 23:21:49-08:00 r1 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP 
on the interface GigabitEthernet0/0/1.1 has entered the UP state. 
[r1-GigabitEthernet0/0/1.1]
May 13 2023 23:21:50-08:00 r1 ARP/4/ARP_IPCONFLICT_TRAP:OID 16777216.50331648.10
0663296.16777216.67108864.16777216.3674669056.83886080.419430400.2063597568.3355
4432.100663296 ARP detects IP conflict. (IP address=1.30.168.192, Local interfac
e=GigabitEthernet0/0/1.1, Local MAC=00e0-fcf5-2b09, Local vlan=0, Local CE vlan=
0, Receive interface=GigabitEthernet0/0/1.1, Receive MAC=5489-9878-8005, Receive
 vlan=167772160, Receive CE vlan=0, IP conflict type=Local IP conflict). 
[r1-GigabitEthernet0/0/1.1]
May 13 2023 23:21:50-08:00 r1 %%01ARP/4/ARP_DUPLICATE_IPADDR(l)[5]:Received an A
RP packet with a duplicate IP address from the interface. (IpAddress=1.30.168.19
2, InterfaceName=GigabitEthernet0/0/1.1, MacAddress=5489-9878-8005) 
[r1-GigabitEthernet0/0/1.1]arp bro	
[r1-GigabitEthernet0/0/1.1]arp broadcast en	
[r1-GigabitEthernet0/0/1.1]arp broadcast enable 
[r1-GigabitEthernet0/0/1.1]int g 0/0/1.2
[r1-GigabitEthernet0/0/1.2]ip add	
[r1-GigabitEthernet0/0/1.2]ip address 192.168.40.1 24
[r1-GigabitEthernet0/0/1.2]dot1q termination vid 20
May 13 2023 23:22:48-08:00 r1 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP 
on the interface GigabitEthernet0/0/1.2 has entered the UP state. 
[r1-GigabitEthernet0/0/1.2]arp bro	
[r1-GigabitEthernet0/0/1.2]arp broadcast en	
[r1-GigabitEthernet0/0/1.2]arp broadcast enable 
[r1-GigabitEthernet0/0/1.2]q
[r1]int g 0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select interface
Error: Please enable DHCP in the global view first.
[r1-GigabitEthernet0/0/0.1]q
[r1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r1]int g 0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select interface
[r1-GigabitEthernet0/0/0.1]dhcp server dns-list 1.2.3.4
[r1-GigabitEthernet0/0/0.1]int g 0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select interface
[r1-GigabitEthernet0/0/0.2]dhcp server dns-list 1.2.3.4
[r1-GigabitEthernet0/0/0.2]int g 0/0/1.1
[r1-GigabitEthernet0/0/1.1]dhcp select interface
[r1-GigabitEthernet0/0/1.1]dhcp server dns-list 1.2.3.4
[r1-GigabitEthernet0/0/1.1]int g 0/0/1.2
[r1-GigabitEthernet0/0/1.2]dhcp select interface
[r1-GigabitEthernet0/0/1.2]
[r1-GigabitEthernet0/0/1.2]dhcp server dns-list 1.2.3.4
[r1-GigabitEthernet0/0/1.2]
[r1-GigabitEthernet0/0/1.2]
[r1-GigabitEthernet0/0/1.2]q

4.测试结果

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值