网卡设备状态:
+ q4 Q# X9 W9 Z[root@localhost ~]# nmcli device status3 f( Z. b* M! J% x7 T/ d& u
DEVICE TYPE STATE CONNECTION ; C4 c( M4 Y5 r$ \6 e( {) s
enp9s0f0 ethernet connected enp9s0f0
1 d) u: P" q0 tenp7s0 ethernet unavailable --
7 W( V. H7 O+ f+ W9 d2 ?enp8s0 ethernet unavailable --
6 J/ P3 Z; Y6 G; a K$ qenp9s0f1 ethernet unavailable -- : H: B6 W5 ?/ S0 ^7 }
lo loopback unmanaged -- * a$ K+ x! v6 W7 L- O: \, R. t5 q
2 e9 y z R; y! E. } G查看网卡信息:' e% T! [ M( G- G4 }8 @
[root@localhost ~]# nmcli c
! o" T) w, o/ e: M" B" ]/ yNAME UUID TYPE DEVICE , I) v/ d) n# E. E" D4 u, j/ J! j
enp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0
( t0 w% | {1 S2 uenp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet -- , U$ ~/ k m- a( H" r9 w6 k
enp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet --
& e% Q/ i5 d3 Senp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet -- ; e0 g$ _1 }* P1 V9 m9 j* B! i
4 a+ a+ Q. _4 b% P" ~ d' g
[root@localhost ~]# nmcli c show
( @' `8 v6 B. J1 zNAME UUID TYPE DEVICE
- y* X# z8 X- r! Wenp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 7 R- `5 a( N8 C2 v0 b. E
enp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet -- 2 T; s) h4 q$ s* \# B
enp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet -- / Z0 V: }# l0 x4 x0 m& Z
enp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet --
0 n' n. ^& e. z; z3 x. i6 m0 a* d! @& V0 [3 t& w8 K
[root@localhost ~]# nmcli con show2 Q7 g, V) T" v) U, I- e' m1 g
NAME UUID TYPE DEVICE
" b: ~7 h9 c, \) W4 zenp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0
" z$ Q2 {1 v. N! W$ T% r% F: B; g/ Wenp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet -- & p0 s) t$ N5 \6 Y
enp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet --
. y7 q' P. m! S# C( e+ [/ @/ Nenp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet --
0 y8 C8 y# U. X" B8 w; F, c) [5 z% Y9 _' L: B4 v0 v5 s1 z5 {
查看网卡具体信息:" }5 l' o" m& N, o" D9 f m0 O1 S
7 j$ A) u( m4 N4 d0 q
[root@localhost ~]# nmcli connection show enp9s0f0
/ S" U9 g6 ^: m; h9 E! [connection.id: enp9s0f08 U2 D j5 }% R/ j% y# c
connection.uuid: 24cd33cc-8a9c-43fb-a817-3168b5eaf84e( E0 x) K/ y9 w1 X j
connection.stable-id: --( ?1 _' V7 L3 ]
connection.type: 802-3-ethernet
4 ~5 O6 A% H, O. \& Z2 h! V0 Lconnection.interface-name: enp9s0f0
) z! m) @3 o- ? l5 Q5 B! kconnection.autoconnect: no) D7 j3 G0 ?* g6 y7 M8 o( s' |
connection.autoconnect-priority: 0
6 K7 ~) ?" z% e$ J/ s0 {5 Aconnection.autoconnect-retries: -1 (default)$ Z# p4 o, _6 Q- V; L. v
connection.multi-connect: 0 (default): [* B4 Q$ e1 k* K
connection.auth-retries: -1
r$ l, ~% `' `0 O& econnection.timestamp: 1599451577; U; R! c6 ?9 T
connection.read-only: no( s8 Z" R7 J: K# Y1 `; V, }. ^: E
connection.permissions: -- z7 l, P, v9 @1 J* o. j" A6 c4 K: j- k
connection.zone: --: X: j2 E, r& H8 K1 l
connection.master: --
' b4 n" s; Y8 n* x( G* Z$ |connection.slave-type: --8 T% G- y2 v# K2 Q
connection.autoconnect-slaves: -1 (default)- j, l: y5 m' _, ?# t
connection.secondaries: --7 Y$ X e1 r5 j. n* J' s
connection.gateway-ping-timeout: 0. ~& d' z. L3 k- q
connection.metered: unknown$ n$ G. S/ U0 c3 ]! f
connection.lldp: default6 s6 z3 w- s3 Y, X) X$ I
connection.mdns: -1 (default)
( T/ G% E" t1 u zconnection.llmnr: -1 (default)/ k; O" q" R$ H; w/ v) K
connection.wait-device-timeout: -1
# ?; L8 K7 o0 [" K& P* k802-3-ethernet.port: --8 T7 q) {+ j; I g; }6 G( b9 q4 G' B
802-3-ethernet.speed: 0) B* S( j1 V3 d I+ c( i
802-3-ethernet.duplex: --
# _* Q. C; [9 Z802-3-ethernet.auto-negotiate: no
. T2 ?9 ], H$ |5 T5 m# o) l( u802-3-ethernet.mac-address: --0 w2 D1 n/ S3 c2 b5 u
802-3-ethernet.cloned-mac-address: --
3 O: C2 y# U* ~8 F% K802-3-ethernet.generate-mac-address-mask:--+ Y2 z# i: |$ W W
802-3-ethernet.mac-address-blacklist: --
5 ~6 Q1 O3 K2 i; d1 D& |802-3-ethernet.mtu: auto
V' H H% d( [! l5 [9 S$ V. M802-3-ethernet.s390-subchannels: --
" U+ c4 B- h! e2 m( Y3 x802-3-ethernet.s390-nettype: -- H1 l+ S+ M$ ]! v7 M2 d
802-3-ethernet.s390-options: --! e' p2 y1 m9 O
802-3-ethernet.wake-on-lan: default
3 Y5 I% E0 r y3 n' [802-3-ethernet.wake-on-lan-password: --
' _. A) K% t6 c Bipv4.method: auto
6 m( E9 G1 [5 O: Ripv4.dns: --/ m. t, D q# j: j+ j
ipv4.dns-search: --
( e0 G" m/ S- B# Y4 x* Dipv4.dns-options: --% f$ \0 f8 A J+ B1 Y: ~: D* I7 Q$ U
ipv4.dns-priority: 0
. N( W% {. `- Ripv4.addresses: --: [6 k4 C, ~# D! D4 \* ]! w
ipv4.gateway: --
j8 C' n* F$ Y* o: |6 [ J7 Dipv4.routes: --* P8 A0 B1 F% S
ipv4.route-metric: -1
3 I* B! y/ P0 }5 P- z6 `* d) aipv4.route-table: 0 (unspec)3 @+ {0 {1 o2 B
ipv4.routing-rules: --
& N# ?$ j7 A% h: m3 y0 x4 Z$ Gipv4.ignore-auto-routes: no
1 u% s- t- x2 [ipv4.ignore-auto-dns: no( F0 h l( j0 D1 w* @0 E7 K1 f
ipv4.dhcp-client-id: --
, {' T3 @0 |4 ?, I6 r& E' Bipv4.dhcp-iaid: --
7 ]/ @3 F) C$ m6 h1 }ipv4.dhcp-timeout: 0 (default)3 T9 W+ {# H/ I: \" L
ipv4.dhcp-send-hostname: yes
0 B# l! B( ^$ `- k" nipv4.dhcp-hostname: --
B! B6 I" s& Z% C5 ]% [ipv4.dhcp-fqdn: --
, V- V1 K A' j8 ~5 mipv4.dhcp-hostname-flags: 0x0 (none)4 p$ n- [- w1 p3 ]- o
ipv4.never-default: no
e' M7 K# _. R7 _2 ?- Y1 J9 `ipv4.may-fail: yes2 x" _0 N5 v: c" A
ipv4.dad-timeout: -1 (default)
9 ]$ K% w/ v5 ]2 ?& d( Qipv6.method: auto
/ w# ?0 }9 }6 T6 _4 q: Tipv6.dns: --+ y" u) r3 f4 ` w
ipv6.dns-search: --, B; ?8 N- v7 Z t( t6 H0 M
ipv6.dns-options: --
* o9 n( w, n" e! y" vipv6.dns-priority: 0; _# i; r( ?( O" `7 ]
ipv6.addresses: --
1 W) ?" p( h4 y' N' A( s* @+ wipv6.gateway: --3 ?8 E, U0 ]8 B- N$ E- J
ipv6.routes: --
$ q' X* ~+ z# {4 D" @' x! zipv6.route-metric: -1" g/ }: i z$ G1 e2 X
ipv6.route-table: 0 (unspec)
& @8 m# z0 J- a! M* s) k7 @ipv6.routing-rules: --1 B3 p/ L# I1 X4 m. r4 I9 e
ipv6.ignore-auto-routes: no6 S/ B8 `1 v6 m% ~8 [
ipv6.ignore-auto-dns: no# i& H7 ?6 P" I( b; o! T" q
ipv6.never-default: no
' H, W; m. K* M$ Kipv6.may-fail: yes+ e, T( [+ L" H2 b5 M! S( w
ipv6.ip6-privacy: -1 (unknown)( W/ T3 E! K! y1 {; n7 u! H9 R
ipv6.addr-gen-mode: stable-privacy# P7 D; n% E7 j( Y+ }6 G& x K8 X
ipv6.ra-timeout: 0 (default)- a: f }8 C; l' W
ipv6.dhcp-duid: --
. O# `6 ^, j- _ipv6.dhcp-iaid: --1 g& ]) \+ N2 t
ipv6.dhcp-timeout: 0 (default). r- ~% T1 s* z& S& S$ }3 J
ipv6.dhcp-send-hostname: yes3 B& J+ ~9 q, n' s
ipv6.dhcp-hostname: --
: p/ h" y% L5 t2 |# f- I, V9 C* x; ^ipv6.dhcp-hostname-flags: 0x0 (none)
' u7 n7 {% U4 n$ G. Wipv6.token: --+ q/ T5 F# R) q% @; Y- y! S
proxy.method: none
$ d; x; {6 F& j9 F9 a6 M+ Sproxy.browser-only: no- h, n' u/ x0 {
proxy.pac-url: --
( H9 T' X' U9 rproxy.pac-script: --% M' K$ ]) z/ Z9 W
GENERAL.NAME: enp9s0f0& v6 {2 K9 s9 X+ W
GENERAL.UUID: 24cd33cc-8a9c-43fb-a817-3168b5eaf84e
- g& {" |5 H$ |4 R1 XGENERAL.DEVICES: enp9s0f0
8 _7 P2 S, D1 ~# W; W4 |GENERAL.IP-IFACE: enp9s0f00 y& C1 }' a; B: K
GENERAL.STATE: activated% s! S/ y% ^ ~/ r
GENERAL.DEFAULT: yes
$ `- P' G# R4 ~3 T/ h% ^GENERAL.DEFAULT6: no2 X; t. P( w1 Z" \
GENERAL.SPEC-OBJECT: --
s- X. F/ `9 h8 I, xGENERAL.VPN: no
5 e$ s5 @8 r: M2 x. ^$ k6 OGENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/4+ z5 `3 U5 F) E6 p
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/46 ~! [( ], Q6 N& \8 z
GENERAL.ZONE: --
M: ]# q4 O/ T- I0 A; yGENERAL.MASTER-PATH: --* N2 R% Q" j$ d1 @4 K& O: y1 j
IP4.ADDRESS[1]: 192.168.7.10/245 _( t6 ^) ]6 y7 q. U) z7 F
IP4.GATEWAY: 192.168.7.1
# t% B, b2 J0 ]% C: G* jIP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.7.1, mt = 100
1 q. Q( G% r, O- lIP4.ROUTE[2]: dst = 192.168.7.0/24, nh = 0.0.0.0, mt = 100. n9 G( q5 f, s9 A$ R% l' m6 u8 b
IP4.DNS[1]: 61.139.2.69, [) b* Q V' g. ~: R
IP4.DNS[2]: 218.6.200.139
: i( S: ^( u" U1 ~5 m" {DHCP4.OPTION[1]: dhcp_lease_time = 7200
6 P+ c% P+ z8 s6 @8 jDHCP4.OPTION[2]: domain_name_servers = 61.139.2.69 218.6.200.1391 S& E/ s! q' _! G% i o5 L S+ k
DHCP4.OPTION[3]: expiry = 15994582404 p( c [" N9 Z' ^" F
DHCP4.OPTION[4]: ip_address = 192.168.7.10
1 N0 x, F4 X% `! L6 g0 {; @DHCP4.OPTION[5]: requested_broadcast_address = 1! T& n8 `; y7 l% H1 g f
DHCP4.OPTION[6]: requested_domain_name = 19 w) r2 m5 t8 H. B, i
DHCP4.OPTION[7]: requested_domain_name_servers = 1
& C* p3 k! A8 K: I, U% BDHCP4.OPTION[8]: requested_domain_search = 13 N/ K C. b: b( P
DHCP4.OPTION[9]: requested_host_name = 1! I4 B2 K$ `& I* S9 B
DHCP4.OPTION[10]: requested_interface_mtu = 1
; ~8 e' F2 X8 iDHCP4.OPTION[11]: requested_ms_classless_static_routes = 1
/ }. e" I) h2 v( JDHCP4.OPTION[12]: requested_nis_domain = 12 N" ]5 n1 `4 o$ C2 y, ]/ [
DHCP4.OPTION[13]: requested_nis_servers = 1
" @* C; b5 v8 J; n8 x aDHCP4.OPTION[14]: requested_ntp_servers = 1
0 {. P) E6 `+ o; M* V; ?$ @DHCP4.OPTION[15]: requested_rfc3442_classless_static_routes = 1 K/ o9 \# d/ w$ t
DHCP4.OPTION[16]: requested_root_path = 1
! E9 f/ Q& T1 g' x6 e- FDHCP4.OPTION[17]: requested_routers = 1% }9 R* {% |: V; \0 g
DHCP4.OPTION[18]: requested_static_routes = 1
- c4 w' n' a+ s& n6 X, TDHCP4.OPTION[19]: requested_subnet_mask = 1
" j4 |; u# w/ F" ~) B. M3 N* ODHCP4.OPTION[20]: requested_time_offset = 1) ]' B! h2 \' @2 k, w4 ]: O; |
DHCP4.OPTION[21]: requested_wpad = 1
& F e# u9 t/ ~9 U) h& EDHCP4.OPTION[22]: routers = 192.168.7.1, t3 j9 q' }* R5 [& e" D$ Y! g$ B
DHCP4.OPTION[23]: subnet_mask = 255.255.255.01 a; b8 c1 G" x3 ], H; A
IP6.ADDRESS[1]: fe80::691e:3557:301a:56b8/644 \" ~" i3 n c$ E. B3 s4 D: P- {
IP6.GATEWAY: --
* J$ V$ b& j7 o6 o9 s \IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 100* R/ J- E4 l" a3 d
IP6.ROUTE[2]: dst = ff00::/8, nh = ::, mt = 256, table=255
- u. L6 g! D# w' I& n4 ]4 s% v- t1 X2 D
H2 b6 Y) P2 t查看所有活动连接:
: ?9 w5 O( Q5 d5 i2 W
- Q W# V, s- [- l# l% F[root@localhost ~]# nmcli connection show --active
, A" Y, q4 N- P5 v* qNAME UUID TYPE DEVICE
1 N' p, s4 G0 W/ t2 Xenp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0
' _, [# n* E7 k/ T& r9 E
% r. Z+ ~" C8 v! p0 p2 o7 z& U& \ u
启动命令:
, @4 E: |. m1 s[root@localhost ~]# nmcli connection up enp9s0f0 G5 V1 Y; j, t& l$ l0 P8 P: I
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
- ]5 M% @: r* H4 ?* j" Z
$ V# A. C2 [/ T5 s( f3 X: U& y停止命令:
' h' F: a. k: `: R1 l( m, y0 H+ s" j. e* n* L5 u* [6 H
+ u2 ~9 U" Z$ S! o[root@localhost ~]# nmcli device disconnect enp9s0f1
( H$ T( m! ]3 \# xError: Device 'enp9s0f1' (/org/freedesktop/NetworkManager/Devices/5) disconnecting failed: This device is not active0 Z5 a$ _" U; b# n; }
Error: not all devices disconnected.
) N- B. ^% v) {6 ~( H5 q$ O3 E) e. W+ R' I
重启命令:% w; B$ g" Z( ?, b
[root@localhost ~]# nmcli connection reload9 \$ c+ W0 l( g# y
- p4 A; S* v) n4 R( t+ K
添加一个网卡连接 % M2 w' @2 g+ q; C! L+ M% b( K
注:配置文件目录:/etc/sysconfig/network-scripts/* ,添加配置时,自动生成网卡配置文件eth0 nmcli connection add type ethernet con-name eth0 ifname eno33554992
0 D1 y% D( E+ q' p# t |