1. ~# gedit /etc/network/interfaces
将dhcp 一行屏蔽
添加和静态ip有关的参数
我修改后的文件如下:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.192
netmask 255.255.255.0
gateway 192.168.1.1
nameserver 192.168.1.1
2. ~#gedit /etc/resolv.conf
设置dns
我的配置文件如下:
nameserver 192.168.1.1
nameserver 8.8.4.4
domain domain
search domain
3.执行下面两个命令,启用新设置
~#ifdown eth0
~#ifup eth0