Debian-Linux配置网卡网络方法

518次阅读
没有评论

共计 587 个字符,预计需要花费 2 分钟才能阅读完成。

Debian不同于centos系统,网卡配置不是在/etc/sysconfig/network-scrip里面,而是在/etc/network/interfaces里面

1.Debian网络配置

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

auto eth0 #开机自动启动
iface eth0 inet static #静态IP设置
address 192.168.0.10 #本机IP
netmask 255.255.255.0 #子网掩码
gateway 192.168.0.1 #网关
#这边是配置KVM虚拟机,所以配置为静态IP

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

iface eth0 inet dhcp

设置DNS:

echo "nameserver 202.96.128.86" >>; /etc/resolv.conf 
或者
cp /etc/resolv.conf /etc/resolv.conf.bak 
# 备份原有dns配置文件
vi /etc/resolv.conf 
# 编辑配置文件
nameserver 202.96.128.86 
# 设置首选
dnsnameserver 8.8.4.4 
# 设置备用dns

配置好重启网络命令:

指定网卡重启
ifdown eth0
ifup eth0
网络重启
/etc/init.d/networking restart
service networking restart
正文完
 
admin
版权声明:本站原创文章,由 admin 2020-11-02发表,共计587字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码