kali linux虚拟机dhcp服务启动不了的解决方法如下:
运行的是Kali Linux, 希望用桥接模式通过路由器获取动态IP, 但是无论如何也不能正确获取IP地址.
一点点排查
1. 排查DNS
root@kali:~# cat /etc/resolv.conf
nameserver 192.168.1.1nameserver 114.114.114.114
192.168.1.1在里面, DNS设置没有问题
2. 排查网卡
123456789101112root@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 interfaceauto loiface lo inet loopback # The primary network interface#allow-hotplug eth0auto eth0iface eth0 inet dhcp
网卡自动激活, 并配置dhcp获取IP方式
3.排查VMWare 桥接设置
centos7部署DHCP服务
yum -y install dhcp //安装DHCP服务
vim /etc/dhcp/dhcpd.conf //配置文件,里面什么都没有,告诉我们在/usr/share/doc/dhcp*/dhcpd.conf.example有个配置模板
cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf //将模板cp过来
vim /etc/dhcp/dhcpd.conf //编辑DHCP配置文件
subnet 192.168.130.0 netmask 255.255.255.0 { //声明网段和子网掩码
range 192.168.130.10 192.168.130.20 //设置分配DHCP地址的地址池,根据实际
option domain-name-servers 202.96.128.86 //指定DNS服务器地址
option domain-name "internal.example.org" //搜索域,根据情况设置,这里选择注释#
option routers 192.168.130.2 //设置客户机的默认网关地址
option broadcast-address 192.168.130.255 //广播地址
default-lease-time 300 //默认租约时间
max-lease-time 7200 //最大租约时间
ddns-update-style none //启用或禁用全局动态dns更新
}
vim /etc/sysconfig/network-scripts/ifcfg-ens33 //修改网卡配置的如下几项
BOOTPROTO=static
IPADDR=192.168.130.5
NETMASK=255.255.255.0
GATEWAY=192.168.130.2
DNS1=202.96.128.86
ONBOOT=yes
ifup ens33 //启动网卡
systemctl start dhcpd //启动服务
systemctl enable dhcpd //下次重启启动DHCP服务
systemctl status dhcpd //查看DHCP的状态
netstat -tunlp | grep dhcpd //查看DHCP端口
客户端
dhclient -d ens33 //重新获取DHCP地址
dhclient -r ens33 //释放获取的DHCP地址
ifconfig//查看网卡信息 | ip a
DHCP服务端
less /var/lib/dhcpd/dhcpd.leases //查看DHCP租约信息
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)