ifconfig eth0 – Display current IP address and setting for network interface called eth0
You can add IP address using ifconfig command itself, but its not recomended for production servers, because it doesn’t save it permenantly. To test your new IP address, just enter command:
ifconfig eth0:0 188.8.131.52 netmask 255.255.255.0 up
in this way you will activate your new IP as alias and can check if you can reach it from outside your server:
To make permanent changes and save new configuration you need to edit configuration file according to your Linux distribution.
For Red Hat based systems like Centos/Scientific linux you need to edit/create files as follows:
/etc/sysconfig/network-scripts/ifcfg-eth0 : First Ethernet card configuration file
/etc/sysconfig/network-scripts/ifcfg-eth1 : Second Ethernet card configuration file
DEVICE=eth0 # Or eth1 interface
IPADDR=184.108.40.206 # There you need set your IP address
Also its temporally recomended keep your old IP addresses, if you want to do that you need create aditional network confugurations files like:
there you need save your old IP address:
IPADDR=”220.127.116.11″ # Your old IP address
also you need update your gateway information:
Save and close the file. Restart networking:
For Debian based systems like Ubuntu linux you need to edit / create files as follows:
iface eth0 inet static
address 18.104.22.168 # There you need set your IP address
teporally recomended keep your old IP addresses, if you want to do that you need edit /etc/network/interfaces cofiguration file and add:
iface eth0:0 inet static
address 22.214.171.124 # There you can set your old IP address
Save and close the file. Restart the network:
For servers running Windows Server 2008:
Click Start, and then click Control Panel.
In Control Panel, verify that Classic View is selected, and then double-click Network and Sharing Center.
In Network and Sharing Center, in Tasks, click Manage Network Connections.
In Network Connections, right-click the network connection that you want to configure, and then click Properties.
In Local Area Connection Properties, in This connection uses the following items, select Internet Protocol Version 4 (TCP/IPv4), and then click Properties. The Internet Protocol Version 4 (TCP/IPv4) Properties dialog box opens.
In Internet Protocol Version 4 (TCP/IPv4) Properties, on the General tab, click Use the following IP address. In IP address, type the IP address that you want to use.
Press tab to place the cursor in Subnet mask. A default value for subnet mask is entered automatically. Either accept the default subnet mask, or type the subnet mask that you want to use.
In Default gateway, type the IP address of your default gateway.
In Preferred DNS server, type the IP address of your DNS server. If you plan to use the local computer as the preferred DNS server, type the IP address of the local computer.
In Alternate DNS Server, type the IP address of your alternate DNS server, if any. If you plan to use the local computer as an alternate DNS server, type the IP address of the local computer.
Click OK, and then click Close.
If you have other Unix/Linux distribution you should read documentation about your network configuration. All information about network settings configuration you can found online in your OS vendor website.