专业认证

关注公众号 jb51net

关闭
IT专业知识 > 专业认证 >

华为HCIA认证考试VLAN 配置实验案例

我畏时光

本文讲述了华为HCIA认证考试VLAN 配置实验。分享给大家供大家参考,具体如下:

HCIA---VLAN 实验

 

目录

搭建拓扑图

在这里插入图片描述

实验要求

1.IP地址基于172.16.0.0 /24进行子网划分
2.所有PC的IP地址自动获取
3.全网可达

配置过程

配置 IP 地址和缺省

R1:
 

system-view
[Huawei]sysname R1
[R1]interface gi 0/0/0
[R1-GigabitEthernet0/0/0]ip address 172.16.0.1 27
[R1-GigabitEthernet0/0/0]int gi 0/0/1
[R1-GigabitEthernet0/0/1]ip add 172.16.0.33 27
[R1-GigabitEthernet0/0/1]int gi 0/0/1.1
[R1-GigabitEthernet0/0/1.1]ip add 172.16.0.161 27
[R1-GigabitEthernet0/0/1.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/1.2]quit
[R1]ip route-static 0.0.0.0 0 172.16.0.2

R2:
 

system-view
[Huawei]sysname R2
[R2]inter gi 0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.0.2 27
[R2-GigabitEthernet0/0/0]int gi 0/0/1
[R2-GigabitEthernet0/0/1]ip add 172.16.0.97 27
[R2-GigabitEthernet0/0/1]int gi 0/0/2
[R2-GigabitEthernet0/0/2]ip add 202.100.1.1 24
[R2-GigabitEthernet0/0/2]int gi 0/0/1.1
[R2-GigabitEthernet0/0/1.1]ip add 172.16.0.193 27
[R2-GigabitEthernet0/0/1.1]dot1q termination vid 2
[R2-GigabitEthernet0/0/1.2]quit

配置 DHCP

R1:
 

[R1]dhcp enable
[R1]int gi 0/0/1.1
[R1-GigabitEthernet0/0/1.1]dhcp select interface
[R1-GigabitEthernet0/0/1.1]dhcp server dns-list 114.114.114.114
[R1-GigabitEthernet0/0/1.1]arp broadcast enable
[R1-GigabitEthernet0/0/1.1]int gi 0/0/1
[R1-GigabitEthernet0/0/1.2]dhcp sel int
[R1-GigabitEthernet0/0/1.2]dhcp ser dns 114.114.114.114
[R1-GigabitEthernet0/0/1.2]arp broadcast enable
[R1-GigabitEthernet0/0/1.2]quit

R2:
 

[R2]dhcp enable
[R2]int gi 0/0/1.1
[R2-GigabitEthernet0/0/1.1]dhcp sel int
[R2-GigabitEthernet0/0/1.1]dhcp ser dns 114.114.114.114
[R2-GigabitEthernet0/0/1.1]arp broadcast enable
[R2-GigabitEthernet0/0/1.1]int gi 0/0/1
[R2-GigabitEthernet0/0/1.2]dhcp sel int
[R2-GigabitEthernet0/0/1.2]dhcp ser dns 114.114.114.114
[R2-GigabitEthernet0/0/1.2]arp broadcast enable
[R2-GigabitEthernet0/0/1.2]quit

配置 OSPF 协议

R1:
 

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 172.16.0.32 0.0.0.31
[R1-ospf-1-area-0.0.0.0]network 172.16.0.160 0.0.0.31
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]bandwidth-reference 10000
[R1-ospf-1]default-route-advertise
[R1-ospf-1]quit
[R1]quit
save

R2:
 

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.96 0.0.0.31
[R2-ospf-1-area-0.0.0.0]network 172.16.0.192 0.0.0.31
[R2-ospf-1-area-0.0.0.0]quit
[R2-ospf-1]bandwidth-reference 10000
[R2-ospf-1]default-route-advertise always
[R2-ospf-1]quit
[R2]quit
save

配置 VLAN 并修改 TRUNK 干道

SW1:
 

system-view
[Huawei]sysname SW1
[SW1]vlan 2
[SW1-vlan2]quit
[SW1]int gi 0/0/3
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]port default vlan 2
[SW1-GigabitEthernet0/0/3]int gi 0/0/4
[SW1-GigabitEthernet0/0/4]port link-type access
[SW1-GigabitEthernet0/0/4]int gi 0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 2
[SW1-GigabitEthernet0/0/2]quit
[SW1]quit
save

SW2:
 

system-view
[Huawei]sysname SW2
[SW2]int gi 0/0/3
[SW2-GigabitEthernet0/0/3]port link-type access
[SW2-GigabitEthernet0/0/3]port default vlan 2
[SW2-GigabitEthernet0/0/3]int gi 0/0/4
[SW2-GigabitEthernet0/0/4]port link-type access
[SW2-GigabitEthernet0/0/4]int gi 0/0/2
[SW2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 2
[SW2-GigabitEthernet0/0/2]int gi 0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 2
[SW2-GigabitEthernet0/0/1]quit
[SW2]quit
save

SW3:
 

system-view
[Huawei]sysname SW3
[SW3]int gi 0/0/3
[SW3-GigabitEthernet0/0/3]port link-type access
[SW3-GigabitEthernet0/0/3]int gi 0/0/4
[SW3-GigabitEthernet0/0/4]port link-type access
[SW3-GigabitEthernet0/0/4] int gi 0/0/2
[SW3-GigabitEthernet0/0/2]port link-type trunk
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 2
[SW3-GigabitEthernet0/0/2] int gi 0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 2
[SW3-GigabitEthernet0/0/1]quit
[SW3]vlan 2
[SW3-vlan2]port gi 0/0/4
[SW3-vlan2]quit
[SW3]quit
save

SW4:
 

system-view
[Huawei]sysname SW4
[SW4]vlan 2
[SW4-vlan2]quit
[SW4]int gi 0/0/3
[SW4-GigabitEthernet0/0/3]port link-type access
[SW4-GigabitEthernet0/0/3]port default vlan 2
[SW4-GigabitEthernet0/0/3]int gi 0/0/4
[SW4-GigabitEthernet0/0/4]port link-type access
[SW4-GigabitEthernet0/0/4]int gi 0/0/2
[SW4-GigabitEthernet0/0/2]port link-type trunk
[SW4-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 2
[SW4-GigabitEthernet0/0/2]quit
[SW4]quit
save

此时全网可达。