H3C – 嗨软 https://ihacksoft.com/archive 分享最好用的常用软件 Tue, 22 Nov 2022 02:41:09 +0000 zh-CN hourly 1 https://wordpress.org/?v=4.9.26 H3C 交换机查看所有端口状态的命令 https://ihacksoft.com/archive/584.html https://ihacksoft.com/archive/584.html#respond Sun, 21 Apr 2019 15:59:40 +0000 https://ihacksoft.com/?p=1313   想看一下8楼交换机所有端口的状态,因为有两台嘛,不确定是哪台,一台插得网口多,一台插得少。交换机是H3C的,以前在思科的交换机上有个很好用的命令:show ip in br ,H3C应该是 dis ip in br,发现不行,就只出现了VLAN信息,没有端口信息。

  原来H3C下应该是 dis in br,但显示出来的也不对啊!后来发现是后面的“br”不对,这个应该补全为:brief,不然它是:Bridge-Aggregation,所以不对嘛!执行效果如下:

dis interface brief
The brief information of interface(s) under route mode:
Link: ADM – administratively down; Stby – standby
Protocol: (s) – spoofing
Interface Link Protocol Main IP Description
M-GE0/0/0 DOWN DOWN –
NULL0 UP UP(s) –
Vlan1 DOWN DOWN –
Vlan2000 UP UP 172.16.1.45

The brief information of interface(s) under bridge mode:
Link: ADM – administratively down; Stby – standby
Speed or Duplex: (a)/A – auto; H – half; F – full
Type: A – access; T – trunk; H – hybrid
Interface Link Speed Duplex Type PVID Description
BAGG6 DOWN auto A T 1
GE1/0/1 DOWN auto A A 801
GE1/0/2 UP 1G(a) F(a) A 801
GE1/0/3 UP 1G(a) F(a) A 801
GE1/0/4 DOWN auto A A 801
GE1/0/5 UP 100M(a) F(a) A 801
GE1/0/6 UP 10M(a) F(a) A 801
GE1/0/7 DOWN auto A A 801
GE1/0/8 DOWN auto A A 801
GE1/0/9 DOWN auto A A 801
GE1/0/10 DOWN auto A A 801
GE1/0/11 DOWN auto A A 801
GE1/0/12 DOWN auto A A 801
GE1/0/13 DOWN auto A A 801
GE1/0/14 DOWN auto A A 801
GE1/0/15 UP 100M(a) F(a) A 801
GE1/0/16 UP 1G(a) F(a) A 801
GE1/0/17 UP 1G(a) F(a) A 801
GE1/0/18 DOWN auto A A 801
GE1/0/19 DOWN auto A A 801
GE1/0/20 DOWN auto A A 801

后来我发现还有个命令也可以查看所有的端口状态:dis port-security。显示如下:

dis port-security
Equipment port-security is disabled
Trap is disabled
AutoLearn aging time is 0 minutes
Disableport Timeout: 20s
OUI value:
GigabitEthernet1/0/1 is link-down
GigabitEthernet1/0/2 is link-up
GigabitEthernet1/0/3 is link-up
GigabitEthernet1/0/4 is link-down
GigabitEthernet1/0/5 is link-up
GigabitEthernet1/0/6 is link-up
GigabitEthernet1/0/7 is link-down
GigabitEthernet1/0/8 is link-down
GigabitEthernet1/0/9 is link-down
GigabitEthernet1/0/10 is link-down
GigabitEthernet1/0/11 is link-down
GigabitEthernet1/0/12 is link-down
GigabitEthernet1/0/13 is link-down
GigabitEthernet1/0/14 is link-down
GigabitEthernet1/0/15 is link-up
GigabitEthernet1/0/16 is link-up
GigabitEthernet1/0/17 is link-up
GigabitEthernet1/0/18 is link-down
GigabitEthernet1/0/19 is link-down
GigabitEthernet1/0/20 is link-down

以下为网络转载:

大家都知道交换机的端口都是比较多,当你想查看某些端口状态(是处于UP还是DOWN状态)时,通常我们会使用以下命令:

思科:show interface X

H3C:display interface X

注:X表代端口号,如e1/0/1之类的。

但如果当交换机的端口非常多时,而且你想知道所有端口的状态时,你再一条一条命令输进去,那是相当累人的,同时输出的结果也过于详细,看得人眼花缭乱。

如何有效的查看所有端口的状态呢?我们可以使用以下命令:

思科:show ip interface brief

H3C:display interface brief

华为的交换机好像没有什么命令能实现这种功能。

]]>
https://ihacksoft.com/archive/584.html/feed 0
谈谈 H3C 的端口 MAC 地址粘性(sticky)绑定 https://ihacksoft.com/archive/583.html https://ihacksoft.com/archive/583.html#respond Sun, 21 Apr 2019 15:56:59 +0000 https://ihacksoft.com/?p=1312   思科 Cisco 交换机有个端口绑定的功能非常好用,那就是 sticky 粘性绑定(也有叫端口粘滞的)。简单讲,它就是把第一次从该端口学习到的MAC记录下来并做绑定,当另一台电脑接到这个端口上时,将不被允许通过。思科的端口配置具体如下:
2950 (config)#int rang fa0/1 – 48
2950 (config-if-range)#switchport mode Access
2950 (config-if-range)#switchport port-security
2950 (config-if-range)#switchport port-security mac-address violation restrict
2950 (config-if-range)#switchport port-security mac-address sticky

现在单位里用的是 H3C,也想进行粘性绑定,如何操作?在 H3C 论坛上搜到如下这么一段:
system-view
启动端口安全功能
port-security enable
配置端口允许接入的最大MAC地址数
interface ethernet0/1
port-security max-mac-count 1
配置端口的安全模式为autolearn
port-security port-mode autolearn
配置Secure MAC地址
mac-address security mac-address vlan vlan-id

没错,H3C没有像 Cisco 那样的 sticky 命令,但这一段其实就是类似于思科的那个功能。进入端口之后只需要键入:
port-security max-mac-count 1
port-security port-mode autolearn
这两条命令,最后一条绑定信息是自动产生的,那个MAC地址就是我电脑的MAC地址,已正确学习到并绑定了。
interface GigabitEthernet1/0/47
port link-mode bridge
port access vlan 1301
port-security max-mac-count 2
port-security port-mode autolearn
port-security mac-address security sticky 6c0b-8443-abd6 vlan 1301

然后解除绑定的时候要这样解(注意顺序):
[WIDF_13F_2-GigabitEthernet1/0/47]undo port-security port-mode
[WIDF_13F_2-GigabitEthernet1/0/47]undo port-security max-mac-count

]]>
https://ihacksoft.com/archive/583.html/feed 0
H3C 批量解绑 IP 地址绑定 https://ihacksoft.com/archive/581.html https://ihacksoft.com/archive/581.html#respond Sun, 21 Apr 2019 15:50:47 +0000 https://ihacksoft.com/?p=1310   单位的H3C交换机端口绑定是如下这样的,其实就是绑定了IP地址嘛,MAC是没有绑的。ip verify source ip-address mac-address 这句话挺有意思的,它的英文意思就是验证源IP和MAC地址,意思就是:绑定IP和MAC!然而,因为上面 ip source binding ip-address 10.19.77.29 这一句它只是绑定了IP,所以整个端口的功能只是绑定IP地址,而没有绑定MAC。如果上面有绑定MAC的语句,那么IP和MAC全绑上了。此外,ip verify source ip-address mac-address 还可以写成 ip verify source ip-address 或 ip verify source mac-address,分别代表只绑IP或MAC。

interface GigabitEthernet1/0/28
port link-mode bridge
port access vlan 1301
ip source binding ip-address 10.19.77.29
ip verify source ip-address mac-address
#
interface GigabitEthernet1/0/29
port link-mode bridge
port access vlan 1301
ip source binding ip-address 10.19.77.30
ip verify source ip-address mac-address
#
interface GigabitEthernet1/0/30
port link-mode bridge
port access vlan 1301
ip source binding ip-address 10.19.77.75
ip verify source ip-address mac-address
#
interface GigabitEthernet1/0/31
port link-mode bridge
port access vlan 1301
ip source binding ip-address 10.19.77.76
ip verify source ip-address mac-address
#

好了,现在单位要搬办公室了,得先把全部的绑定信息解除掉。一条一条解?其实不用的。刚才上面说了,真正起作用进行“绑”操作的命令是:
ip verify source ip-address mac-address

把这一条删除就可以了。进入端口组:
interface range GigabitEthernet1/0/1 to GigabitEthernet1/0/46

然后执行:
undo ip verify source ip-address mac-address

这样就全部搞定了。

]]>
https://ihacksoft.com/archive/581.html/feed 0