

Unlike the distribution Debian, CentOS maintains the configuration in a separate file for each interface. Ubuntu /etc/network/interfaces # Your primary public IP address.ĬentOS /etc/sysconfig/network-scripts/ifcfg-eth0 To make this IP permanent we have to edit the configuration files. Means you will lose that IP and will get an other different IP assigned after reboot. The IP we assigned above is not a persistent or static IP. If you won’t have any preference of having specific IP assigned to the network card, this can be used dhclient eth0 The IP which will be assigned to the given network interface which will be provided by gateway or router. The program dhclient will get you the IP to the given interface using the Dynamic Host Configuration Protocol (DHCP).

This command will assign the specified IP to the give network interface. Assign IP using ifconfig ifconfig eth0 down We can do it simply by giving colon(:) and alias number. We created new interface alias with IP assigned. This is pretty useful when you need multiple IP addresses but you have only one network card. The network interface lo interface is the special interface where we called it as localhost and special IP assigned to it 127.0.0.1 also called loopback IP.ĭo you know? you can assign multiple IPs to single network interface. You can find the interfaces and their names and you can identify the name which is preceded by colon(:) in the left side.

You can see the available network interfaces on your machine by using the simple command ifconfig ifconfig This article objective is provide you the way to assign the IP address to the network interface from the command line.
