系统:Debian 7.8
Debian 7.8设置网络的文件为interfaces
# cat /etc/network/interfaces
在这里我设置的是静态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
##
auto eth0
iface eth0 inet static
address 10.255.**.**
#gateway 10.255.**.*
netmask 255.255.255.***
up route add -net 10.255.0.0 netmask 255.255.0.0 gw 10.255.**.* dev eth0
auto eth1
iface eth1 inet static
address 10.6.*.**
gateway 10.6.*.**
netmask 255.255.255.***
up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.6.*.** dev eth1
重启网络服务的命令
/etc/init.d/networking restart
可以通过以下命令查看验证
# ip a
# route
如果是用DHCP自动获取,请在配置文件里添加
iface eth0 inet dhcp
设置DNS的方法
echo "nameserver ***.***.***.**" >> /etc/resolv.conf