BCKJ
首页
注册

Linux SSH一键修改服务器DNS

bckj
梦想从未放弃
2021-03-29 16:06:50

SSH换DNS

更换国内DNS


echo -e "options timeout:1 attempts:1 rotate\nnameserver 119.29.29.29\nnameserver 114.114.114.114">/etc/resolv.conf;

更换国外DNS


echo -e "options timeout:1 attempts:1 rotate\nnameserver 8.8.8.8\nnameserver 8.8.4.4" >/etc/resolv.conf;

推荐国内外并行的DNS配置


echo -e "options timeout:1 attempts:1 rotate\nnameserver 114.114.114.114\nnameserver 8.8.8.8" >/etc/resolv.conf;

查看修改后的DNS配置


cat /etc/resolv.conf


注:命令里的dns可自行更换想用的