Debian 7.8 下配置网络的方法

来源:互联网 发布:iphone电池校准软件 编辑:程序博客网 时间:2024/05/22 00:12

系统: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 interfaceauto loiface lo inet loopback##auto eth0iface eth0 inet staticaddress 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 eth0auto eth1iface eth1 inet staticaddress 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
原创粉丝点击