深圳云计算学习:网络管理基础
====================================================================================
Network interface names
Traditionally, network interfaces in Linux are enumerated as eth0, eth1, eth2, and so on. However, the mechanism which
sets these names can cause changes to which interface gets which name as devices are added and removed.
The default naming behavior in Red Hat Enterprise Linux 7 is to assign fixed names based on firmware, device topology,
and device type.
Interface names have the following characters:
Ethernet interfaces begin with en, WLAN interfaces begin with wl, and WWAN interfaces begin with ww.
The next character(s) represents the type of adapter with an o for on-board, s for hotplug slot, and p for PCI geographic location.
Not used by default but also available to administrators, an x is used to incorporate a MAC address.
Finally, a number N is used to represent an index, ID, or port.
If the fixed name cannot be determined, the traditional names such as ethN will be used.
For example, the first embedded network interface may be named eno1 and a PCI card network interface may be named enp2s0.
The new names make it easier to distinguish the relationship between a port and its name if the user knows both, but the
trade off is that users cannot assume a system with one interface calls that interface eth0.
使用NetworkManager管理网络
网络管理器(NetworkManager)是一个动态网络的控制器与配置系统,它用于当网络设备可用时保持设备和连接开启并激活
默认情况下,CentOS/RHEL 7 已安装网络管理器,并处于启用状态。
device 设备,物理设备 例如enp2s0,virbr0,team0
connection 连接,逻辑设置 指的是一套具体配置方案
多个connection可以应用到同一个device,但同一时间只能启用其中一个connection。
这样的好处是针对一个网络接口,可以设置多个网络连接,比如静态IP和动态IP,再根据需要up相应的connection
NetworkManager提供的工具
nmcli, nmtui, nm-connect-editor
-
方法一: 修改ip/netmask/dns/gateway[了解]
[root@tianyun ~]# nmcli connection add con-name enp2s0-auto autoconnect yes ifname enp2s0 type ethernet
[root@tianyun ~]# nmcli connection add con-name enp2s0-