如何在 Ubuntu 12.04 中设置 dns 搜索域?

Art*_*ldt 7 networking ubuntu ubuntu-12.04

/etc/resolv.conf是从 的内容动态生成的/etc/network/interfaces,在我的系统上,它包含如下一行:

dns-servers 8.8.8.8
Run Code Online (Sandbox Code Playgroud)

如何在此配置中包含默认搜索域?如果重要的话,我正在运行纯 Ubuntu 服务器配置,没有安装 X 服务器。

Zor*_*che 12

由于您似乎在使用 resolvconf,因此您需要使用dns-search网络接口文件中的选项

#/etc/network/interfaces 
# The primary network interface
auto eth0
iface eth0 inet static
    address 10.2.37.4
    netmask 255.255.254.0
    gateway 10.2.37.1
    dns-nameservers 10.2.51.4 10.2.52.4
    dns-search example.org
Run Code Online (Sandbox Code Playgroud)