0
点赞
收藏
分享

微信扫一扫

Rocky Linux 9.2修改网卡名为eth0且配置静态ip

修改网卡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,子网掩码,网关

重启机器reboot

举报

相关推荐

0 条评论