kali linux 网卡配置出错 RTNETLINK answers: File exists

虚拟机使用kali linux 通过桥接方式和主机通信,需要保证ip 在同一网段,子网掩码,默认网关,DNS服务器地址相同

1)修改网卡配置文件:

vi /etc/network/interfaces

在这些语句下面

auto lo
iface lo inet loopback

添加如下内容:注意和主机的ip地址同一网段,默认网关一致

auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
gateway xxx.xxx.xxx.xxx

2)DNS服务器也要保证一致

vi /etc/resolv.conf

添加

nameserver  xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx

3)重启网卡

/etc/init.d/networking restart

也可以使用如下命令:

service networking restart

出现如下错误

[....] Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details.

查看信息如下

4月 29 15:28:06 kali systemd[1]: Starting Raise network interfaces...
4月 29 15:28:06 kali ifup[3457]: RTNETLINK answers: File exists
4月 29 15:28:06 kali ifup[3457]: ifup: failed to bring up eth0
4月 29 15:28:06 kali systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
4月 29 15:28:06 kali systemd[1]: networking.service: Failed with result 'exit-code'.
4月 29 15:28:06 kali systemd[1]: Failed to start Raise network interfaces.

查看网络的解决方法:

ip addr flush dev eth0

重新启动:

/etc/init.d/networking restart

输出如下:

[ ok ] Restarting networking (via systemctl): networking.service.

结束。

  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值