ubuntu下设置IP的方法
1、直接从右上角打开Edit Connections,add添加网络(比较简单)

2、sudo gedit /etc/network/interfaces 进行配置
添加内容:
auto eth0 或者 auto eth1
iface eth0 inet static 或者 iface eth1 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 119.29.29.29

然后重启网络
sudo /etc/init.d/networking restart

但是第二种方法这样的设置会导致ubuntu开机之后无法自动连接wifi,即使不插网线连接的情况下ubuntu也会默认优先连接这个静态IP。若想ubuntu开机自动连接wifi,需删除掉设置的静态IP

改回初始:
auto enp3s0
iface enp3s0 inet dhcp

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐