RHEL7中默认的网络服务是由NetworkManager提供,NetworkManager可以动态控制和配置网络。
网络工具和应用
应用或工具 | 描述 |
NetworkManager | 默认的网络守护进程 |
nmtui | NetworkManager基于光标文本的简单的图形用户接口 |
nmcli | 和NetworkManager交互的命令行接口 |
control-center | GNOME提供的图形化接口工具 |
nm-connection-editor | A GTK+ 3 application available for certain tasks not yet handled by control-center |
NetworkManager 的安装
# yum install NetworkManager
NetworkManager tui的安装
# yum install NetworkManager-tui
设置NetworkManager开启自启动
# systemctl enable NetworkManager
查看NetworkManager进程状态
# systemctl status NetworkManager NetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled) Active: active (running) since Tue 2015-07-14 10:09:36 CST; 8min ago Main PID: 808 (NetworkManager) CGroup: /system.slice/NetworkManager.service └─808 /usr/sbin/NetworkManager --no-daemon Jul 14 10:09:38 localhost.localdomain NetworkManager[808]: <info> (enp0s3): device state change: ip-check -> secondaries (reason ‘none‘) [80 90 0] Jul 14 10:09:38 localhost.localdomain NetworkManager[808]: <info> (enp0s3): device state change: secondaries -> activated (reason ‘none‘) [90 100 0] Jul 14 10:09:38 localhost.localdomain NetworkManager[808]: <info> NetworkManager state is now CONNECTED_LOCAL Jul 14 10:09:38 localhost.localdomain NetworkManager[808]: <info> Policy set ‘eth0‘ (enp0s3) as default for IPv4 routing and DNS. Jul 14 10:09:38 localhost.localdomain NetworkManager[808]: <info> Activation (enp0s3) successful, device activated. Jul 14 10:09:38 localhost.localdomain NetworkManager[808]: <info> NetworkManager state is now CONNECTED_GLOBAL Jul 14 10:09:38 localhost.localdomain NetworkManager[808]: ifcfg-rh: parsing /etc/sysconfig/network-scripts/ifcfg-lo ... Jul 14 10:09:41 localhost.localdomain NetworkManager[808]: <info> startup complete Jul 14 10:09:41 localhost.localdomain NetworkManager[808]: <warn> Dispatcher script "/etc/NetworkManager/dispatcher.d/20-chrony" failed with timed out: Script ‘/etc/...imed out. Jul 14 10:13:41 localhost.localdomain NetworkManager[808]: <info> use BlueZ version 4 Hint: Some lines were ellipsized, use -l to show in full. #
目录/etc/sysconfig下存放网络配置文件和脚本,大多数配置信息存放在该目录下。
文件/etc/sysconfig/network用于全局设置 目录/etc/NetworkManager/system-connections/下存储了VPNs、mobile broadband和PPPoE连接信息
RHEL7中,当手动编辑ifcfg文件的时候,NetworkManager并不会自动意识到所做的更改。
如果手动修改了NetworkManager profile,NetworkManager也不会自动意识到所做的更改。需要重新加载一下配置信息:
#nmcli connection reload
也可以指定被修改的具体文件:
# nmcli con load /etc/sysconfig/network-scripts/ifcfg-eth0
在启动过程中,/etc/init.d/network会读取ifcfg配置文件。
对ONBOOT=yes的配置文件,如果NetworkManager已经启动了对应的设备,就什么都不做。
如果NetworkManager没有启动对应的设备,就使用传统的启动方法,调用ifup来启动设备。
时间: 2024-10-11 12:25:24