Linux——Centos8虚拟机添加网卡未显示

2024-08-16 14:11:58 浏览数 (3)

前言

虽然Centos8已经不维护了,不过之前虚拟机安装的是8,刚好今天做东西,凑合用下呗~

内容

其实就两个命令而已~

查看设备

代码语言:javascript复制
[root@php-dev ~]# nmcli device
DEVICE  TYPE      STATE         CONNECTION 
ens33   ethernet  connected     ens33      
ens37   ethernet  disconnected  -- 

激活设备

代码语言:javascript复制
[root@php-dev ~]# nmcli connection add con-name ens37 ifname ens37 type ethernet 
Connection 'ens37' (371c3288-0fdd-4a6b-89d1-1caf5acc3b92) successfully added.

查看IP

代码语言:javascript复制
[root@php-dev ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:f2:50:20 brd ff:ff:ff:ff:ff:ff
    inet 192.168.223.21/24 brd 192.168.223.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::f43f:d28c:69d9:e3c9/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:f2:50:2a brd ff:ff:ff:ff:ff:ff
    inet 192.168.223.19/24 brd 192.168.223.255 scope global dynamic noprefixroute ens37
       valid_lft 1792sec preferred_lft 1792sec
    inet6 fe80::9fb3:2e77:eb03:9690/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

0 人点赞