Debian 7 配置IP、网关和DNS

编辑/etc/netwok/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
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1

auto eth0
系统启动的时候自动配置名为eth0的网卡

iface eth0 inet static
通过静态IP的方式来配置名为eth0的网卡

address 192.168.1.100 //配置IP地址
netmask 255.255.255.0 //配置子网掩码
gateway 192.168.1.1 //配置默认网关

DNS配置

修改/etc/resolv.conf文件,添加如下两行即可:

nameserver 8.8.8.8
nameserver 8.8.4.4