SUSE Linux 15 SP2 DNS setting
SUSE Linux Enterprise Server 15 SP2 DNS配置
1.NETCONFIG_DNS_STATIC_SEARCHLIST 用于主机名查找的 DNS 域名列表 2.NETCONFIG_DNS_STATIC_SERVERS 用于主机名查找的名称服务器 IP 地址列表 3.NETCONFIG_DNS_FORWARDER 需要配置的 DNS 转发器名称,例如 `bind` 或 `resolver` 4.NETCONFIG_DNS_RESOLVER_OPTIONS 将写入到 `/var/run/netconfig/resolv.conf` 的任意选项, 例如:debug attempts:1 timeout:10 5.NETCONFIG_DNS_RESOLVER_SORTLIST 最多包含 10 项的列表,例如:130.155.160.0/255.255.240.0 130.155.0.0 6.NETCONFIG_DNS_POLICY='' netconfig 禁用 DNS 配置
默认配置
# egrep -v '^#|^$' /etc/sysconfig/network/config AUTO6_WAIT_AT_BOOT="" AUTO6_UPDATE="" LINK_REQUIRED="auto" WICKED_DEBUG="" WICKED_LOG_LEVEL="" CHECK_DUPLICATE_IP="yes" SEND_GRATUITOUS_ARP="auto" DEBUG="no" WAIT_FOR_INTERFACES="30" FIREWALL="yes" NM_ONLINE_TIMEOUT="30" NETCONFIG_MODULES_ORDER="dns-resolver dns-bind dns-dnsmasq nis ntp-runtime" NETCONFIG_VERBOSE="no" NETCONFIG_FORCE_REPLACE="no" NETCONFIG_DNS_POLICY="auto" NETCONFIG_DNS_FORWARDER="resolver" NETCONFIG_DNS_FORWARDER_FALLBACK="yes" NETCONFIG_DNS_STATIC_SEARCHLIST="" NETCONFIG_DNS_STATIC_SERVERS="" NETCONFIG_DNS_RANKING="auto" NETCONFIG_DNS_RESOLVER_OPTIONS="" NETCONFIG_DNS_RESOLVER_SORTLIST="" NETCONFIG_NTP_POLICY="auto" NETCONFIG_NTP_STATIC_SERVERS="" NETCONFIG_NIS_POLICY="auto" NETCONFIG_NIS_SETDOMAINNAME="yes" NETCONFIG_NIS_STATIC_DOMAIN="" NETCONFIG_NIS_STATIC_SERVERS="" WIRELESS_REGULATORY_DOMAIN=''
推荐修改操作
# egrep -v '^#|^$' /etc/sysconfig/network/config AUTO6_WAIT_AT_BOOT="" AUTO6_UPDATE="" LINK_REQUIRED="auto" WICKED_DEBUG="" WICKED_LOG_LEVEL="" CHECK_DUPLICATE_IP="yes" SEND_GRATUITOUS_ARP="auto" DEBUG="no" WAIT_FOR_INTERFACES="30" FIREWALL="yes" NM_ONLINE_TIMEOUT="30" NETCONFIG_MODULES_ORDER="dns-resolver dns-bind dns-dnsmasq nis ntp-runtime" NETCONFIG_VERBOSE="no" NETCONFIG_FORCE_REPLACE="no" NETCONFIG_DNS_POLICY="auto" NETCONFIG_DNS_FORWARDER="resolver" NETCONFIG_DNS_FORWARDER_FALLBACK="yes" NETCONFIG_DNS_STATIC_SEARCHLIST="" NETCONFIG_DNS_STATIC_SERVERS="180.76.76.76 223.3.3.3" NETCONFIG_DNS_RANKING="auto" NETCONFIG_DNS_RESOLVER_OPTIONS="debug attempts:1 timeout:10" NETCONFIG_DNS_RESOLVER_SORTLIST="180.76.76.76 223.6.6.6" NETCONFIG_NTP_POLICY="auto" NETCONFIG_NTP_STATIC_SERVERS="" NETCONFIG_NIS_POLICY="auto" NETCONFIG_NIS_SETDOMAINNAME="yes" NETCONFIG_NIS_STATIC_DOMAIN="" NETCONFIG_NIS_STATIC_SERVERS="" WIRELESS_REGULATORY_DOMAIN=''
重启网络生效
推荐使用重启网络,不推荐使用 ip link set down eth0 && ip link set up eth0
重启网络
#systemctl restart network
重启网卡,此方法会断连
ip link set down eth0 && ip link set up eth0
验证
# cat /etc/resolv.conf nameserver 180.76.76.76 nameserver 223.3.3.3
一键执行修改查看
$sudo sed -i.bak '/NETCONFIG_DNS_STATIC_SERVERS/s/NETCONFIG_DNS_STATIC_SERVERS=""/NETCONFIG_DNS_STATIC_SERVERS="180.76.76.76 114.114.114"/' /etc/sysconfig/network/config && systemctl restart network && cat /etc/resolv.conf
参考官方说明文档
https://documentation.suse.com/zh-cn/sles/15-SP2/pdf/book-sle-deployment_color_zh_cn.pdf
https://documentation.suse.com/zh-cn/sles/15-SP2/html/SLES-all/cha-dns.html#sec-dns-basic
https://documentation.suse.com/zh-cn/sles/15-SP2/html/SLES-all/book-sle-admin.html
https://documentation.suse.com/zh-cn/sles/15-SP2/html/SLES-all/cha-network.html#tab-netz-param-hostconf
https://documentation.suse.com/zh-cn/sles/15-SP2/html/SLES-all/cha-network.html#dat-netz-etc-resolv-conf