常见以太网接口操作

配置端口组

配置临时端口组

# 配置接口GE1/0/9至GE1/0/15加入到临时端口组(使用port-group group-member命令)。

<HUAWEI> system-view
[HUAWEI] port-group group-member gigabitethernet 1/0/9 to gigabitethernet 1/0/15
[HUAWEI-port-group] 

# 配置接口GE1/0/16至GE1/0/20加入到临时端口组(使用interface range命令,此命令仅V200R003C00及后续版本支持)。

<HUAWEI> system-view
[HUAWEI] interface range gigabitethernet 1/0/16 to gigabitethernet 1/0/20
[HUAWEI-port-group] 

配置永久端口组

# 配置接口GE1/0/1至GE1/0/8加入到永久端口组portgroup1(使用port-group命令)。

<HUAWEI> system-view
[HUAWEI] port-group portgroup1
[HUAWEI-port-group-portgroup1] group-member gigabitethernet 1/0/1 to gigabitethernet 1/0/8

配置端口隔离

配置端口隔离组

# 配置接口GE1/0/1和GE1/0/2的端口隔离功能,实现两个接口之间的二层数据隔离,三层数据互通。

<HUAWEI> system-view
[HUAWEI] port-isolate mode l2
[HUAWEI] interface gigabitethernet 1/0/1
[HUAWEI-GigabitEthernet1/0/1] port-isolate enable group 1
[HUAWEI-GigabitEthernet1/0/1] quit
[HUAWEI] interface gigabitethernet 1/0/2
[HUAWEI-GigabitEthernet1/0/2] port-isolate enable group 1
[HUAWEI-GigabitEthernet1/0/2] quit

# 配置接口GE1/0/10至GE1/0/20的端口隔离功能,实现多个接口之间的二三层数据均隔离。

<HUAWEI> system-view
[HUAWEI] port-isolate mode all
[HUAWEI] port-group portgroup1
[HUAWEI-port-group-portgroup1] group-member gigabitethernet 1/0/10 to gigabitethernet 1/0/20
[HUAWEI-port-group-portgroup1] port-isolate enable group 2

配置单向隔离

# 配置接口GE1/0/5与GE1/0/6、GE1/0/7、GE1/0/8的单向隔离功能,实现GE1/0/5接口发送的二层数据报文无法到达接口GE1/0/6、GE1/0/7、GE1/0/8。

<HUAWEI> system-view
[HUAWEI] port-isolate mode l2
[HUAWEI] interface gigabitethernet 1/0/5
[HUAWEI-GigabitEthernet1/0/5] am isolate gigabitethernet 1/0/6 to 1/0/8

配置Combo接口工作模式

Combo接口视图下执行命令combo-port { auto | copper | fiber },配置Combo接口工作模式。

# 配置接口GE0/0/1工作模式为电口模式。

<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] combo-port copper
  • 指定Combo接口工作模式为auto,即自动选择模式时,系统将检测Combo光口是否有光模块插入,并根据如下情况进行模式选择:
    • Combo电口没有连接网线,当Combo光口插上光模块时,则Combo接口选择光口模式。
    • Combo电口已经连接网线,且Combo接口处于Up状态,此时即使Combo光口插上光模块,Combo接口仍选择为电口模式。但是设备重启后,Combo接口工作模式将变为光口模式。
    • Combo电口已经连接网线,且Combo接口处于Down状态,此时Combo光口插上光模块时,Combo接口将选择光口模式。

    综上所述,Combo接口工作模式为自动选择模式时,只要Combo光口已插上光模块,则设备重启后,Combo接口都将选择光口模式。

  • 强制指定Combo接口的工作模式时,需要根据本端与对端设备连接的接口类型进行配置。如果本端Combo电口与对端电口相连,则需要强制指定Combo接口的工作模式为copper;如果本端Combo光口与对端光口相连,则需要强制指定Combo接口的工作模式为fiber

  • 配置接口速率

    自协商模式下,手动配置接口速率

    # 配置以太网接口GE0/0/1在自协商模式下协商速率为100Mbit/s。

    <HUAWEI> system-view
    [HUAWEI] interface gigabitethernet 0/0/1
    [HUAWEI-GigabitEthernet0/0/1] negotiation auto
    [HUAWEI-GigabitEthernet0/0/1] auto speed 100
    

    GE光接口不支持在自协商模式下手动配置接口速率,插入GE光电模块的GE光接口除外。

    非自协商模式下,配置接口速率

    # 配置以太网接口GE0/0/1在非自协商模式下协商速率为100Mbit/s。

    <HUAWEI> system-view
    [HUAWEI] interface gigabitethernet 0/0/1
    [HUAWEI-GigabitEthernet0/0/1] undo negotiation auto
    [HUAWEI-GigabitEthernet0/0/1] speed 100
    
  • 配置双工模式

    自协商模式下,手动配置双工模式

    # 配置以太网电接口GE0/0/1在自协商模式下双工模式为全双工模式。

    <HUAWEI> system-view
    [HUAWEI] interface gigabitethernet 0/0/1
    [HUAWEI-GigabitEthernet0/0/1] negotiation auto
    [HUAWEI-GigabitEthernet0/0/1] auto duplex full
    

    非自协商模式下,配置双工模式

    # 配置以太网电接口GE0/0/1在非自协商模式下的双工模式为半双工模式。

    <HUAWEI> system-view
    [HUAWEI] interface gigabitethernet 0/0/1
    [HUAWEI-GigabitEthernet0/0/1] undo negotiation auto
    [HUAWEI-GigabitEthernet0/0/1] duplex half
    
  • 配置接口切换到三层模式

    接口视图下执行命令undo portswitch,配置接口切换到三层模式。

    # 将接口GE0/0/1切换为三层模式。

    <HUAWEI> system-view
    [HUAWEI] interface gigabitethernet 0/0/1
    [HUAWEI-GigabitEthernet0/0/1] undo portswitch
    [HUAWEI-GigabitEthernet0/0/1] ip address 10.10.10.10 255.255.255.0 

    缺省情况下,以太网接口处于二层模式。

    使用该命令进行接口的二三层模式切换时,接口下只能存在属性配置信息(例如shutdowndescription配置),模式切换功能才可以生效。如果已经有业务配置存在时(例如port link-type trunk配置),需要先将该接口下的业务配置全部清除再执行该命令。

  • 一键清除接口下的配置

    # 在系统视图下执行命令clear configuration interface清除GE0/0/1接口下的配置。

    <HUAWEI> system-view
    [HUAWEI] clear configuration interface gigabitethernet 0/0/1
    Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y
    Info: Total 5 command(s) executed, 5 successful, 0 failed. 

    # 在接口视图下执行命令clear configuration this清除GE0/0/1接口下的配置。

    <HUAWEI> system-view
    [HUAWEI] interface gigabitethernet 0/0/1
    [HUAWEI-GigabitEthernet0/0/1] clear configuration this
    Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y
    Info: Total 3 command(s) executed, 3 successful, 0 failed.
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

小禹先生

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

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

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

打赏作者

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

抵扣说明:

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

余额充值