DEV Community

Martin
Martin

Posted on

Full-stack for Frontender Folks Part 1

In this artilce I will first state explaning what is a IP address, DNS,Server and so much more in order for you to get your first server deployed.

How does the internet work?

These are the layers of how the internet is created in a nutshell for those who have taken a computer science degree.

The seven layers of function are provided by a combination of applications, operating systems, network card device drivers and networking hardware that enable a system to transmit a signal over a network Ethernet or fiber optic cable or through Wi-Fi or other wireless protocols in your machine or device.

If you would like to learn more about different layers of the internet here is a good article The Sevent Layers of Networking

What is a domain?

Let's start with what actually is a domain. A domain is just a wrapper ontop of a IP address. The most common one you as a engineer is 127.0.0.1, which stands for localhost. Localhost in essense is just a wrapper ontop of 127.0.0.1, which is always your local machine IP address.

You might have heard of domain and subdomain. Domain names are mainly used as name of websites. Subdomains are dependant on standard domains.


example: domain

martinpatino.com

example: subdomain

blog.martinpatino.com

Enter fullscreen mode Exit fullscreen mode

What is a IP address?

A IP address stands for Internet Protocol it is a type of protocol to communicate via network. A IP address is a numerical label assigned to each device connected to a computer network that uses IP for communicaiton. n IP address serves two principal functions: host or network interface identification and location addressing.

Example: 

 172.16.254.1
Enter fullscreen mode Exit fullscreen mode

There are a many of protocols, however IP address is the most common among developers. The internet uses TCP protocol, which is a whole networking course which I will not get into. However, if you are interested to learn more about TCP here is a article to help you learn more TCP.

What is DNS?

In simple terms DNS stands for Domain Name System, which is responsible to map IP address to domains. So to bring it together something like this

martinpatino.com == 23.12.185.66
Enter fullscreen mode Exit fullscreen mode

DNS has layers of cashing, which helps you with speed and your machine does not have to resolve the IP address everytime. If your first layer does not have the mapping to DNS IP address than it will resolve to second layer and if not there than third layer until it is resolved, which could be updated by some server.

First layer : Local cache
Second layer: LAN DNS server (Modem has a local caching as well)
ISP DNS server: Has it's own local caching

Troubleshoot Scenerio: Let's say your webportal is down. It may not be that your server is down it could mean that your DNS is down. A simple test would be to ping your website/portal. If you get a response than your server is up and running otherwise you will get timed out.

ping google.com 

response:

PING google.com(lax28s01-in-x0e.1e100.net (2607:f8b0:4007:801::200e)) 56 data bytes
64 bytes from lax28s01-in-x0e.1e100.net (2607:f8b0:4007:801::200e): icmp_seq=1 ttl=55 time=23.8 ms
64 bytes from lax28s01-in-x0e.1e100.net (2607:f8b0:4007:801::200e): icmp_seq=2 ttl=55 time=22.2 ms

Enter fullscreen mode Exit fullscreen mode

Security Issues(DNS)

A security issue with DNS is called DNS Spoofing. DNS spoofing occurs when a particular DNS serverโ€™s records of โ€œspoofedโ€ or altered maliciously to redirect traffic to the attacker.

The way that is currently resolve this is utiling https, which creates a handshake and confirms that you are who you say you are. DNS spoofing will generally not work on HTTPS websites unless the client chooses to ignore the warning signs or if you manage to obtain the private key for the site.

What is SSH?

SSH stands for Secure Shell, which is a cryptographic network protocol for operating network services securely over an unsecured network. Typical applications include remote command-line login and remote command execution, but any network service can be secured with SSH.

Example of a ssh being executed

ssh student@45.55.12.123

Enter fullscreen mode Exit fullscreen mode

In order to use ssh you will either need username/password or ssh key to login into a server. It is best pracitce to use ssh key rather than username and password as humans we are likely to keep password easy to remeber, which can be broken into in a matter of minutes.

Most commong people use for passwords:

  • 123456
  • password
  • 123456789
  • 12345678
  • 12345
  • 111111
  • 1234567

In order to start using ssh key you must generate your machines ssh keys. Generating a ssh key it consist of 2 keys a public key and private key. The public key is stored in the server and private key stays on your machine. Think of it as a two way lock in order to decrypted message being sent between machines it requires both priavete key and public key.

The way to generate a generate ssh key:


some user (11:39) ~>  ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ylo/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/ylo/.ssh/id_rsa.
Your public key has been saved in /home/ylo/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Up6KjbnEV4Hgfo75YM393QdQsK3Z0aTNBz0DoirrW+c ylo@klar
The key's randomart image is:
+---[RSA 2048]----+
|    .      ..oo..|
|   . . .  . .o.X.|
|    . . o.  ..+ B|
|   .   o.o  .+ ..|
|    ..o.S   o..  |
|   . %o=      .  |
|    @.B...     . |
|   o.=. o. . .  .|
|    .oo  E. . .. |
+----[SHA256]-----+
klar (11:40) ~>

Enter fullscreen mode Exit fullscreen mode

You should be able to find your ssh keys in your ~/.ssh directory. You can use this ssh public key to authenticate with servers, twitter, github ect.

NOTE DO NOT LOOSE OR SHARE YOUR PRIVATE KEY!

For more details on generating ssh-key info here is a link https://www.ssh.com/ssh/keygen/

In the next post we will be going over servers and we will be going over how to run your own AWS LightSail Ubuntu Server.

Top comments (1)

Collapse
 
jainish06915235 profile image
Jainish Patel

well content for tcp