CENTOS7 Network Management related commands

Source: Internet
Author: User

CONTOS7 Network card profile automatically identifies files beginning with ifcfg (including directories)

CENTOS7 network card naming rules:

CentOS 7 start for the network card number there is another set of rules, NIC interface code is now related to the source of the network card, basically the network card name will be categorized as follows:
Eno1: Represents the NIC built into the motherboard BIOS
ENS1: Represents the network card of the PCI-E interface built into the motherboard BIOS
Enp2s0: Represents the Pci-e interface of the independent network card, there may be more than one jack, so there will be s0, S1 ... The number
Eth0: If the above name does not apply, return to the original default NIC number

A network card device can contain multiple connections (conn), but only one connection (conn) is in use at the same time.

Show Networkmanage Status:

[Email protected] ~]# NMCLI general status
State CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
Connected full enabled enabled enabled

To view device status:

[Email protected] ~]# NMCLI device status
DEVICE TYPE State CONNECTION
eno16777736 Ethernet Connected Wired Connection 2
eno33554984 Ethernet Connected System eno33554984
eno50332208 Ethernet Connected System eno50332208
eno67109432 Ethernet Connected Wired Connection 1
TEAM0 Team Connected Team TEAM0
Lo Loopback unmanaged--

To view information about a device:

[Email protected] ~]# NMCLI device show Team0
General. Device:team0
General. Type:team
General. Hwaddr:00:0c:29:65:d1:da
General. mtu:1500
General. STATE:100 (connected)
General. Connection:team Team0
General. Con-path:/ORG/FREEDESKTOP/NETWORKMANAGER/ACTIVECONNECTION/6
IP4. ADDRESS[1]: 192.168.1.71/24
IP4. gateway:192.168.1.1
IP6. ADDRESS[1]: FE80::20C:29FF:FE65:D1DA/64
IP6. GATEWAY:

To view connection status:
[Email protected] ~]# NMCLI Conn Show
NAME UUID TYPE DEVICE
Team TEAM0 702de3eb-2e80-897c-fd52-cd0494dd8123 Team TEAM0
System eno50332208 d2665055-8e83-58f1-e9e3-49a5fb133641 802-3-ethernet eno50332208
Team0-port1 4233d75c-ff88-4897-a357-db8e7392c829 802-3-ethernet--
Wired Connection 2 2d4efd88-8eb5-4f32-a445-a7c5f272eba1 802-3-ethernet eno16777736
Wired Connection 1 68ee33fa-d1ab-4a68-aad7-b0a281740831 802-3-ethernet eno67109432
Team0-port2 94440FC0-A654-4225-9307-EA8EFFE21A80 802-3-ethernet--
System eno33554984 fb67dbad-ec81-39b4-42b1-ebf975c3ff13 802-3-ethernet eno33554984

[Email protected] ~]# NMCLI Conn show-a

interface-related statistical data:

[Email protected] ~]# watch-n 1 "ip-s Link show team0"

[Email protected] ~]# ip-s link Show team0
7:TEAM0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU qdisc noqueue State up mode DEFAULT
Link/ether 00:0c:29:65:d1:da BRD FF:FF:FF:FF:FF:FF
Rx:bytes packets Errors dropped overrun Mcast
18670 324 0 148 0 0
Tx:bytes packets errors dropped carrier Collsns
1244 18 0 0 0 0

To view the routing configuration:

[[Email protected] ~]# IP route
Default via 192.168.1.1 dev eno67109432 proto static metric 100
Default via 192.168.1.1 dev eno16777736 proto static metric 103
Default via 192.168.1.1 dev team0 proto static metric 350
192.168.1.0/24 Dev eno67109432 proto kernel scope link src 192.168.1.102 metric 100
192.168.1.0/24 Dev eno16777736 proto kernel scope link src 192.168.1.103 metric 101
192.168.1.0/24 Dev eno16777736 proto kernel scope link src 192.168.1.103 metric 102
192.168.1.0/24 Dev eno16777736 proto kernel scope link src 192.168.1.103 metric 103
192.168.1.0/24 Dev team0 proto kernel scope link src 192.168.1.71 metric 350

Routing configuration:

[[Email protected] ~]# IP route add 10.10.100.0/24 via 192.168.1.1 Dev Team0

Destination Address Gateway Interface

To delete a route:

[Email protected] ~]# IP route del 10.10.100.0/24 via 192.168.1.1 Dev team0 #方法一

[Email protected] ~]# IP route del 10.10.100.0/24 #方法二

Restart device: Ifdown, Ifup

Nmcli Dev disconn eno33554984 && nmcli Dev Conn eno33554984

Restart Network Service:

[Email protected] ~]# systemctl restart Network.service

Add a network card:

1. IP addr Show command to view interface information (get the name of the add NIC)

2, enter the/etc/sysconfig/network-scripts/directory, create a ifcfg-NIC name) network card configuration file.

3, Systemctl restart Network.service

Add Delete IP: (multiple IPs can be added in one network card)

NMCLI Connection Modify eno16777736 +ipv4.addresses 10.10.10.100/24
NMCLI Connection Modify Eno16777736-ipv4.addresses 10.10.10.100/24

Add a static IP address (the configuration file is created automatically)

[Email protected] ~]# NMCLI conn Add type Ethernet con-name eno16777736 ifname eno16777736 ip4 192.168.1.222 gw4 192.168. 1.1
Connection ' eno16777736 ' (0ec4472e-11cd-44b7-99f7-86397c340d0d) successfully added.

Start:

[Email protected] ~]# NMCLI conn up eno16777736 ifname eno16777736

CENTOS7 Network Management related commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.