Static IP

From Bibliotheca Anonoma
Revision as of 14:47, 30 January 2018 by Antonizoon (talk | contribs) (Created page with "The first thing you are strongly recommended to do for a server is to give it a static IP address. This IP is only used with the router, and is not related to the global IP ad...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The first thing you are strongly recommended to do for a server is to give it a static IP address. This IP is only used with the router, and is not related to the global IP address actually used to access the server from afar.

Without a static IP, you would be forced to change the router port forward settings every single time the computer was disconnected, so it is very useful.

In Debian, edit /etc/network/interfaces and add the following:

Note: Make sure to change address to the IP address that you want (since this is a router subnet, it must be 192.168.1.x, and must not be in use).

Make sure that gateway points to the router's IP address, which is usually 192.168.1.1, but may differ.

# static IP settings
auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.11
    netmask 255.255.255.0
    gateway 192.168.1.1

Now restart the server, and the server should now be using the static IP in question (unless there was a conflict, if the address was already in use).