配置不同VLAN间通过VLANif接口互通

话不多说开始配置

The device is running!


system-view #进入配置视图

Enter system view, return user view with Ctrl+Z.


[Huawei]vlan batch 2 3#创建VLAN2和3

Info: This operation may take a few seconds. Please wait for a moment...done.

[Huawei]interface GigabitEthernet 0/0/1#进入交换机G0/0/1端口


[Huawei-GigabitEthernet0/0/1]port link-type access #选择接口为access模式


[Huawei-GigabitEthernet0/0/1]port default vlan 2#选择通过VLAN2

[Huawei-GigabitEthernet0/0/1]qu#退出接口配置

[Huawei]interface GigabitEthernet 0/0/2#同理为接口二配置access模式

[Huawei-GigabitEthernet0/0/2]port link-type access


[Huawei-GigabitEthernet0/0/2]port default vlan 3

[Huawei-GigabitEthernet0/0/2]qu

[Huawei]interface Vlanif 2#进入VLANif2

[Huawei-Vlanif2]ip address 192.168.1.1 24#配置其IP地址

[Huawei-Vlanif2]qu


[Huawei]interface Vlanif 3#同理为VLANif3配置其ip地址

[Huawei-Vlanif3]ip address 192.168.2.1 24

[Huawei-Vlanif3]qu

[Huawei]

dispaly vlan#查看一下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/3(D) 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)

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

3 common UT:GE0/0/2(U)

VID Status Property MAC-LRN Statistics Description

--------------------------------------------------------------------------------

1 enable default enable disable VLAN 0001

2 enable default enable disable VLAN 0002

3 enable default enable disable VLAN 0003

#使用dispaly命令查看一下VLAN是否配置好。

接下来就需要配置两台主机的IP地址如下图,掩码,和网关。注意网关一点要填写,网关即为我们刚配置的VLANif的ip地址,通过什么VLAN即填对应的VLANif IP地址号码。

PC>ping 192.168.1.2

Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break

From 192.168.1.2: bytes=32 seq=1 ttl=127 time=62 ms

From 192.168.1.2: bytes=32 seq=2 ttl=127 time=46 ms

From 192.168.1.2: bytes=32 seq=3 ttl=127 time=31 ms

From 192.168.1.2: bytes=32 seq=4 ttl=127 time=47 ms

From 192.168.1.2: bytes=32 seq=5 ttl=127 time=46 ms

--- 192.168.1.2 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 31/46/62 ms

PC>

以上是我使用主机ip地址为192.168.2.2的主机ping 主机号为192.168.1.2的主机,可以ping通,即配置成功。

谢谢学习。

发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章