查看使用网卡
```shell
[root@localhost ~]# ifconfig
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.116  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe98:87e0  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:98:87:e0  txqueuelen 1000  (Ethernet)
        RX packets 293438  bytes 377952170 (360.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 171895  bytes 23203790 (22.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4  bytes 344 (344.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 344 (344.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```
获取网卡对应mac地址
```shell
[root@localhost ~]# ip a
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: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:98:87:e0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.116/24 brd 192.168.1.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe98:87e0/64 scope link
       valid_lft forever preferred_lft forever
```
![微信图片_20230831141335.png](img/微信图片_20230831141335.png)
修改网卡对应文件
```shell
vi /etc/sysconfig/network-scripts/ifcfg-enp0s8
```
# 自己配置
```shell
HWADDR=08:00:27:98:87:e0  # 对应mac地址
TYPE=Ethernet
BOOTPROTO=static # 设置为使用静态IP地址
IPADDR=192.168.1.116 # 设置静态IP地址
NETMASK=255.255.255.0 # 设置子网掩码。
GATEWAY=192.168.1.1 # 设置网关地址。
DNS1=223.6.6.6 # 设置首选DNS服务器（如果需要的话）
DNS2=223.5.5.5
NAME=enp0s8
UUID=ffcbb7a5-8d59-490a-8205-7c923328d507 # 记得修改
DEVICE=enp0s8
ONBOOT=yes # 设置网卡为开机启动
HOSTNAME=hy-node5  # 设置主机名，本地解析
```
# 重启
```shell
systemctl restart network
```
