王海庆的云笔记

修改Centos7的子网掩码


有Docker的服务器,修改子网掩码后,需要重启Docker服务。 

 

命令

sed -i 's/PREFIX="24"/PREFIX="20"/g' /etc/sysconfig/network-scripts/ifcfg-ens192

grep -rn PREFIX /etc/sysconfig/network-scripts/ifcfg-ens192

systemctl restart network
systemctl status network


还原

sed -i 's/PREFIX="20"/PREFIX="24"/g' /etc/sysconfig/network-scripts/ifcfg-ens192

grep -rn PREFIX /etc/sysconfig/network-scripts/ifcfg-ens192

systemctl restart network
systemctl status network

文章最后更新时间: 2021-11-05 09:23:35