运维开发网

1、网络管理1

运维开发网 https://www.qedev.com 2021-04-08 12:55 出处:51CTO 作者:青云文质
网络管理1一、简介1、Linux网络接口名称规则Network interface namesTraditionally, network interfaces in Linux are enumerated as eth0, eth1, eth2, and so on. However, the mechanism which sets these names can cause changes

网络管理1

一、简介

1、Linux网络接口名称规则

  • 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.

  • en:eethernet 以太网-双绞线

    wl:wirelessLAN:无线网卡

    ww:WAN广域网:串行线缆

  • o:on-board板载网卡 s:hotplug热插拔 p:PCI接口

  • N:序号或者ID 示例:enp2s0

2、NetworkManager服务

  • 网络管理器(NetworkManager)是一个动态网络的控制器与配置系统,它用于当网络设备可用时保持设备和连接开启并激活
  • 默认情况下,CentOS/RHEL 7 已安装网络管理器,并处于启用状态。
  • 查看网络管理程序的状态:systemctl status NetworkManager
  • 查看网络子管理程序的状态:systemctl status network

3、配置网络的工具

(1)命令行配置

  • 配置文件:vim

[[email protected] ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33

  • 命令行: nmcli

如果没有这个命令,可以执行安装 yum -y install NetworkManager

(2)图形配置

1、网络管理1

二、配置网络参数

1、配置IP

(1)配置网卡参数

1)先备份网卡配置文件,再修改

[[email protected] ~]# cp /etc/sysconfig/network-scripts/ifcfg-ens33

2)获取本机各项参数
  • 命令行查看IP:#ip a
  • 子网掩码:255.255.255.0
  • 命令行查网关/默认路由:#ip r
  • 命令行查dns:#cat /etc/resolv.conf
  • 也可通过UI界面直接获取各项参数

(2)重启网络服务

[[email protected] ~]#systemctl restart network

(3)查看IP地址

#ip a

2、主机名

(1)改名方式1

  • 查看主机名:[[email protected] ~]# hostname
  • 配置主机名:# hostnamectl set-hostname qianfeng.example.com
  • 退出shell即可生效

(2)改名方式2

  • 查看和配置主机名: # cat /etc/hostname / #vim /etc/hostname
  • 重启生效:# reboot / #init 6

3、网络测试工具

[[email protected] ~]# ip a //查看所有IP(ifconfig)

[[email protected] ~]# ip route //查看路由,查看网关

[[email protected] ~]# ip neigh //(了解)另一台主机ping通,查看邻居

[[email protected] ~]# ping 127.0.0.1

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号