我最近将 14.04 升级到了 16.04,其中包括从 Upstart 到 的过渡systemd
,我不知道systemd
我的网络在做什么。
NetworkManager
、systemd-networkd
和systemd-resolved
均处于非活动状态:
$ systemctl status NetworkManager.service
● NetworkManager.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
$ systemctl status systemd-networkd
● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; vendor pre
Active: inactive (dead)
Docs: man:systemd-networkd.service(8)
$ systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; disabled; vendor pre
Drop-In: /lib/systemd/system/systemd-resolved.service.d
└─resolvconf.conf
Active: inactive (dead)
Docs: man:systemd-resolved.service(8)
从上次启动开始,我的身上就没有NetworkManager
任何痕迹:systemd-networkd
journalctl
$ journalctl -u NetworkManager
-- No entries --
$ journalctl -u systemd-networkd
-- No entries --
尽管如此,网络还是正常的。服务器正在连接到数据库服务器,并且其 Web 应用程序可以正常访问互联网。如何确定我正在使用哪个网络配置管理器?我必须使用一个,对吗?
编辑以下是 的内容/etc/network/interfaces
:
$ 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
auto eth0
iface eth0 inet dhcp
#iface eth0 inet static
# address x.x.x.x
# netmask x.x.x.x
# network x.x.x.x
# broadcast x.x.x.x
# gateway x.x.x.x
# # dns-* options are implemented by the resolvconf package, if installed
# dns-nameservers x.x.x.x y.y.y.y
# dns-search x.x.x.x y.y.y.y
答案1
您的网络配置在文件中设置/etc/network/interfaces
。它规定您的以太网接口 eth0 将在启动时自动启动,并通过 DHCP 从交换机或路由器请求地址。正如您所说,您的网络运行正常,这表明该文件以及 ifup/down 机制运行正常。