Connecting Your Server
At home you have a connection from your provider with which you can connect to the internet. The provider provides a modem where a network cable (cat5 or cat6) can be inserted. That way you can connect to dirty internet without any security. Almost everyone with such a connection sets up a router after the modem with the aim of connecting multiple computers. The router also ensures that breaking in from outside is made virtually impossible by using special techniques. This does not mean that you can not run into viruses by surfing the internet, in which case you usually invite the burglar….
Some providers provide a device where the modem and router are combined. It is then possible to connect different computers or connect to the internet via Wi-Fi.
In any case, the server at home must be connected directly to the router. This ensures that the server is connected to the server in the fastest way from the other computers in the house. This is important for the performance of the equipment.
Connecting to your server from outside your home
The server will therefore always be connected directly behind a router. The standard configuration of a router blocks all access to the home network so that you are more secure behind the router than when you are connected directly to the internet. If you still want to allow traffic then it is necessary to configure the router so that this traffic can be established.
This special traffic should only be sent to the server. All other computers at home must be protected. A fixed IP address is then required to be able to route this traffic from outside to the server.
Configure a fixed IP address in the server
When choosing a fixed internet address, care must be taken to choose an address from the range of the DHCP server pool. Open the configuration file: to be able to lead far.
sudo nano /etc/network/interfaces
Pas de volgende tekst toe:
# 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 eth0 iface lo inet loopback # The primairy network interface iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1 network 192.168.1.0 broadcast 192.168.1.255 nameserver 220.127.116.11 18.104.22.168 22.214.171.124 126.96.36.199
It should be noted that one works in the right address range. A frequently used address range is 192.168.0.1. This adjustment must be processed here in the example.
The dns servers, the name servers, can often be found in your router as the router requests these addresses from the provider’s system.
Then restart the network services:
sudo /etc/init.d/networking restart
Configure a fixed IP address in the router
Many routers have a possibility to generate a list of connected devices. In this list you can look up the server and determine the MAC address of the server. It can often be indicated that a device with that mac address must have a certain IP address chosen by you. In this way, no adjustments are required in the server.
Details about the configuration of the router can be found in the operating instructions of your router.
Port Forwarding in the router
If you want to run a web server at home, the ports 80 and 8080 must be forwarded from the server. Ports must also be forwarded for other options. Now that a fixed address has been set for the server, this becomes possible.
There is a possibility to forward ports in the router. This is also called open. This can be found in the router under “Portforwarding”. this is a simple list in which a port number and an ip address can be included. The traffic of the specified port is then always sent to the given ip address. In this way, Internet can enter outside traffic on the server and be processed further there.
Laatst bijgewerkt op 1 oktober 2018