ubuntu 固定ip

1、修改 /etc/network/interfaces 文件


auto enp2s0
iface enp2s0 inet static
address 192.168.199.146
netmask 255.255.255.0
gateway 192.168.199.1
dns-nameserver 8.8.8.8

備註:
1、dns-nameserver 解釋:
114.114.114.114(電信移動---國內)
8.8.8.8(谷歌---國外)
2、網卡需要選擇自己的可能不是enp2s0

2、修改在/etc/resolvconf/resolv.conf.d/base,添加域名nameserver 8.8.8.8


3、重啓下網絡連接


重啓後在/etc/resolv.conf就能看到自己寫上去的域名

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章