ubuntu 设置静态IP地址

打开网络配置文件

$ sudo nano /etc/network/interfaces

找到DHCP的配置

iface eth0 inet dhcp

删除上面这行,并改成 (这里的address, netmask, gateway 只是例子)

auto eth0
iface eth0 inet static
address 192.168.0.65
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4

保存文件并重启网络

$ sudo /etc/init.d/networking restart

或者

sudo service networking restart


你可能感兴趣的:(IP,ubuntu)