我有一台运行 CentOS Stream 9 的计算机作为服务器。它通过有线方式直接连接到我的路由器。它运行良好,只是出现“名称或服务未知”频繁地(一次大概 10 分钟)
这是我的设置:
# cat /etc/NetworkManager/system-connections/enp4s0.nmconnection
[connection]
id=enp4s0
uuid=(UUID here)
type=ethernet
interface-name=enp4s0
timestamp=1712230701
[ethernet]
[ipv4]
address1=192.168.2.120/24,192.168.2.1
dns=192.168.2.1;114.114.114.114;8.8.8.8;
method=manual
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.2.1
nameserver 114.114.114.114
nameserver 8.8.8.8
# cat /etc/nsswitch.conf | grep 'hosts'
# hosts: files dns
# hosts: files dns # from user file
# Valid databases are: aliases, ethers, group, gshadow, hosts,
hosts: files dns myhostname
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 58:11:22:bd:ae:31 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.120/24 brd 192.168.2.255 scope global noprefixroute enp4s0
valid_lft forever preferred_lft forever
inet6 fe80::5a11:22ff:febd:ae31/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlo1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether f4:26:79:f6:9d:43 brd ff:ff:ff:ff:ff:ff
altname wlp0s20f3
如果我192.168.2.1
从中删除dns
,外部网络将无法访问。