分类: Linux

Ubuntu17.04设置修改网卡名称 、静态IP、DNS更新源等

新装的Ubuntu17.04默认网卡名字是enp3(后面这个数字可能会变),修改成通用的eth0,

找到GRUB_CMDLINE_LINUX=""
改为GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

执行sudo grub-mkconfig -o /boot/grub/grub.cfg

设置静态IP及dns:

auto eth0    #默认启动网卡
iface eth0 inet static
address 192.168.121.163
gateway 192.168.120.1
netmask 255.255.254.0
dns-nameservers 192.168.121.222    #指定DNS

最后reboot重启即可,若只是修改IP直接重启网卡服务即可
sudo /etc/init.d/networking restart

sudo ifdown eth0 ; sudo ifup eth0

修改更新源为中科大更新源:

sudo mv /etc/apt/sources.list /etc/apt/sources.list_bak
sudo tee -a /etc/apt/sources.list <<-'EOF'
deb http://mirrors.ustc.edu.cn/ubuntu/ zesty main restricted

deb http://mirrors.ustc.edu.cn/ubuntu/ zesty-updates main restricted

deb http://mirrors.ustc.edu.cn/ubuntu/ zesty universe
deb http://mirrors.ustc.edu.cn/ubuntu/ zesty-updates universe

deb http://mirrors.ustc.edu.cn/ubuntu/ zesty multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ zesty-updates multiverse

deb http://mirrors.ustc.edu.cn/ubuntu/ zesty-backports main restricted universe multiverse


deb http://security.ubuntu.com/ubuntu zesty-security main restricted
deb http://security.ubuntu.com/ubuntu zesty-security universe
deb http://security.ubuntu.com/ubuntu zesty-security multiverse
EOF
apt update -y

Ubuntu17.04总体来说,比之前的版本好用多了^o^

相关文章

发表新评论