网卡设备状态:
- e, p: d3 `% g& L; t N- j[root@localhost ~]# nmcli device status; ^* u3 M7 V0 p) x# |) B# L
DEVICE TYPE STATE CONNECTION ) m3 B9 k% T3 r& k3 b
enp9s0f0 ethernet connected enp9s0f0
% p0 e8 g6 l) K" i- v+ {- oenp7s0 ethernet unavailable -- 5 n7 K3 O" h: V2 x! S7 F9 a
enp8s0 ethernet unavailable --
, c& x0 r/ u5 o+ }enp9s0f1 ethernet unavailable --
) }7 Z1 J; V4 v6 C% {lo loopback unmanaged -- % j& Y9 e# X4 j
' ]$ I& Q8 ^, G) M6 q
查看网卡信息:1 O8 z- U0 s" Y8 Z. h
[root@localhost ~]# nmcli c
9 @6 K2 I0 U& ^NAME UUID TYPE DEVICE
X4 w/ {6 @1 s8 q8 \8 P* h# f4 Henp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0
O& T3 f8 Q4 `5 q8 h2 h# \enp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet --
1 i. C2 {8 K! N2 F3 X1 L, ]enp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet --
8 E7 v& I* e5 K; R8 Xenp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet --
4 w2 L* x. c' P% ^3 i3 z
; m/ _! C4 w+ }% \[root@localhost ~]# nmcli c show , m9 O* s9 m$ r" |
NAME UUID TYPE DEVICE 7 ~) Y2 T: s5 s
enp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 7 u$ d5 X+ B! O' K4 h
enp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet --
9 O7 ~' U+ [4 R. b: a2 kenp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet --
/ [$ }1 Y' ?5 z4 S1 Menp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet -- + c# h3 O7 `0 I% t3 k6 o- O
( T, X1 h/ `/ l+ ^
[root@localhost ~]# nmcli con show/ u+ A0 l& H' F! l t
NAME UUID TYPE DEVICE * r) h& u1 Q7 n7 A
enp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 + j: ^' d/ m, d! [8 ^
enp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet --
/ {/ G* W" w- C4 w+ V# e" {5 henp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet --
+ y# g; m; m" D4 G1 y. l1 Jenp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet -- 9 i: k |( d1 W q- E+ \% ?; ]
% \; a+ ]3 g" c6 L查看网卡具体信息:
$ b0 O) S) I) P" n7 f' g2 A3 p$ @9 ?$ V+ v& h7 w4 `* u/ x) s; F5 v
[root@localhost ~]# nmcli connection show enp9s0f07 O& P0 A$ w" s$ n$ g
connection.id: enp9s0f0
( b! @ a6 H% X! m/ bconnection.uuid: 24cd33cc-8a9c-43fb-a817-3168b5eaf84e3 n3 o" k. c6 d4 P. b& S R" t
connection.stable-id: --3 O( s9 |7 Q/ b( K- ?
connection.type: 802-3-ethernet
; \" A4 h( p4 r- j) ?" v" Jconnection.interface-name: enp9s0f0
. ?4 @4 U% Q/ W2 \connection.autoconnect: no
$ m& G1 s( I& s+ O `$ P$ Dconnection.autoconnect-priority: 07 Q7 F4 D3 X2 C- h. u
connection.autoconnect-retries: -1 (default)( c# a. y" f0 |: }
connection.multi-connect: 0 (default)# F* J& a! _" K: l4 `; S( {
connection.auth-retries: -1' a y; s0 g9 `! _9 M9 t3 H. u
connection.timestamp: 1599451577
; N& Y( @1 R t) Q: }, ]connection.read-only: no
[9 a0 J8 ~8 s2 n) Econnection.permissions: --- W2 ?# l; i0 Q3 ~# f
connection.zone: --- {; S4 e, K. f- _8 _, Y
connection.master: --+ J/ j3 A2 ^8 N" t( N6 a9 y
connection.slave-type: --
3 v! \3 V9 j: @7 Y/ j$ Lconnection.autoconnect-slaves: -1 (default)& [7 p3 ]/ U% o0 t, q! b. |
connection.secondaries: --0 X9 C# Q7 f* W" s8 c" v
connection.gateway-ping-timeout: 0; A% h+ S& Y' V
connection.metered: unknown
1 ^8 e* D; m$ Y; H8 L- D+ }connection.lldp: default/ B2 |# `* z7 c3 d3 ]% E6 l
connection.mdns: -1 (default)
* N( {, \" G3 uconnection.llmnr: -1 (default)
" Z' W7 i7 {8 v* N# ]9 n& u5 |connection.wait-device-timeout: -1
, D! D% T; t, E1 O ]802-3-ethernet.port: --
: d( ]4 r) R" ~, e) K802-3-ethernet.speed: 0. `3 L5 j! f% n1 J E, V4 p
802-3-ethernet.duplex: --
) p/ Z% x0 k3 H1 A7 k6 n802-3-ethernet.auto-negotiate: no
# d! q/ {5 @8 L& R802-3-ethernet.mac-address: --+ a5 y: q/ B0 @3 Q- N! H
802-3-ethernet.cloned-mac-address: --: B$ R9 d+ ?* O5 |0 m- B
802-3-ethernet.generate-mac-address-mask:--; c* h$ N8 k" g, u% e
802-3-ethernet.mac-address-blacklist: --
6 a" E$ s) k/ w1 s* Y802-3-ethernet.mtu: auto9 K4 L4 n. [5 C: \ {$ h
802-3-ethernet.s390-subchannels: --% _8 m& S: D4 F, V$ |
802-3-ethernet.s390-nettype: --
. [7 K1 z$ s3 t$ i) D) |802-3-ethernet.s390-options: --2 c% X+ A& Z, Z& I& ~, q! B
802-3-ethernet.wake-on-lan: default
- h$ {- i- o( t; ^802-3-ethernet.wake-on-lan-password: --& W1 i$ E$ j0 k8 P
ipv4.method: auto8 x9 _% h6 Y! Z& a
ipv4.dns: --. K- x4 f$ k7 g& b9 E+ ^# e' S
ipv4.dns-search: --
q5 [, R7 a2 Y, c4 Vipv4.dns-options: --' d% ]) G/ a) v3 \$ b
ipv4.dns-priority: 0* n- W: l3 q# Z/ H
ipv4.addresses: --1 j: S. i- E: h8 Z
ipv4.gateway: --
9 v2 _/ r5 n8 H- o- Fipv4.routes: --9 U* w2 B( m3 Q b
ipv4.route-metric: -1
: @8 i5 T0 C+ s. q; Z; S4 |& [8 T' B2 _ipv4.route-table: 0 (unspec)9 {7 h- N% l, ~ j7 q9 A
ipv4.routing-rules: --
6 @2 V9 Q; q# ^" d5 p# K% @$ x5 Kipv4.ignore-auto-routes: no1 ^# `8 |1 V h- \* b9 K0 [3 x! E4 d
ipv4.ignore-auto-dns: no
% F! v* a5 O$ Bipv4.dhcp-client-id: --
, [0 ]% ?8 j# [2 j5 m8 ~& Sipv4.dhcp-iaid: --
" n- V3 Z/ q1 x# ~- _: Oipv4.dhcp-timeout: 0 (default); n- {' K' Q/ B+ O. {
ipv4.dhcp-send-hostname: yes
! m, ]! a6 B, Y! b( Iipv4.dhcp-hostname: --
! ~( e; f$ U" xipv4.dhcp-fqdn: --
3 s L% L v: I; p2 `ipv4.dhcp-hostname-flags: 0x0 (none)# r, z X* w3 I9 d+ c
ipv4.never-default: no! D9 M) F6 j' Q7 j- \1 Q
ipv4.may-fail: yes# X2 v' D( T! a7 {
ipv4.dad-timeout: -1 (default)2 L# P; d6 ?! U* L$ s' Y$ P4 D
ipv6.method: auto& d* [$ P. t& {" m: j% P
ipv6.dns: --
1 [8 a m1 c- k$ ?4 W0 ^, yipv6.dns-search: --+ d8 A# D2 U0 T5 v# x$ _
ipv6.dns-options: --; A U. [( Q' Z, w, V
ipv6.dns-priority: 0
6 Z \9 o+ _2 ?( V0 Qipv6.addresses: --+ c0 q1 y+ K' c) t$ E; h$ [
ipv6.gateway: --
5 [4 k. f2 t3 @+ Eipv6.routes: --
! u% Q4 R r2 b5 h& U0 hipv6.route-metric: -1
, Z8 [, g+ L: A3 |& \' R. Gipv6.route-table: 0 (unspec)
, g4 ^& Q" L+ D! }! |+ U, Tipv6.routing-rules: --
- t1 b) |2 T/ B) s" a. J, r. [ipv6.ignore-auto-routes: no) E- n2 e# d% ]! c* M7 ?# a( p
ipv6.ignore-auto-dns: no
0 H5 _8 J: e4 y2 Q/ Pipv6.never-default: no$ F" r& w6 q7 |1 t
ipv6.may-fail: yes- h" q2 x$ |+ _8 U6 W7 ^1 x" x& r
ipv6.ip6-privacy: -1 (unknown)
! a0 r# X6 w" t+ V/ ]ipv6.addr-gen-mode: stable-privacy
' {+ k' {" O. P7 h5 A* lipv6.ra-timeout: 0 (default)
+ \) o/ {/ A4 a9 Y0 Y4 c+ a1 fipv6.dhcp-duid: --- x2 F( m: {5 N8 d# Y
ipv6.dhcp-iaid: --, ]+ A- E* I' k6 C' V6 h( V
ipv6.dhcp-timeout: 0 (default)" X" a. j" ]/ ]; v+ s; _
ipv6.dhcp-send-hostname: yes% C# r; F$ G9 P0 N6 ]0 y* B/ L! I6 L
ipv6.dhcp-hostname: --, G$ N6 n7 b+ E0 `' ?2 O$ A
ipv6.dhcp-hostname-flags: 0x0 (none)
4 i$ L' z9 U* p0 Qipv6.token: --
; G- l% u' e; s; d- j! k( T- R; Aproxy.method: none& V7 n+ I" R' \, b" N5 u4 e
proxy.browser-only: no7 q' `# O7 j" }2 x3 G6 B+ e$ N
proxy.pac-url: --5 b0 ?% c4 W" M
proxy.pac-script: --. i! G {/ d/ ^" d# e# J
GENERAL.NAME: enp9s0f02 c" t# d. H+ k
GENERAL.UUID: 24cd33cc-8a9c-43fb-a817-3168b5eaf84e* R# R; p. L8 M7 ~7 e
GENERAL.DEVICES: enp9s0f0
5 b5 ~: S5 W! SGENERAL.IP-IFACE: enp9s0f0
3 X+ B9 p: {" D x. YGENERAL.STATE: activated1 U% [6 N0 L1 P6 M( a% H( k5 H
GENERAL.DEFAULT: yes9 m5 o" X) M+ h& ~9 J: l
GENERAL.DEFAULT6: no
, k( H8 a, O% RGENERAL.SPEC-OBJECT: --
/ @- T3 o# J! \+ R+ X" dGENERAL.VPN: no
7 N& ^$ P. X0 X @" hGENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/4$ }" V9 j0 N- K3 y8 [2 H6 p2 ?
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/4
5 d6 T- N( C2 O- A& D+ jGENERAL.ZONE: -- d9 {1 [* R4 F! b) u
GENERAL.MASTER-PATH: --, M6 y) B* D' Y; K
IP4.ADDRESS[1]: 192.168.7.10/24
/ l7 l+ e y6 U: U: Z g6 K$ b$ f8 uIP4.GATEWAY: 192.168.7.1
! i) L [6 q$ m* |1 |IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.7.1, mt = 100
: F2 N1 e1 G3 L$ c# p6 w8 U, bIP4.ROUTE[2]: dst = 192.168.7.0/24, nh = 0.0.0.0, mt = 100
* C. H$ X# x4 M) Q' z& _IP4.DNS[1]: 61.139.2.695 H' E+ O' g- J! G' n9 j+ c
IP4.DNS[2]: 218.6.200.139
( i" q+ D9 X3 d$ q% u- GDHCP4.OPTION[1]: dhcp_lease_time = 7200- t4 J5 q, O0 f, t$ ~7 C: M
DHCP4.OPTION[2]: domain_name_servers = 61.139.2.69 218.6.200.139. o6 @# k& p$ K$ [% B R" s, M
DHCP4.OPTION[3]: expiry = 1599458240& I& \# z; |# s( q
DHCP4.OPTION[4]: ip_address = 192.168.7.100 h9 |- t! y5 F, b( j6 M7 i& V
DHCP4.OPTION[5]: requested_broadcast_address = 1
: }; l |& v1 nDHCP4.OPTION[6]: requested_domain_name = 19 t! }# \! P: c* o
DHCP4.OPTION[7]: requested_domain_name_servers = 1
) G* E. Z/ c' g/ ^" g( _. U: MDHCP4.OPTION[8]: requested_domain_search = 1: y% W: ]( T0 E
DHCP4.OPTION[9]: requested_host_name = 1
7 z# d3 \$ g f. d) C$ U W ^- EDHCP4.OPTION[10]: requested_interface_mtu = 1& J) d a: [$ m# X6 z
DHCP4.OPTION[11]: requested_ms_classless_static_routes = 1/ F$ E ^& V# Y# Z" u* A* f
DHCP4.OPTION[12]: requested_nis_domain = 1
* o4 O9 n8 { W- C$ BDHCP4.OPTION[13]: requested_nis_servers = 1
# p6 u- X7 ^8 k$ n1 UDHCP4.OPTION[14]: requested_ntp_servers = 1
1 x: `7 n% Z& R2 @/ t4 LDHCP4.OPTION[15]: requested_rfc3442_classless_static_routes = 1) u6 w! N1 P' s+ Z1 ~
DHCP4.OPTION[16]: requested_root_path = 1
' |1 q' }5 M) @% @" i, G$ V' fDHCP4.OPTION[17]: requested_routers = 1
4 t# l& E- }3 ]DHCP4.OPTION[18]: requested_static_routes = 17 R3 t% A, d+ [& [7 }: k" _5 B# E
DHCP4.OPTION[19]: requested_subnet_mask = 1
5 z @' V# a$ L6 d2 g: s" I/ }DHCP4.OPTION[20]: requested_time_offset = 1
/ `! j T. e3 X2 K* H; q& N- gDHCP4.OPTION[21]: requested_wpad = 1: _+ E& e# C( \. j, y: t- C- m
DHCP4.OPTION[22]: routers = 192.168.7.1
( w: v: L2 k$ \' p+ @6 Y. JDHCP4.OPTION[23]: subnet_mask = 255.255.255.03 b* K* W6 ~8 K8 a5 Q2 c& j
IP6.ADDRESS[1]: fe80::691e:3557:301a:56b8/64
8 a7 H9 p5 f3 H! h! v; uIP6.GATEWAY: --% W: f+ A( c( [. f& t" p" ~: L/ t4 q
IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 100
* ~: H9 ?$ `' V( u% d4 V2 i2 eIP6.ROUTE[2]: dst = ff00::/8, nh = ::, mt = 256, table=255
6 }5 L$ k; h2 g X. T( ?: {* z2 I- s# Q
% r% i1 g+ Z0 P- f- K$ W查看所有活动连接:, i; F. L$ }+ |/ J) O; U' }
6 b! g6 |- [ X4 a9 m
[root@localhost ~]# nmcli connection show --active. v% W7 e1 g' {! i4 e# {
NAME UUID TYPE DEVICE
6 Y1 ], {5 E2 x }) benp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 5 x ~! S( g% D1 `/ ^" L: I
9 z% L" l: i; \3 G4 L: q
' @: }5 t, n8 K" `( D( P+ _, V启动命令:; e/ a' R, A- r" ?
[root@localhost ~]# nmcli connection up enp9s0f0+ g; V( o9 L. g6 l
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
% _% V8 [$ u+ _( c& z
0 g3 e9 R" w: X- a停止命令:! j1 n( n& Q& _/ s6 R5 L$ e
8 s- G: d p: Z. t# `- S3 Z8 {
) A% S* V9 j) s( z4 @2 q" t
[root@localhost ~]# nmcli device disconnect enp9s0f1# P" L7 P. B3 t& y2 l k
Error: Device 'enp9s0f1' (/org/freedesktop/NetworkManager/Devices/5) disconnecting failed: This device is not active; {+ V4 |& d. }/ h# ]" _
Error: not all devices disconnected.
+ E. M9 E0 p$ _, _; R& ?2 Q6 V1 s
重启命令: t2 i. x% P! W) r+ X
[root@localhost ~]# nmcli connection reload: n8 i- q, o. h; I, c- Q
& T2 b) c" P) T3 j7 m
添加一个网卡连接 5 k1 v; \7 R+ v3 X. L8 [
注:配置文件目录:/etc/sysconfig/network-scripts/* ,添加配置时,自动生成网卡配置文件eth0 nmcli connection add type ethernet con-name eth0 ifname eno33554992
' Z/ l5 z0 q4 X$ c |