马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
网卡设备状态: _: T) k, }6 P4 |9 v0 {0 ]
[root@localhost ~]# nmcli device status7 ~- c/ H9 x+ {) H6 o: U% t& m
DEVICE TYPE STATE CONNECTION 6 L5 l5 F8 V9 i" H5 I2 q
enp9s0f0 ethernet connected enp9s0f0
t* j5 _) M- }5 ^: p' `enp7s0 ethernet unavailable --
2 T! Q7 r" ^4 d" G- H8 ~' F* ~enp8s0 ethernet unavailable -- 5 e0 \" q) H" y" g4 T6 H- O
enp9s0f1 ethernet unavailable -- ! A9 {8 H, p9 a" P/ b5 _$ y
lo loopback unmanaged -- / D" V' v3 g6 x) x, h) ?6 R4 T7 m" R- Z
/ A/ D6 z7 V+ m% G2 }
查看网卡信息:4 N g1 Q) Z7 Z; a6 n
[root@localhost ~]# nmcli c
5 P ]+ e/ I( dNAME UUID TYPE DEVICE 8 l+ r( I% @( P. d& ~9 S7 N
enp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 0 V7 d/ a+ U9 R$ q4 X
enp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet --
6 G5 H. q! G/ Aenp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet --
8 r0 F- Y6 ^5 ^" j4 ?- p0 tenp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet --
3 r- j9 F8 C" C4 {4 i. S# Z: ]
4 M# q6 J6 N0 ^# Q" |! m6 S[root@localhost ~]# nmcli c show
* `5 e0 v" q0 `; h/ tNAME UUID TYPE DEVICE / u; d" ^; S+ f: D) k3 F5 @0 l
enp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 7 T* t" d9 s. J
enp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet --
I T/ B; V) f( l% p# S! ^1 Senp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet -- ) F, }' a8 A. b+ h8 n
enp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet --
7 X6 E" Y" S) |7 \
! S B7 u8 x0 U* B' _[root@localhost ~]# nmcli con show3 K O* ]2 r( |/ @& D. {! @
NAME UUID TYPE DEVICE
4 h4 V _2 S: j5 h2 v$ }! p6 M* Senp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 . `; i, j$ N5 Q4 |
enp7s0 75faabc3-f62c-9770-bfe5-9996ddb77891 ethernet --
4 l- J6 C) R2 D. p# wenp8s0 c2805d6e-8944-4c36-9e7c-1eb075356b51 ethernet -- 6 E* e( k) ~+ O& U. r9 T
enp9s0f1 ef8703ae-0d15-4814-8f21-f4a529f8ffee ethernet -- ; h0 s; N; m- I8 l
7 Q9 f% U" y3 l! z, Q4 ]0 s" v, v
查看网卡具体信息:
* R* C! a6 L2 w' ^% {+ @# J7 L
0 B7 d5 h0 D |" b# m, g, U[root@localhost ~]# nmcli connection show enp9s0f0/ N* D7 o' f& w
connection.id: enp9s0f0
, i4 F$ Y3 i& R! {3 vconnection.uuid: 24cd33cc-8a9c-43fb-a817-3168b5eaf84e
/ Y/ W; g* w* z: M$ o5 {connection.stable-id: --
( l `" _5 ^+ x; Kconnection.type: 802-3-ethernet% E3 G! Y# g9 e, u. N1 ?/ M4 l8 C" W# S
connection.interface-name: enp9s0f05 k& q. g. r, F3 I
connection.autoconnect: no
% O4 T6 M: `. g5 T. g( L* hconnection.autoconnect-priority: 0! O7 b8 g8 d9 a- j8 }0 m, T% O9 N
connection.autoconnect-retries: -1 (default)
1 E3 `! s9 }. h) t3 O- s* Dconnection.multi-connect: 0 (default)
" m$ V6 g% L* @& t2 F; Mconnection.auth-retries: -1
# W! y m. L# y5 a0 k% T- K* econnection.timestamp: 15994515771 s$ e8 d0 `/ A6 K
connection.read-only: no4 e6 B* t# g( h
connection.permissions: --
8 F! w9 _( Y5 \. O9 V5 G1 R* uconnection.zone: --0 J' `' [5 n! C
connection.master: --
- ~& x1 O2 A' Q1 c6 `* V! ~ fconnection.slave-type: --
8 ]# O! Q1 H8 l; l: W" f7 a# v" f; Yconnection.autoconnect-slaves: -1 (default)2 `4 V9 c4 l' z5 t! H) n. n# l, g4 ]
connection.secondaries: --
- F$ M, @9 W! k6 }) L U$ qconnection.gateway-ping-timeout: 0
) N L! t' ]3 w& h4 v$ @ @) m2 ?connection.metered: unknown4 T0 j9 C" n7 I( E/ Q& J
connection.lldp: default
) v; z' X/ M9 b. Oconnection.mdns: -1 (default)5 r( R* Q; x- h/ J
connection.llmnr: -1 (default): W, F# Y; N0 u
connection.wait-device-timeout: -1
1 x0 t0 W3 I3 `6 M0 [) J802-3-ethernet.port: --
4 n, g2 L% h h! ~802-3-ethernet.speed: 0
- d1 f, t) s0 V$ ~$ P% e$ @802-3-ethernet.duplex: --$ m& R( p3 E0 W1 {* O. o, P1 i( f
802-3-ethernet.auto-negotiate: no/ J; p* r" i0 j' K, _- _# K4 i
802-3-ethernet.mac-address: --
5 S7 ~: E x; s/ E8 i- E802-3-ethernet.cloned-mac-address: --
. E0 ~) l( P9 E$ a" A802-3-ethernet.generate-mac-address-mask:--
, o3 C7 F& k l- r# \" S3 |802-3-ethernet.mac-address-blacklist: --3 f& ^- o3 t0 Q4 b: s4 d0 K
802-3-ethernet.mtu: auto! Z+ n. J% x8 S. l1 G$ h5 z
802-3-ethernet.s390-subchannels: --
* I! i( X- _: R+ ?" L802-3-ethernet.s390-nettype: --/ m4 `, S! g, m& R% p
802-3-ethernet.s390-options: --
+ v" b8 M8 g# ^( W9 c- r7 A7 M1 ^9 a802-3-ethernet.wake-on-lan: default
4 u. C4 s. W. r" ?802-3-ethernet.wake-on-lan-password: --
8 @: ^4 R9 ]5 E( A/ `ipv4.method: auto" P4 ?2 M) s0 r" {
ipv4.dns: --- K6 \$ d, O- ]4 {8 H8 h/ R
ipv4.dns-search: --
5 j7 M# F. k6 i0 O% m2 d8 _$ J" J9 Wipv4.dns-options: --
1 u. K" g2 S9 u8 W( |, dipv4.dns-priority: 0
# @3 |# C4 p# b! m1 \/ l( c" cipv4.addresses: --# g8 D8 Y: q/ ~. k
ipv4.gateway: --- F5 _" p+ P; C" q7 p& U9 w8 A% x
ipv4.routes: --
& P3 s4 a W) T5 Wipv4.route-metric: -1. `; _; Q& r! }
ipv4.route-table: 0 (unspec)* W" y# b7 A. e7 I4 R
ipv4.routing-rules: --# j5 \9 B4 Y6 X9 p! R0 P, O3 O
ipv4.ignore-auto-routes: no- M& {$ m7 a1 X( r. r
ipv4.ignore-auto-dns: no
% x/ W/ t- S- X; ]8 i" L0 Qipv4.dhcp-client-id: --
) u9 u. s( [5 n$ Z( Mipv4.dhcp-iaid: --
# t2 l, l; G! Y( G8 |ipv4.dhcp-timeout: 0 (default)% `1 H$ C; m$ {4 k& v
ipv4.dhcp-send-hostname: yes5 t3 n" L' A1 q/ \7 t! S
ipv4.dhcp-hostname: --
: l4 H$ i0 P6 e, A0 v# H, C0 z: U) Oipv4.dhcp-fqdn: --
2 a5 j" w7 K- b" _* Z. F- vipv4.dhcp-hostname-flags: 0x0 (none)) a2 f4 j" [5 B4 J# ]
ipv4.never-default: no
g c) t( f% i, }) Z7 \ipv4.may-fail: yes
) ~5 P; X+ r2 d: \# E* K z' dipv4.dad-timeout: -1 (default)9 Z2 f* @+ P7 o2 [3 `( |
ipv6.method: auto- U$ D. y* p/ v- Y. X- k# N
ipv6.dns: --: g- X9 K9 y3 H$ i8 t* U, b& ~
ipv6.dns-search: --
@ f; K; n5 h. k2 f% w. Wipv6.dns-options: --8 ?, T. F+ z0 E4 b9 ^7 h
ipv6.dns-priority: 0, f- ^6 l% s# \
ipv6.addresses: --8 S( e5 g1 d: G1 s
ipv6.gateway: --1 T6 z/ a: ]* Q9 L& U3 n
ipv6.routes: --% p! K: {4 `9 x) j+ c
ipv6.route-metric: -1
# e- I; P! o7 ^5 g q* H/ Uipv6.route-table: 0 (unspec)
6 T% t! z; a! K7 Z5 W! K& Iipv6.routing-rules: --
% N, g# O$ f5 e- h! Aipv6.ignore-auto-routes: no5 [ Z* e3 ^: b" ?
ipv6.ignore-auto-dns: no4 {5 s5 h. M. A6 r9 r
ipv6.never-default: no, X! ?8 K7 b+ ]/ U
ipv6.may-fail: yes L( [5 Z$ F! u1 b: u8 ~8 W
ipv6.ip6-privacy: -1 (unknown)0 f8 h8 ^$ w$ d
ipv6.addr-gen-mode: stable-privacy) i4 l3 [ I' N3 ?$ L, x
ipv6.ra-timeout: 0 (default)
, a7 o9 Y) T& \! l5 Bipv6.dhcp-duid: --) B! a$ j. E6 F
ipv6.dhcp-iaid: --
F. A/ d& _6 K4 M+ h" @- n$ B6 iipv6.dhcp-timeout: 0 (default)( @+ H) D8 I1 d7 z6 l
ipv6.dhcp-send-hostname: yes. k+ |! ^3 m9 @3 t# z: F! s: D4 X
ipv6.dhcp-hostname: --
# @/ y3 G6 B- xipv6.dhcp-hostname-flags: 0x0 (none)9 _# H+ E5 {) b7 d7 Y- H
ipv6.token: --: n. g* B) L- a5 z% H
proxy.method: none
7 @5 e+ N- _8 c: X3 Aproxy.browser-only: no6 A7 _, q: J5 e$ b" y
proxy.pac-url: --% l k1 Z0 N. Z- G- J. ] S
proxy.pac-script: --3 }4 b3 d: x4 c7 g/ Y, R3 X
GENERAL.NAME: enp9s0f0
9 S/ _; [ M. h5 B4 L- u' SGENERAL.UUID: 24cd33cc-8a9c-43fb-a817-3168b5eaf84e( w) V2 u8 y7 j1 R
GENERAL.DEVICES: enp9s0f09 T, E2 l" ^0 M& T2 a B: a0 Q
GENERAL.IP-IFACE: enp9s0f0! N% G, _& l/ A! G- S
GENERAL.STATE: activated
. g! O4 r6 d0 V+ eGENERAL.DEFAULT: yes
$ v* x X- W6 I. w6 w5 m/ lGENERAL.DEFAULT6: no
% B! W% u% y/ t; \. dGENERAL.SPEC-OBJECT: --
9 K) Z9 F% k! L& G& G1 o$ ?GENERAL.VPN: no* y) p H5 V C6 w0 Q6 N; ]/ U0 g
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/4
+ H O6 L7 N" U% KGENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/4/ O P3 n( C- {0 k. X$ r. |1 \
GENERAL.ZONE: --
+ S# p M l" SGENERAL.MASTER-PATH: --' \3 @. ~+ v; R& L7 b
IP4.ADDRESS[1]: 192.168.7.10/247 ]7 r1 Z+ W; b+ h2 ^
IP4.GATEWAY: 192.168.7.1
. I6 ~, b) h, Y, qIP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.7.1, mt = 1000 S1 S6 z) B( Y9 `' O
IP4.ROUTE[2]: dst = 192.168.7.0/24, nh = 0.0.0.0, mt = 100
# P! C( P+ O. f( s" @IP4.DNS[1]: 61.139.2.692 i1 |' O, E& \4 H& Z! g
IP4.DNS[2]: 218.6.200.139
3 K; c9 t. O) `8 M4 \) [DHCP4.OPTION[1]: dhcp_lease_time = 7200/ b* w9 T1 e9 H: i! o7 w
DHCP4.OPTION[2]: domain_name_servers = 61.139.2.69 218.6.200.139
6 {# y' O2 O7 p/ WDHCP4.OPTION[3]: expiry = 1599458240
0 \8 T6 I% r8 Q8 i( }& IDHCP4.OPTION[4]: ip_address = 192.168.7.10
7 F7 ]! h2 Q; q# {4 rDHCP4.OPTION[5]: requested_broadcast_address = 1
, c/ \0 B6 K0 U% T. P0 a! fDHCP4.OPTION[6]: requested_domain_name = 12 X& w! b, v j) s! Y* x N8 h
DHCP4.OPTION[7]: requested_domain_name_servers = 1
+ H9 Z% z" Q: F, b( W2 B+ tDHCP4.OPTION[8]: requested_domain_search = 1
8 \* n w1 c8 z; cDHCP4.OPTION[9]: requested_host_name = 1
0 T! D/ M+ [2 [( `! c+ CDHCP4.OPTION[10]: requested_interface_mtu = 1
) l8 a! q I( A9 |2 C+ M' TDHCP4.OPTION[11]: requested_ms_classless_static_routes = 1
Q9 k, n" B9 I6 [7 m8 U9 vDHCP4.OPTION[12]: requested_nis_domain = 1
- k5 v. \8 L/ e1 V3 ~- C7 f* YDHCP4.OPTION[13]: requested_nis_servers = 1
+ p" N7 q- j3 C8 aDHCP4.OPTION[14]: requested_ntp_servers = 13 L4 r) v6 g( n
DHCP4.OPTION[15]: requested_rfc3442_classless_static_routes = 1
v1 K; ?% P) a7 d9 m4 XDHCP4.OPTION[16]: requested_root_path = 1! {/ t9 u! _- U& |6 n% f) q2 q
DHCP4.OPTION[17]: requested_routers = 1
9 S! p2 m4 D# {) ?0 y. S1 {- m( DDHCP4.OPTION[18]: requested_static_routes = 10 s6 |* c; R( T" `7 D- K
DHCP4.OPTION[19]: requested_subnet_mask = 1
3 l9 j f% ^% y8 B/ W6 R2 cDHCP4.OPTION[20]: requested_time_offset = 1
' k# j7 G3 b* i9 ] ]* E( CDHCP4.OPTION[21]: requested_wpad = 1) M1 i' [* ?9 N; T- u0 U+ y
DHCP4.OPTION[22]: routers = 192.168.7.1" u+ j# z+ A& v( O
DHCP4.OPTION[23]: subnet_mask = 255.255.255.0
! W9 j4 C4 ]1 k; l4 dIP6.ADDRESS[1]: fe80::691e:3557:301a:56b8/64- _" M- j) [( K e# J6 f8 [
IP6.GATEWAY: --$ @8 L1 u) S: [4 y1 G3 [
IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 100
6 G/ B% N# u$ S2 tIP6.ROUTE[2]: dst = ff00::/8, nh = ::, mt = 256, table=255
3 `, o% p+ v5 X" W' H' W+ V y9 ~% y5 Y& x0 N6 p
' f# {# I% a u% t8 h# A3 n% u查看所有活动连接:
( k. r; |3 }' p6 r
0 c; V$ p5 S z[root@localhost ~]# nmcli connection show --active* h: _% e+ r! k, r/ s5 G/ g
NAME UUID TYPE DEVICE
0 C4 s& K9 Y7 t" s5 b: _. e" Menp9s0f0 24cd33cc-8a9c-43fb-a817-3168b5eaf84e ethernet enp9s0f0 9 ^, |( P# m* e
8 l# ]& [9 ?( M2 R& q
7 I. a) k" X7 z# _4 Y4 y启动命令:
- c7 p7 H! @' ^1 b" C[root@localhost ~]# nmcli connection up enp9s0f0, I& j- z/ K4 Y) l J% t/ g3 z
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)6 I+ L7 t" { ]9 {. h7 j, Y, q
8 a" K& Z# `1 L! h8 ^
停止命令:, V ?9 [0 I/ k. `0 k6 Q: a
8 r7 c% I6 K, w
. J J7 o7 z& W' t[root@localhost ~]# nmcli device disconnect enp9s0f18 k" f+ e" s# G$ _% V; v' L* r2 D% Z- G
Error: Device 'enp9s0f1' (/org/freedesktop/NetworkManager/Devices/5) disconnecting failed: This device is not active' Y& Z: Z& v" P; s" ~0 y' _: @# S( r
Error: not all devices disconnected." v; p4 {; ?; P2 c, e8 p
3 M4 u+ s H' {) Q1 b重启命令:2 I+ l" ]# x; o$ S6 c: v
[root@localhost ~]# nmcli connection reload: J+ Z( J; J: r0 U8 ~% W
" C+ R5 h4 D3 r3 K
添加一个网卡连接
9 o1 n0 f' y, e5 h+ _& F8 ^注:配置文件目录:/etc/sysconfig/network-scripts/* ,添加配置时,自动生成网卡配置文件eth0
nmcli connection add type ethernet con-name eth0 ifname eno33554992
9 Y) q }. J" a. @4 l1 w1 c |