Dns “这是什么东西?”_网关“;以CentOS/RHEL为单位的变量?

Dns “这是什么东西?”_网关“;以CentOS/RHEL为单位的变量?,dns,centos,rhel,centos8,rhel8,Dns,Centos,Rhel,Centos8,Rhel8,我已经知道CentOS/RHEL中的“_gateway”变量(我认为在7之前它只是“gateway”,没有_符号)。今天我在家里的实验室里安装了AdGuard DNS服务器,在同一台机器上有一个反向代理来提供一些内部服务,我在主机上添加了第二个IP,因为我需要多个HTTP端口。没关系,我在adguard上设置了一个通配符DNS条目。如下:*.mydomain.com 172.16.20.60(这是上面提到的反向代理的IP)-我不想手动添加所有服务,所以我选择了通配符方法 几个小时后,我注意到承载

我已经知道CentOS/RHEL中的“_gateway”变量(我认为在7之前它只是“gateway”,没有_符号)。今天我在家里的实验室里安装了AdGuard DNS服务器,在同一台机器上有一个反向代理来提供一些内部服务,我在主机上添加了第二个IP,因为我需要多个HTTP端口。没关系,我在adguard上设置了一个通配符DNS条目。如下:*.mydomain.com 172.16.20.60(这是上面提到的反向代理的IP)-我不想手动添加所有服务,所以我选择了通配符方法

几个小时后,我注意到承载dns服务器和反向代理的机器无法连接到internet

我做了一个跟踪路由,看到它正试图通过_gateway.mydomain.com(这会导致机器本身)访问互联网

在_gateway.mydomain.com上的ping返回了机器IP,因此我记住了dns服务器上的通配符dns条目。我在它的正确IP中添加了_gateway.mydomain.com,然后它按预期工作

我的问题是,这种环境变量“\u gateway”/“gateway”是什么意思?RedHat为什么这样做?我想知道为什么网络试图通过dns名称到达它的网关? 我找不到有关此操作的任何信息,也没有在机器上找到任何设置来禁用此行为

以下是一些输出:

ping _gateway
PING _gateway.mydomain.com (172.16.20.10) 56(84) bytes of data.
64 bytes from _gateway (172.16.20.10): icmp_seq=1 ttl=64 time=0.112 ms
64 bytes from _gateway (172.16.20.10): icmp_seq=2 ttl=64 time=0.285 ms
64 bytes from _gateway (172.16.20.10): icmp_seq=3 ttl=64 time=0.190 ms
64 bytes from _gateway (172.16.20.10): icmp_seq=4 ttl=64 time=0.284 ms
有什么想法吗

谢谢


因为似乎没有人知道我的意思,我自己澄清了这一点。 我在Ubuntu上看到了同样的事情,这让我得出结论,它可能与systemd有关。。。是的,宾果

其中说,

The hostname "_gateway" is resolved to all current default routing gateway addresses, ordered by their metric. This assigns a stable hostname to the current gateway, useful for referencing it independently of the current network configuration state.
我没有做更多的调查来禁用这个行为,不管怎样我知道它是从哪里来的,谢谢你

The hostname "_gateway" is resolved to all current default routing gateway addresses, ordered by their metric. This assigns a stable hostname to the current gateway, useful for referencing it independently of the current network configuration state.