1. VM ware Kali 网络连接问题
打开原先配置网络的Kali,却发现网络已经断开,网卡已经罢工了!
root@kali:~/桌面# ifconfig -a
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:0c:29:9f:f4:fb txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 6 bytes 318 (318.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 318 (318.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
kali的ip地址的配置路径和之前所学的centos 7有些许不同,这是发行的linux的版本不一样导致的
kali 的ip配置路径在 /etc/network/interfaces
centos 7 的配置路径在/etc/sysconfig/network-scripts/ifcfg-ens33(ens33为网卡名称)
进入interfaces配置ip相关
在最后加上
auto eth0
iface eth0 inet dhcp
意为通过dhcp自动获取ip地址及相关
2.网络重启服务命令
root@kali:/etc/network# systemctl restart networking
这里和centos 7 也不一样,一开始不知道也懵了一会
root@kali:/etc/network# ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.x.x netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::20c:29ff:fe9f:f4fb prefixlen 64 scopeid 0x20<link>
inet6 240e:63:c73d:2800:20c:29ff:fe9f:f4fb prefixlen 64 scopeid 0x0<global>
ether 00:0c:29:9f:f4:fb txqueuelen 1000 (Ethernet)
RX packets 9 bytes 1418 (1.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20 bytes 2415 (2.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 12 bytes 552 (552.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 552 (552.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@kali:/etc/network# ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from www.baidu.com (14.215.177.38): icmp_seq=1 ttl=56 time=64.2 ms
64 bytes from www.baidu.com (14.215.177.38): icmp_seq=2 ttl=56 time=221 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1003ms
rtt min/avg/max/mdev = 64.212/142.750/221.288/78.538 ms
这里已经是可以正常连上网络了,如果还不行,可以虚拟机的网络虚拟编辑器里调一下连接的方式。
3.静态ip地址配置
进入interface最后加上自己需要配置的内容
auto eth0
iface eth0 inet static //ip获取方式为手动配置
address ip地址
netmask 子网掩码
gateway 网关
重启网络服务就可以了