Full-stack for Frontender Folks Part 1
Tags: devops, server, deployment
Published: 2019-04-13 16:51:00

---
title: 
date: "2019-04-13T16:51:00.000Z"
layout: post
draft: false
path: "/posts/fullstack-for-frontend-part1/"
category: "devops"
tags:
  - "devops"
  - "server"
  - "deployment"
description: "This is a quick walkthrough of what is the internet to creating and setting up a server for future deploy"
---

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.

![](https://thepracticaldev.s3.amazonaws.com/i/ep3vlbem4nn8noie8xlj.png)

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](http://blog.boson.com/bid/102913/The-Seven-Layers-of-Networking-Part-III)


### 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

```

### 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
```

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](https://searchnetworking.techtarget.com/definition/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
```


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

```


#### 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.

![](https://thepracticaldev.s3.amazonaws.com/i/6nrislv8qtvzo6h49d6l.png)

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.

<!-- #### Analyze Network Path

Traceroute, also called tracepath or tracert, is a network tool used to determine the "path" packets take from one IP address to another. It provides the hostname, IP address, and the response time to a ping.

Enter the IP address that you want to lookup. This will provide a traceroute with geographic location information (city, state, country if available). For US based IP addresses 85% of the location information should be within 25 miles. -->
<!-- 
#### Cloup VOP

Server is just computer they usually do not have  GUI and usually controlled via command line, which you can login into via using [SSH](https://en.wikipedia.org/wiki/Secure_Shell). -->

##### 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

```
  
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) ~>

```

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.

<!-- #### server 

info on server here


you can create a setup a virtual private server by any many providers be it AWS, Digital Ocean, Vultr ect. 

Create steps for server and example 





Once you create your own server instance you can download pem file if you would like to connect from your machine terminal. PEM or Privacy Enhanced Mail is a Base64 encoded DER certificate. PEM certificates are frequently used for web servers as they can easily be translated into readable data using a simple text editor. Generally when a PEM encoded file is opened in a text editor, it contains very distinct headers and footers.

Once you have obtainted pem file you can ssh into your server with following command though utilzing your own info:

```

ssh -i /path_to_key/my_key.pem user_name@public_dns_name 

```

Utilzing this step should allow you a easy login to your server

 -->