進入配置文件,配置IP
leafpad /etc/network/interfaces.conf
寫入如下格式的內容:
/etc/network/interfaces # 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 allow-hotplug eth0 iface eth0 inet dhcp # This is an autoconfigured IPv6 interface iface eth0 inet6 auto 修改為: # 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 allow-hotplug eth0 auto eth0 //增加了該選項,因為使用networking restart時系統啟動 auto的網卡,如不加上則啟動無反應 iface eth0 inet static //配置了static 為靜態ip address 192.168.1.4 //設置ip地址 netmask 255.255.255.0 //設置掩碼 gateway 192.168.1.1 //設置網關 # This is an autoconfigured IPv6 interface iface eth0 inet6 auto
配置DNS(注:先刪除一個之后再新建一個resolv.conf,可防止重啟后resolv.conf內容被清空)
leafpad /etc/resolv.conf
/etc/resolv.conf nameserver 202.106.0.20 nameserver 202.106.46.151 修改為: nameserver 202.106.0.20 nameserver 202.106.46.151 nameserver 8.8.8.8