There are upcoming maintenance events which may impact our services. Learn more

How to setup Network (Centos , Debian , Ubuntu, Windows) Print

  • 1



1 Preliminary Note

This tutorial explains the configuration of a static IP address (IPv4 ), the hostname and nameservers on CentOS. To be compatible with Desktop and Server Systems, we do the configuration on the shell.

IPv4 Network Configuration:

Netmask: 255.255.255.0
Gateway: xxx.xxx.xxx.1 (fill in the xxx's with the first three parts of your IP)
Network: xxx.xxx.xxx.0 (fill in the xxx's with the first three parts of your IP)


Public IPv4 Resolvers (Google):

8.8.8.8
8.8.4.4

2 Implementation

I will do a configuration file editing with the editor like vi. But you may use any other shell editor like nano or joe instead. The file name for the first network card (eth0) is /etc/sysconfig/network-scripts/ifcfg-eth0

I will first make backup of my original file as /etc/sysconfig/network-scripts/ifcfg-eth0.bak & then proceed for the changes in /etc/sysconfig/network-scripts/ifcfg-eth0

mv  /etc/sysconfig/network-scripts/ifcfg-eth0  /etc/sysconfig/network-scripts/ifcfg-eth0.bak

vi /etc/sysconfig/network-scripts/ifcfg-eth0

I will change  the file like this:

DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static    Need to change it to static if it dhcp
NAME="System eth0"
IPADDR= xxx.xxx.xxx.xxx  (fill in the xxx's with the first MAIN IPS of your VPS)
NETMASK=255.255.255.0
GATEWAY=xxx.xxx.xxx.1 (fill in the xxx's with the first three parts of your IP)
DNS1=8.8.8.8
DNS2=8.8.4.4



Reboot

 

 
This tutorial explains how to set a static IP on an Ubuntu @ Debian system from the command line. It covers the network configuration for all recent Ubuntu versions and includes instructions to configure a static IP address, set the hostname and configure name resolving. 

2 Implementation

I will do a configuration file editing with the editor like vi. But you may use any other shell editor like nano or joe instead. 


nano /etc/network/interfaces



Statically configured network cards will have a section like this on older Ubuntu versions:

auto lo eth0
iface lo inet loopback
iface eth0 inet static
        address xxx.xxx.xxx.xxx(enter your ip here)
        netmask 255.255.255.0
        gateway xxx.xxx.xxx.1 (fill in the xxx's with the first three parts of your IP)

And here the complete network configuration file from an Ubuntu 16.04 system.



 

Reboot


Windows
 
This tutorial explains how to set a static IP on an Windows system from the command line. It covers the network configuration for all recent Windows versions and includes instructions to configure a static IP address. 

address xxx.xxx.xxx.xxx(enter your ip here)
netmask 255.255.255.0
gateway xxx.xxx.xxx.1 (fill in the xxx's with the first three parts of your IP)
DNS1 8.8.4.4 
DNS2 8.8.8.8

 
Done!

Was this answer helpful?

« Back