单臂路由

目录

​ 

思科

路由器配置

交换机配置

H3C

交换机配置

路由器配置

Huawei

路由器配置

交换机配置


      Access 类型的端口:只能属于1 个VLAN,一般用于连接计算机的端口;

      Trunk 类型的端口:可以允许多个VLAN 通过,可以接收和发送多个VLAN 的报文,一般用于交换机之间连接的端口


思科

路由器配置

Router>enable 
Router#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#interface fastEthernet 0/0.1        ###配置子端口
Router(config-subif)#encapsulation dot1Q 60        ###封装dot1Q协议和vlan号
Router(config-subif)#ip address 192.168.60.1 255.255.255.0    ####配置VLAN IP地址
Router(config-subif)#no shutdown 
Router(config-subif)#exit 

Router(config)#interface fastEthernet 0/0.2
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 10.10.10.1 255.255.255.0
Router(config-subif)#no shutdown 

Router(config)#interface f0/0               ###打开连接交换机端口
Router(config-if)#no shutdown

交换机配置

三层交换机F0/1必须先封装dot1q协议,再设置端口trunk

Switch(config-if)#switchport trunk encapsulation dot1q

Switch(config-if)#switchport mode trunk

Switch>enable 
Switch#vlan database             ###配置vlan
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vlan 60 name dev    ###配置vlan号和名字
VLAN 60 modified:
    Name: dev
Switch(vlan)#vlan 10 name opt
VLAN 10 added:
    Name: opt
Switch(vlan)#exit 
APPLY completed.
Exiting....
Switch#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#interface fastEthernet 0/1        ###打开连接路由器的端口
Switch(config-if)#no shutdown 
Switch(config-if)#switchport mode trunk          ###端口设置trunk模式

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up


Switch(config-if)#interface fastEthernet 0/2    ###打开PC端口
Switch(config-if)#switchport mode access         ###端口设置access模式
Switch(config-if)#switchport access vlan 60     ###配置vlan号
Switch(config-if)#no shutdown 

Switch(config-if)#interface f0/3
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 10
Switch(config-if)#no shutdown 


H3C

交换机配置

<H3C>system-view
System View: return to User View with Ctrl+Z.
[H3C]vlan 10                                    ###创建VLAN
[H3C-vlan10]port GigabitEthernet 1/0/2           ####划分端口进vlan
[H3C-vlan10]q

[H3C]vlan 20
[H3C-vlan20]port GigabitEthernet 1/0/3
[H3C-vlan20]q
[H3C]display vlan brief
Brief information about all VLANs:
Supported Minimum VLAN ID: 1
Supported Maximum VLAN ID: 4094
Default VLAN ID: 1
VLAN ID   Name                             Port
1         VLAN 0001                        FGE1/0/53  FGE1/0/54  GE1/0/1
                                           GE1/0/4  GE1/0/5  GE1/0/6  GE1/0/7
                                           GE1/0/8  GE1/0/9  GE1/0/10
                                           GE1/0/11  GE1/0/12  GE1/0/13
                                           GE1/0/14  GE1/0/15  GE1/0/16
                                           GE1/0/17  GE1/0/18  GE1/0/19
                                           GE1/0/20  GE1/0/21  GE1/0/22
                                           GE1/0/23  GE1/0/24  GE1/0/25
                                           GE1/0/26  GE1/0/27  GE1/0/28
                                           GE1/0/29  GE1/0/30  GE1/0/31
                                           GE1/0/32  GE1/0/33  GE1/0/34
                                           GE1/0/35  GE1/0/36  GE1/0/37
                                           GE1/0/38  GE1/0/39  GE1/0/40
                                           GE1/0/41  GE1/0/42  GE1/0/43
                                           GE1/0/44  GE1/0/45  GE1/0/46
                                           GE1/0/47  GE1/0/48  XGE1/0/49
                                           XGE1/0/50  XGE1/0/51  XGE1/0/52
10        VLAN 0010                        GE1/0/2
20        VLAN 0020                        GE1/0/3

[H3C]interface g1/0/1                ####连接路由器的端口
[H3C-GigabitEthernet1/0/1]port link-type trunk        ####设置为trunk模式
[H3C-GigabitEthernet1/0/1]port trunk permit vlan 10 20    ####放行对应vlan号
[H3C-GigabitEthernet1/0/1]display port trunk
Interface             PVID    VLAN Passing
GE1/0/1               1       1, 10, 20

路由器配置

<H3C>system-view
System View: return to User View with Ctrl+Z.
[H3C]interface g0/0.1                                    #####创建子接口
[H3C-GigabitEthernet0/0.1]vlan-type dot1q vid 10         #####封装dot1q协议和vlan号
[H3C-GigabitEthernet0/0.1]ip address 192.168.60.1 24     #####配置IP地址

[H3C-GigabitEthernet0/0.1]int g0/0.2
[H3C-GigabitEthernet0/0.2]vlan-type dot1q vid 20
[H3C-GigabitEthernet0/0.2]ip address 10.10.10.1 24

[H3C-GigabitEthernet0/0.2]dis int bri
Brief information on interfaces in route mode:
Link: ADM - administratively down; Stby - standby
Protocol: (s) - spoofing
Interface            Link Protocol Primary IP      Description
GE0/0                UP   UP       --
GE0/0.1              UP   UP       192.168.60.1
GE0/0.2              UP   UP       10.10.10.1
GE0/1                DOWN DOWN     --
GE0/2                DOWN DOWN     --
GE5/0                DOWN DOWN     --
GE5/1                DOWN DOWN     --
GE6/0                DOWN DOWN     --
GE6/1                DOWN DOWN     --
InLoop0              UP   UP(s)    --
NULL0                UP   UP(s)    --
REG0                 UP   --       --
Ser1/0               DOWN DOWN     --
Ser2/0               DOWN DOWN     --
Ser3/0               DOWN DOWN     --
Ser4/0               DOWN DOWN     --



Huawei

路由器配置

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]int e0/0/0.1                ####配置子接口
[Huawei-Ethernet0/0/0.1]vlan-type dot1q 10	        #####封装dot1q协议和vlan号
[Huawei-Ethernet0/0/0.1]ip address 192.168.60.1 24    #####配置IP地址
[Huawei-Ethernet0/0/0.1]arp broadcast enable        ####开启ARP广播
	
[Huawei-Ethernet0/0/0.1]int e0/0/0.2
[Huawei-Ethernet0/0/0.2]vlan-type dot1q 20
[Huawei-Ethernet0/0/0.2]ip a 10.10.10.1 24
[Huawei-Ethernet0/0/0.2]arp broadcast enable
	
[Huawei-Ethernet0/0/0.2]display interface brief 
PHY: Physical
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(d): Dampening Suppressed
InUti/OutUti: input utility/output utility
Interface                   PHY   Protocol InUti OutUti   inErrors  outErrors
Ethernet0/0/0               up    down        0%     0%          0          0
Ethernet0/0/0.1             up    up          0%     0%          0          0
Ethernet0/0/0.2             up    up          0%     0%          0          0
Ethernet0/0/1               down  down        0%     0%          0          0
GigabitEthernet0/0/0        down  down        0%     0%          0          0
GigabitEthernet0/0/1        down  down        0%     0%          0          0
GigabitEthernet0/0/2        down  down        0%     0%          0          0
GigabitEthernet0/0/3        down  down        0%     0%          0          0
NULL0                       up    up(s)       0%     0%          0          0
Serial0/0/0                 down  down        0%     0%          0          0
Serial0/0/1                 down  down        0%     0%          0          0
Serial0/0/2                 down  down        0%     0%          0          0
Serial0/0/3                 down  down        0%     0%          0          0
[Huawei-Ethernet0/0/0.2]

交换机配置

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 10 20                                ####创建vlan
Info: This operation may take a few seconds. Please wait for a moment...done.

[Huawei]int g0/0/1                              ####路由器端口
[Huawei-GigabitEthernet0/0/1]port link-type trunk         ####设置为trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20   ####放行相关vlan号

[Huawei-GigabitEthernet0/0/1]int g0/0/2                ####主机端口
[Huawei-GigabitEthernet0/0/2]port link-type access       ####设置为access      
[Huawei-GigabitEthernet0/0/2]port default vlan 10        ####配置端口默认vlan

[Huawei-GigabitEthernet0/0/2]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type access 
[Huawei-GigabitEthernet0/0/3]port default vlan 20
Jul 27 2021 17:28:02-08:00 Huawei 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, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/3]
Jul 27 2021 17:28:12-08:00 Huawei 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, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/3]

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

金牌收租佬

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值