Ubuntu设置静态IP

查看网络端口

netstat -tnlp

设置静态ip

sudo vi /etc/network/interfaces

eth 这个参数,应该和读者自己的机器ifconfig 输出相符

# interfaces(5) file used by ifup(8) and ifdown(8)
#auto lo
#iface lo inet loopback
auto eth
iface eth inet static
address 192.168.1.168
netmask 255.255.255.0
gateway 192.168.1.1

dns-nameserver 192.168.10.1

 

重启网络

sudo service networking restart

你可能感兴趣的:(Ubuntu设置静态IP)