[CONTENT] System local ports batch occupation

Content One: Occupy system local ports manually

# startport=33000;endport=34000;for i in $(seq $startport $endport);do nc -lk $i &;done

(Add: Take start port is 33000 and end port is 34000 as an example here)

Content Two: Release all ports which are opened manually (kill all nc command processes)

# for i in $(ps -aux | grep nc | grep '\-lk' | awk '{print $2}');do kill $i; done

[排错] SLES 12 运行 yast lan 命令时,报错 “Details: Augeas parsing/serializing error: Iterated lens matched less than it should at /usr/share/augeas/lenses/dist/hosts.aug:23.12-.42:”

报错代码

Details: Augeas parsing/serializing error: Iterated lens matched less than it should at /usr/share/augeas/lenses/dist/hosts.aug:23.12-.42:

分析

/etc/hosts 文件中最后 1 行没有以 “\n” 结尾

解决方法

# echo >> /etc/hosts

参考文献

https://www.suse.com/zh-cn/support/kb/doc/?id=000019057

[内容] /etc/resolv.conf 配置文件的 search 选项

内容一:测试 search 选项的配置

# cat /etc/resolv.conf
search eternalcenter.com local new
nameserver 8.8.8.8

内容二:测试 search 选项

2.1 查询 zhumingyu

# host -a zhumingyu
Trying "zhumingyu.eternalcenter.com"
Trying "zhumingyu.local"
Trying "zhumingyu.new"
Trying "zhumingyu"
Host zhumingyu not found: 3(NXDOMAIN)
Received 102 bytes from 8.8.8.8#53 in 62 ms

(补充:当查询 zhumingyu 时,也就是中间没有点 “.”,则默认会被视为查询主机名,会先依次把 eternalcenter.com、local 和 new 作为后缀添加到 zhumingyu 后进行查询,最后才查询 zhumingyu)

2.2 zhumingyu.com

# host -a zhumingyu.com
Trying "zhumingyu.com"
Received 31 bytes from 1.1.1.1#53 in 217 ms
Trying "zhumingyu.com.eternalcenter.com"
Trying "zhumingyu.com.local"
Trying "zhumingyu.com.new"
Host zhumingyu.com.new not found: 4(NOTIMP)
Received 35 bytes from 1.1.1.1#53 in 218 ms

(补充:当查询 zhumingyu.com 时,也就是中间有 1 个点 “.”,则默认会被视为查询域名,会先查询 mingyuzhu.com,如果查询失败,则会先依次把 eternalcenter.com、local 和 new 作为后缀添加到 zhumingyu 后进行查询)

2.3 查询 zhumingyu.com.

# host -a zhumingyu.com.
Trying "zhumingyu.com"
Host zhumingyu.com not found: 4(NOTIMP)
Received 31 bytes from 1.1.1.1#53 in 204 ms
Received 31 bytes from 1.1.1.1#53 in 204 ms

(补充:当查询 zhumingyu.com. 时,也就是末尾有 1 个点 “.”,默认会被视为查询域名,且只会查询这个域名。不会查询 search 里的每 1 项)

[步骤] Wake On Lan (WOL) 功能的开启 ( Rocky Linux & RHEL 版)

步骤一:在 BIOS 开启 Wake On Lan (WOL) 功能

(步骤略)

步骤二:在系统开启 Wake On Lan (WOL) 功能

2.1 确保 net-tools 已经安装

# yum install net-tools

2.2 查看网卡的 Wake On Lan (WOL) 功能状态

2.2.1 Wake On Lan (WOL) 功能状态列表

1) p, Wake on PHY activity
2) u, Wake on unicast messages
3) m, Wake on multicast messages
4) b, Wake on broadcast messages
5) a, Wake on ARP
6) g, Wake on MagicPacket™
7) s, Enable SecureOn™ password for MagicPacket™
8) d, Disable (wake on nothing). This option clears all previous options

2.2.2 查看网卡的 Wake On Lan (WOL) 功能状态
# ethtool enp16s0
Settings for enp16s0:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: Twisted Pair
	PHYAD: 1
	Transceiver: internal
	MDI-X: off (auto)
	Supports Wake-on: pumbg
	Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
	Link detected: yes


补充:
1) 这里以使用 enp16s0 网卡开启 Wake On Lan (WOL) 功能为例
2) 这里的 Wake On Lan (WOL) 功能状态是 g

2.3 临时开启 Wake On Lan (WOL) 功能

# ethtool -s enp16s0 wol p

(补充:这里以给 enp16s0 网卡开启 Wake On Lan (WOL) 功能为例)

2.4 永久开启 Wake On Lan (WOL) 功能

# vi /etc/sysconfig/network-scripts/ifcfg-enp16s0

添加以下内容:

......
ETHTOOL_OPTS="-s ${DEVICE} wol p"

(补充:这里以给 enp16s0 网卡开启 Wake On Lan (WOL) 功能为例)