修改网卡ens18为eth0
mv /etc/NetworkManager/system-connections/ens18.nmconnection /etc/NetworkManager/system-connections/eth0.nmconnection
cat /etc/default/grub
在这一行GRUB_CMDLINE_LINUX结尾添加net.ifnames=0 biosdevname=0
grub2-mkconfig -o /boot/grub2/grub.cfg
配置静态ip
cat >> /etc/NetworkManager/system-connections/eth0.nmconnection <<EOF
[connection]
id=eth0
type=ethernet
autoconnect-priority=-999
interface-name=eth0
timestamp=1684911908
[ethernet]
[ipv4]
address1=192.168.100.186/24,192.168.100.254
dns=114.114.114.114;8.8.8.8
method=manual
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
EOF
注意:内容每行结尾一定不要有空格,192.168.100.186/24,192.168.100.254分别包括了ip,子网掩码,网关