[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 项)