最近拿着kali在虚拟机上玩一下,需要对网卡配置静态IP地址;通过图形化界面配置以后,发现/etc/network/interfaces里面并没有显示IP地址,也找不到在哪里,经过查阅资料确定了位置;
系统版本
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). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback root@kali:~# uname -a Linux kali 4.9.0-kali4-amd64 #1 SMP Debian 4.9.25-1kali1 (2017-05-04) x86_64 GNU/Linux root@kali:~# more /etc/os-release PRETTY_NAME="Kali GNU/Linux Rolling" NAME="Kali GNU/Linux" ID=kali VERSION="2017.1" VERSION_ID="2017.1" ID_LIKE=debian ANSI_COLOR="1;31" HOME_URL="http://www.kali.org/" SUPPORT_URL="http://forums.kali.org/" BUG_REPORT_URL="http://bugs.kali.org/"
2.想到新版的linux中有NetworkManager工具管理网络配置信息,所以找到/etc/NetworkManager/system-connections目录下面,发现有一个文件,通过查看这个文件时发现里面有网络地址的配置信息,如下:
root@kali:/etc/NetworkManager/system-connections# pwd /etc/NetworkManager/system-connections root@kali:/etc/NetworkManager/system-connections# ll 总用量 4.0K -rw------- 1 root root 315 5月 9 12:45 Wired connection 1 root@kali:/etc/NetworkManager/system-connections# cat Wired\ connection\ 1 [connection] id=Wired connection 1 uuid=f33717da-334a-4c31-b0be-bbba3a9606c7 type=ethernet permissions= timestamp=1494305073 [ethernet] mac-address-blacklist= [ipv4] address1=192.168.20.222/24,192.168.20.254 dns=8.8.8.8; dns-search= method=manual [ipv6] addr-gen-mode=eui64 dns-search= ip6-privacy=2 method=auto root@kali:/etc/NetworkManager/system-connections# ll 总用量 4.0K -rw------- 1 root root 315 5月 9 12:45 Wired connection 1 root@kali:/etc/NetworkManager/system-connections#
3.通过systemctl disable NetworkManager.service服务后进行重启,发现IP地址没有加载,网络没有生效,说明网络的IP目前由NetworkManager来进行控制的
root@kali:/etc/NetworkManager/system-connections# systemctl disable NetworkManager.service Removed /etc/systemd/system/multi-user.target.wants/NetworkManager.service. Removed /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service. root@kali:/etc/NetworkManager/system-connections#
4.目前NetworkManager与/etc/network/networking的作用我还没有进行比较。
原文地址:http://317807.blog.51cto.com/307807/1923616