How to assign an IP address under Linux?

December 2016


How to assign an Ip address under Linux?




Issue


I want to know how can i assign or modify Ip address or submask under Linux?

Solution

  • To define or modify IP addresses of "eth0" interface while giving it "192.168.0.1" as value, you should type the following command line:
  • "
    ifconfig eth0 192.168.0.1
    "
  • To change the mask and to fix it's the value at "255.255.255.0", the command line is:
     ifconfig eth0 netmask 255.255.255.0. 
  • To check your configuration, you can type "
    ifconfig - a
    " which will show you the configuration of all your networks chart.

Related :

This document entitled « How to assign an IP address under Linux? » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.