root@kali:~# service networking restart
[....] Running /etc/init.d/networking restart is deprecated because it may not r[warnble some interfaces ... (warning).
[....] Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/00:0c:29:e2:03:ff
Sending on LPF/eth0/00:0c:29:e2:03:ff
Sending on Socket/fallback
DHCPRELEASE on eth0 to 192.168.1.1 port 67
Reloading /etc/samba/smb.conf: smbd only.
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/00:0c:29:e2:03:ff
Sending on LPF/eth0/00:0c:29:e2:03:ff
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 19
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
done.
结果如上图, 笔者用的是VMWare, 运行的是Kali Linux, 希望用桥接模式通过路由器获取动态IP, 但是无论如何也不能正确获取IP地址.
一点点排查
1. 排查DNS
root@kali:~# cat /etc/resolv.conf
nameserver 192.168.1.1
nameserver 114.114.114.114
192.168.1.1在里面, DNS设置没有问题
2. 排查网卡
root@kali:~# cat /etc/network/interfaces
# 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 # The primary network interface
#allow-hotplug eth0
auto eth0
iface eth0 inet dhcp
网卡自动激活, 并配置dhcp获取IP方式
3.排查VMWare 桥接设置
由于笔者装有Virual Box & VMWare Workstation, 所以有多个虚拟网卡, 桥接为自动模式, 心想是不是自动桥接到不能连外网的Virtual Box的虚拟网卡了?
果断选成实际外网网卡, 重启Kali Linux networking服务, 问题解决.
root@kali:~# service networking restart
[....] Running /etc/init.d/networking restart is deprecated because it may not r[warnble some interfaces ... (warning).
[....] Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/00:0c:29:e2:03:ff
Sending on LPF/eth0/00:0c:29:e2:03:ff
Sending on Socket/fallback
DHCPRELEASE on eth0 to 192.168.1.1 port 67
send_packet: Network is unreachable
send_packet: please consult README file regarding broadcast address.
Reloading /etc/samba/smb.conf: smbd only.
Internet Systems Consortium DHCP Client 4.2.2
Copyright 2004-2011 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/00:0c:29:e2:03:ff
Sending on LPF/eth0/00:0c:29:e2:03:ff
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 15
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.1.1
DHCPACK from 192.168.1.1
Reloading /etc/samba/smb.conf: smbd only.
bound to 192.168.1.101 -- renewal in 3353 seconds.
done.