NIC naming rules
CENTOS6 card named: it will change rather than a unique and fixed according to the situation, before CENTOS6, network interface uses a serial number name: eth0, eth1, etc., when adding or removing the card, the name may change
CENTOS7 using dmidecode collection naming scheme, in order to obtain information on the motherboard; it can achieve a permanent unique name of the network card (dmidecode This command can gather information about the hardware aspects)
Network devices are named:
1) If the index information Firmware (firmware) or BIOS-based onboard device provided available and the predictable be named according to the index, for example: ifcfg-ens33
2) If the index information Firmware (firmware) or BIOS as PCI-E available expansion slot is provided, and can be predicted, are named according to the index, for example, name, for example: ifcfg-enp33
3) If the physical position information of the available hardware interfaces, this information is named, e.g. enp2s0
The above are available, the use of conventional naming scheme.
Extended:
In CENTOS7, en represents: ethernet Ethernet is that we now use LAN
enX (X common are the following three types):
o: motherboard onboard LAN device integrated device index number. in case
p: independent card, PCI card
s: hot swap card index, usb like, expansion slot
NNN (figures) represented by: MAC address of + motherboard unique sequence information calculated
ifconfig command
Ifconfig command or the ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.63 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::c09d:975d:89cd:fd3f prefixlen 64 scopeid 0x20<link> ether 00:0c:29:02:83:db txqueuelen 1000 (Ethernet) RX packets 3255 bytes 4458479 (4.2 MiB) RX errors 0 dropped 26 overruns 0 frame 0 TX packets 1130 bytes 81645 (79.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The first line: up -> network card on state
RUNNING -> network connection state linework
MULTICAST -> Multicast Support
mtu 1500 -> (Maximum Transmission Unit) maximum transmission unit size is 1500 bytes
Second row: IP address, subnet mask, broadcast address
Third row: IPV6 configuration information
Fourth row: MAC address of the network card
ether indicates that the connection type is Ethernet
txqueuelen 1000 - "transmit queue length
5th and 6th row: NIC pick n receive a packet of statistics and receive error statistics
Seventh eight lines: Statistical information card that sent the packet and send the error statistics
Temporarily modify IP
1, temporarily modify IP
IP address of the network card ifconfig method name
However, the restart will fail
Restart card:
systemctl restart network (centos7)
service network restart (centos6)
2, add more temporary IP
ifconfig NIC name: 0 first IP address (netmask subnet mask) --- add an IP
ifconfig NIC Name: 1 second IP address (netmask subnet mask) --- add an IP
3, delete the temporary IP
ifconfig ens33:0 del 192.168.1.110
NeworkManager
NeworkManager service is a daemon to manage and monitor the network settings, CENTOS7 pay more attention to the use of NetworkManager services for configuration and management of the network, 7.0 previously by network service management network, future versions, all network management and set up a unified maintained by NetworkManager service . It is a dynamic, event-driven network management services.
command:
systemctl status NetworkManager # View networkmanager whether the service is started
Network-related configuration files
ls / etc / sysconfig / network-scripts / ifcfg-ens33 #IP address, subnet mask profile
ls / etc / sysconfig / network-scripts / ifcfg-lo # NIC loopback address
cat /etc/resolv.conf #DNS profile
cat / etc / hosts # Set the host and IP binding information
cat / etc / hostname # Set the host name
Permanently modify the network card IP address
1, using the modified command nmtui
Command: nmtui
Restart card services to take effect
systemctl restart network --- restart the service
2, modify the configuration file
vim shortcut:
I: insert mode
Save: press esc, and then enter: wq
命令:vim /etc/sysconfig/network-scripts/ifcfg-ens33
Explanation
参数说明:
DEVICE:此配置文件应用到的设备
HWADDR:对应的设备的MAC地址
BOOTPROTO:激活此设备时使用的地址配置协议,常用的dhcp, static, none,bootp
NM_CONTROLLED: NM是NetworkManager的简写,此网卡是否接受NM控制;建议CentOS6为“no”
ONBOOT:在系统引导时是否激活此设备
TYPE:接口类型;常见有的Ethernet, Bridge
UUID:设备的惟一标识
IPADDR:指明IP地址
NETMASK:子网掩码
GATEWAY: 默认网关
DNS1:第一个DNS服务器指向
DNS2:第二个DNS服务器指向
USERCTL:普通用户是否可控制此设备
IPV4_FAILURE_FATAL 如果为yes,则ipv4配置失败禁用设备