目录

记一些环境错误的修复

kali添加环境变量

golang安装工具后无法执行,需添加环境变量

1
2
3
4
vim /etc/profile
export PATH=/root/go/bin:$PATH

source /etc/profile

但重启终端后依然无效,还需在/root/.zshrc添加

1
2
3
4
vim /root/.zshrc
export PATH=/root/go/bin:$PATH

source /root/.zshrc

ubuntu解决libc.so.6报错

ubuntu经常遇到libc.so.6报错: /XXXXX: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.32' not found (required by./XXXXX)

试了众多方法,终于找到一个有效的:

1
2
3
4
5
6
7
8
9
编辑更新源:
vim /etc/apt/sources.list

添加
deb [http://th.archive.ubuntu.com/ubuntu](http://th.archive.ubuntu.com/ubuntu) jammy main

执行
apt-get update
apt-get install libc6

ubuntu系统上systemd-resolved不使用127.0.0.53的方法

自建DNSlog总遇到53端口被占用,试了百度的几个方法也是治标不治本,甚至会影响服务器更新,试了下面的方法比较有效,也不影响服务器更新。 方法源于:https://dyrnq.com/ubuntu-update-etc-resolve-conf/

有些文章说用关闭(删除)systemd-resolved ,而使用 resolvconf 、openresolv、Unbound 替换,测试发现在ubuntu 20.04.2 LTS NetworkManager已经被 systemd-networkd 取代,复杂度(依赖关系)较高。所以研究依然保持使用systemd-resolved而不使用127.0.0.53的配置思路。

后来发现systemd-resolved会产出两个运行配置,如下:

1
2
/run/systemd/resolve/resolv.conf
/run/systemd/resolve/stub-resolv.conf

默认/etc/resolv.conf 软链接到/run/systemd/resolve/stub-resolv.conf,那么只需将/etc/resolv.conf 软链接到/run/systemd/resolve/resolv.conf

而/run/systemd/resolve/* 生成的配置文件是由/etc/systemd/resolved.conf 决定,于是就写了下边的配置脚本,放到服务器上一执行,确实已经不是指向127.0.0.53了。

1
2
3
4
5
6
7
8
mkdir -p /etc/systemd/resolved.conf.d/
cat >/etc/systemd/resolved.conf.d/99-dns.conf << EOF
[Resolve]
DNS=114.114.114.114 8.8.8.8
EOF
ln -s -f /run/systemd/resolve/resolv.conf /etc/resolv.conf
systemctl daemon-reload && systemctl restart systemd-resolved.service && systemctl status -l systemd-resolved.service --no-pager
cat /etc/resolv.conf

主要参考了这篇

下文是讲解了为啥systemd-resolved要搞127.0.0.53:53

How and why (not) to use the 127.0.0.53 nameserver, systemd-resolved and resolvctl Or what is systemd-resolved and how it is integrated on Ubuntu

既然不用127.0.0.53了,那么我们能直接关闭127.0.0.53:53吗?

1
2
3
4
5
6
mkdir -p /etc/systemd/resolved.conf.d/
cat >/etc/systemd/resolved.conf.d/98-disable-127-53.conf << EOF
[Resolve]
DNSStubListener=no
EOF
systemctl daemon-reload && systemctl restart systemd-resolved.service && systemctl status -l systemd-resolved.service --no-pager

执行后再ss -tunlp 查看53端口,127.0.0.53:53监听已经没了。