We will see how to assign static ip address on Linux step by step.

  • Open terminal (CLI)
  • Login as root
  • Edit /etc/sysconfig/network-scripts/ifcfg-eth0 conf file add below lines:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
TYPE="Ethernet"
HWADDR="00:0C:29:20:75:CC"
NM_CONTROLLED="yes"
ONBOOT="yes"
BOOTPROTO="static"
IPADDR="192.168.1.100"
NETMASK="255.255.255.0"

The items that can be defined in an ifcfg file depend on the interface type.

DEVICE= interface; name of physical device.

HWADDR = ethernet hardware address for this device.

NETMASK = Subnet mask.

NM_CONTROLLED=yes|no      If set to ‘no’, NetworkManager will ignore this connection/device.  Defaults to ‘yes’.

Free Web Hosting