星期一, 4月 19, 2021

From Dynamic to Static IP Address on CentOS 7

Get the current network status related on some Network Interface (ex: ens192):

Now we get some important information:

  • 192.168.109.56/23 => IP 192.168.109.56 & MASK 255.255.254.0
  • GATEWAY=192.168.109.254

We keep all the settings except "dynamic", in /etc/sysconfig/network-scripts/ifcfg-ens192:

  • ONBOOT=yes
  • NM_CONTROLLED=no
  • BOOTPROTO=static
  • IPADDR=192.168.109.56
  • NETMASK=255.255.254.0
  • GATEWAY=192.168.109.254

After configuration saved, restart network service and verify:

  • service network restart
  • ip a show ens192

星期三, 4月 14, 2021