English 中文(简体)
主机: /etc/ resolv. conf 分析失败
原标题:host: parse of /etc/resolv.conf failed

我犯了一个错误,我看不到会发生什么, 请看看你能不能抓住什么错了。

每当我使用“主机”命令, 我就会得到这个错误 :

xavi@cobalto:~$ host www.guparty.com
host: parse of /etc/resolv.conf failed

我认为语法是正确的:

xavi@cobalto:~$ cat /etc/resolv.conf
search dsitelecom.com
nameserver 8.8.8.8 8.8.4.4

也允许每个人阅读许可:

xavi@cobalto:~$ ls -l /etc/resolv.conf
-rw-r--r-- 1 root root 49 2011-10-30 12:02 /etc/resolv.conf

可能这是件傻事 但我搞不懂,你看到哪里有问题吗?

谢谢!

最佳回答

检查您的语法, 您需要在 / etc/ resolv. conf 中定义每行一个名称服务器

search dsitelecom.com
nameserver 8.8.8.8 
nameserver 8.8.4.4
问题回答

I saw the same error when by mistake *nix EOLs (" ") were replaced with windows ones (" "). Solution: dos2unix filename

我也有类似的问题,但这样做并开始工作:

# mv resolv.conf resolv.conf.old
# cat resolv.conf.old
search example.com
domain example.com
nameserver 11.22.33.44
nameserver 2000::1
# echo "search example.com" >>resolv.conf
# echo "domain example.com" >>resolv.conf
# echo "nameserver 11.22.33.44" >>resolv.conf
# echo "nameserver 2000::1" >>resolv.conf

地址只是示例, 但结果正在起作用 。 为什么复制 resolv. conf 需要复制原件。 然后当打印出来时, 您不必记住 resolv. conf 中的所有内容。 当您用回声制作文件时, 您可以确定没有多余的字符会制造麻烦 。 所以将所有命名服务器的行都回传到那里 。

我在 WSL 2 中经历了这个问题,但我的resolv.conf 绝对是正确的格式。 我甚至用它来确认线尾是否正确。 以下的修改如下:

  1. 使用 ipconfig.exe 查找带有窗口电壳的命名服务器

  2. 使用 sudo Nami/etc/wsl.conf 添加 :

[network]                                                                        
generateResolvConf = false
  1. 使用 wsl --shutdown 重新启动 wsl (窗口动力壳)

  2. 打开 WSL 并获取 /etc/resolv.conf 的备份。 然后通过 rm -f/etc/resolv.conf 将其删除

  3. 添加新文件 sudo Nami/etc/resolv.conf , 包括:

nameserver X.X.X.X
  1. 使用 wsl --shutdown 重新启动 wsl (窗口动力壳)

  2. 使用 wget google.com 打开 WSL 并删除, 测试一些您的公司域 。

调制自

我遇到同样的问题:

$ nslookup
nslookup: parse of /etc/resolv.conf failed

但在我的案例中,问题在于 档案的许可是:

-rw------- 1 root root 93 Apr 22 20:22 /etc/resolv.conf

为了修补它,我要做的就是:

sudo chmod 644/etc/resolv.conf

问题就解决了





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...