DEV Community

Cover image for DevOps Quickie - 01
Jayant
Jayant

Posted on

DevOps Quickie - 01

Mild Hosting

if multiple computers are connected to the same wifi router. If anyone is serving anything on any port, then other computer can access it using other PC private IP address [ with port].

This is called mild hosting as app is hosted on the local network(intranet).

To get your Pvt. IP Address

ipconfig # or
ifconfig 
Enter fullscreen mode Exit fullscreen mode

Host Files - It is a config file that maps domain name to IP address. we can also override DNS resolution by modifiying this file and adding our custom IP for a domain.

sudo vi /etc/hosts
# i - for insertion in vi editor
# :wq - save change and exit 
# :q! - exit without saving 
# esc - to get back to the default mode 
# o - Open a new line below the current line.
Enter fullscreen mode Exit fullscreen mode

VM

Concept - As Renting machines/compute get popular, most of the people wants mini version of the machine but we don't have that much mini machine. Here comes the concept of the Virtual machines, they are the machines that run on a host, a host can have multiple VM's.
we use something called Hypervisor that lets us divide the hosts machine resources (CPU, memory, storage) into seperate VM's.

Each VM acts like a completely independent machine, even though they share the underlying hardware. You can run different operating systems and applications in different VMs on the same physical server.

Virtual Machines

Bare metal servers

In VM's there is a middlelayer called hypervisor, so the efficiency is not that much.
But in Bare Metal Servers the OS runs directly on the hardware without any middlelayer.
It offers better performance.

Useful for DB's , Gaming , Crypto Mining.

But there is a drawback to this the compute power & storage is limited it can't extend.

Also we get Bare metal servers on contract basis like for 1 year, not like VM's which can spinup very easily and dies very easily.

Bare Metal Servers

SSH

It is a protocol that allows secure connection between 2 systems.
It is most commonly used for remote login to the server and exceute commands.
Key Features

  • Encryption : Data sent is encrypted
  • Authentication : SSH uses 2 method for authentication 1) Password Based : We enter a password to login to remote server. 2) Public-key based : A more secure way, in this client uses private key to authenticate and system check it against corresponding user-public key.

In Password based authentication anyone can login using password and modify the data, and we can't track who modified it.

In Public Key Based authentication - each user has their public key stored in the server and they use their private key for authetication.

In Data Security

// Can only be decrypted by the person who has public key 
const mesg = EncrypteMessage(Message + Private Key );

// Can only be decrypted by the person who has private key.
const respMsg = EncrypteMessage(Message + Private Key );

Enter fullscreen mode Exit fullscreen mode

Generate a new public private keypair

ssh-keygen
Enter fullscreen mode Exit fullscreen mode

SSH

passphrase - it is a password to access the private key, unless anyone could who has access to your pc can take your keys.

Explore your public and private key

# ~ refer to root 
# In case of linux this fie is saved for the root user can only be used by him
# sudo cat ~/root/.ssh/id_rsa.pub
cat ~/.ssh/id_rsa.pub
cat ~/.ssh/id_rsa
Enter fullscreen mode Exit fullscreen mode

Now you can enter this public key in github to authenticate without password or to login to remote server.

If you put your public key in anyone pc as an authorized key then you can remotely access that pc.

Top comments (0)