欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

[虚拟机] 解决 Kali 虚拟机无法联网的问题(桥接模式 WIFI 和本地网线) - 2. KALI 基本配置:

最编程 2024-03-12 11:41:27
...

在终端输入:

1)gedit /etc/network/interfaces

这里采用静态配置的方法:(在下面我写了可以设置另一种动态获取DHCP的方法,如果网络稳定,不经常更换网络环境,这里可以选择静态配置)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

#the primary network interface
#allow-hotlpug eth0
#iface eth0 inet dhcp

auto eth0
iface eth0 inet static
address 192.168.x.x
gateway 192.168.x.x
netmask 255.255.255.0 

 其中address参考刚刚主机的IP地址(可以最后一位变化),网关和掩码和主机的一样。

2)gedit /etc/resolv.conf

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 180.76.76.76

 8.8.8.8是谷歌的IP地址

223.5.5.5是阿里云的IP地址

180.76.76.87是百度的IP地址

3)启动eth0

ifconfig eth0 up

4)重启网络

service networking restart 

5)检验成果

ifconfig 发现eth0的IP地址出现了。

ping www.baidu.com ,成功返回。

打开KALI浏览器,访问成功: