Server Basics

From docwiki
Revision as of 15:49, 31 March 2020 by Mond (talk | contribs)
Jump to: navigation, search


Motivation

Linux is an ideal operating sytstem for servers. From a small Raspberry Pi that controls some IoT devices to the big data centers. Linux is everywhere. Here we will only cover some of the more common server services. You can also learn some basics that are useful for many server applications.

netcat, nc, ncat

netcat is kind of a swiss-army knife tool for network connections. There are 3 different versions which are sometimes installed with the same name.

You can find out which of those exist by trying the option -h with the above command. In my case i have install ncat with comes from the nmap tools (usefull to scan networks for hosts that answer). On my machine all 3 command: netcat nc and ncat are aliases to ncat.

So I will show you the ncat version of nc:

Here we connect but use the pipe to directly send the "HEAD /" to get response from the server:

$echo HEAD / | ncat www.orf.at 80
HTTP/1.1 400 Bad Request
Date: Sun, 29 Mar 2020 19:42:34 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
...

With nc, netcat, ncat we can also create a listen socket:

$ ncat -4 -l 1234

The above opens a listen socket on port 1234 (for IPv4 only). If we want to connect to this service we can open telnet connection in an other terminal windows:

$ telnet localhost 1234

What you type here will show up on in the terminal where you run the ncat command.