Debian下配置网络的方法

来源:互联网 发布:农村淘宝发展前景分析 编辑:程序博客网 时间:2024/05/01 11:37

1.网络配置

配置网卡
修改 /etc/network/interfaces 添加如下

 
# #号后面是备注,不要添加哦!
 
auto eth0              #开机自动激活
iface eth0 inet static #静态IP
address 192.168.0.56    #本机IP
netmask 255.255.255.0   #子网掩码
gateway 192.168.0.254  #路由网关
 
#因为我是通过路由上网的,所以配置为静态IP和网关

如果是用DHCP自动获取,请在配置文件里添加如下:

 
iface eth0 inet dhcp

设置DNS

 
echo "nameserver 202.96.128.86">>/etc/resolv.conf
#请设置为你当地的DNS

到这里配置好以后,重启一下网卡。

 
/etc/init.d/network restart



0 0
原创粉丝点击