路由器物理接口实现不同vlan之间的互相通信

【实验拓扑】

【PC配置】

【交换机配置】

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW1
[SW1]
Oct  8 2023 19:09:36-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]
Oct  8 2023 19:09:46-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 e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]
Oct  8 2023 19:11:16-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-Ethernet0/0/2]port default vlan 10
[SW1-Ethernet0/0/2]in
Oct  8 2023 19:11:36-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.t e0/0/3
[SW1-Ethernet0/0/3]port link-type vlan 20
                                  ^
Error: Unrecognized command found at '^' position.
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 2
Oct  8 2023 19:12:26-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.0
[SW1-Ethernet0/0/3]dis this
#
interface Ethernet0/0/3
 port link-type access
 port default vlan 20
#
return
[SW1-Ethernet0/0/3]
Oct  8 2023 19:12:36-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-Ethernet0/0/3]int e0/0/
Oct  8 2023 19:15:23-08:00 SW1 %%01PHY/1/PHY(l)[0]:    Ethernet0/0/4: change sta
tus to up
Oct  8 2023 19:15:51-08:00 SW1 %%01PHY/1/PHY(l)[1]:    Ethernet0/0/1: change sta
tus to down
Oct  8 2023 19:16:12-08:00 SW1 %%01PHY/1/PHY(l)[2]:    Ethernet0/0/1: change sta
tus to up User interface con0 is available



Please Press ENTER.

<SW1>sys
Enter system view, return user view with Ctrl+Z.
[SW1]int e0/0/4
[SW1-Ethernet0/0/4]p l-t	
[SW1-Ethernet0/0/4]p l t acc	
[SW1-Ethernet0/0/4]p l t acc	
[SW1-Ethernet0/0/4] User interface con0 is available



Please Press ENTER.

<SW1>sys
Enter system view, return user view with Ctrl+Z.
[SW1]int e0/0/4
[SW1-Ethernet0/0/4]dis this
#
interface Ethernet0/0/4
#
return
[SW1-Ethernet0/0/4]por li ac
[SW1-Ethernet0/0/4]dis this
#
interface Ethernet0/0/4
 port link-type access
#
return
[SW1-Ethernet0/0/4]
Oct  8 2023 19:47:17-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-Ethernet0/0/4]port default vlan 10
[SW1-Ethernet0/0/4]int 
Oct  8 2023 19:47:37-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.e0/0/4
[SW1-Ethernet0/0/4]int e0/0/1
[SW1-Ethernet0/0/1]po li ac
[SW1-Ethernet0/0/1]port default 
Oct  8 2023 19:49:07-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 12, the 
change loop count is 0, and the maximum number of records is 4095.vlan 20
[SW1-Ethernet0/0/1]
Oct  8 2023 19:49:11-08:00 SW1 %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif1 has 
turned into DOWN state.
[SW1-Ethernet0/0/1]
Oct  8 2023 19:49:17-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 13, the 
change loop count is 0, and the maximum number of records is 4095.
[SW1-Ethernet0/0/1]dis this
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 20
#
return
[SW1-Ethernet0/0/1]int e0/0/4
[SW1-Ethernet0/0/4]dis this
#
interface Ethernet0/0/4
 port link-type access
 port default vlan 10
#
return
[SW1-Ethernet0/0/4] User interface con0 is available

【路由器配置】

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]
[R1]int 0/0/1
        ^
Error: Wrong parameter found at '^' position.
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add
                                ^
Error:Incomplete command found at '^' position.
[R1-GigabitEthernet0/0/1]ip add 10.1.1.254 24
Oct  8 2023 19:52:05-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 20.1.1.254 24
Oct  8 2023 19:52:48-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]dis ip route
                                ^
Error: Unrecognized command found at '^' position.
[R1-GigabitEthernet0/0/0]q
[R1]
[R1]dis ip r	
[R1]dis ip rd-filter
[R1]dis ip-rou	
[R1]dis ip-roudis 
        ^
Error: Wrong parameter found at '^' position.
[R1]dis ip-route
        ^
Error: Wrong parameter found at '^' position.
[R1]dis ip route-table
           ^
Error: Unrecognized command found at '^' position.
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.1.1.0/24  Direct  0    0           D   10.1.1.254      GigabitEthernet
0/0/1
     10.1.1.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     10.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       20.1.1.0/24  Direct  0    0           D   20.1.1.254      GigabitEthernet
0/0/0
     20.1.1.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     20.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R1]

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

【连通性测试】

不同vlan的互通方式:

1.路由器物理接口

   ①路由器物理接口无法识别vlan tag,交换机和路由器互联接口用access

   ②缺点:需要路由器的接口比较多

2.路由器子接口

3.Switch Virtual Interface(SVI)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值