Set a local fixed IP for the server

Some routers allow in its configuration page set a fixed IP to the computers that are connect to it, but as the configuration depends on the type of router I will explain another method to do it.

The method that I will explain basically is to configure the server that we are creating to not request an IP automatically but we are going to configure it to always use the IP that we will set in it, this requires the following steps:

1. We write in the console the following code:

sudo cp /etc/network/interfaces /etc/network/interfacesOLD (to make a copy of the network configuration)

sudo nano /etc/network/interfaces (to open the file “interfaces” with the text editor)

2. We will get a window that we will to edit to get these:

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet static

address xxx.xxx.xxx.xxx (we replace the x by the local ip we want to give to our server)

netmask 255.255.255.255 (This line is the subnet mask)

gateway xxx.xxx.xxx.xxx (we replace the x by the local ip of our router)

3. After editing the file press F2 to save, respond “s” and click enter.

4. Now we will restart the network connections, we introduce:

sudo /etc/init.d/networking restart

5. If we write in the command line:

ifconfig

It should get out inet addr: (ip that we just set to our server)

Next: Port configuration –>