Skip to content

Instantly share code, notes, and snippets.

@raghavddps2
Created November 18, 2020 08:21
Show Gist options
  • Select an option

  • Save raghavddps2/bc31ed3842e59f975ab317b33293cec9 to your computer and use it in GitHub Desktop.

Select an option

Save raghavddps2/bc31ed3842e59f975ab317b33293cec9 to your computer and use it in GitHub Desktop.
This is a tutorial on very basics of computer Networks. It is not an in depth tutorial that covers everything. Just some bare necessary stuff software engineers should know!
  1. Computer Network :

    1. A bunch of devices connected to each other. Computers need a way to communicate with each other.

    2. The purpose is basically to share information from one computer to another. At the most basic level, it is through cables, Waves etc.

    3. This data can be documents, pictures, videos etc.

    4. Netlfix is 32% of the entire bandwidth consumption in the United States.

  2. Types of Computer Networks:

    1. LAN (Local Area Network): This means that all the computers are in the same building. One useful technique of a LAN can be sharing printers. These are usually connected by cables or wireless.

    2. MAN (Metropolitan Area Network) : Computers all across the city are connected through a Metropolitan Area Network. They can share patient information/College Research papers etc. These are usually connected by High Speed Fiber optic cables/telephone wires/copper cables.

    3. WAN (Wide Area Network) : This is composed of multiple MAN's. Basically connection among cities is using WAN's.

  3. More on Networks

    1. Each component in a network is called a node. Medium to commuicate is called communication media.

    2. A server is basically a computer that is accessible to many users. For example the server that powers https://www.google.com send us the google home page.

    3. The web server will be accessible to anyone who wishes to visit or website.

    4. Clients are basically the computers that are trying to access a particular web server.

  4. Network Interface Card

    1. Part of our computer that basically helps us to connect to the internet.

    2. For any computer to connect to the internet, we need something called as the network interface card.

    3. A NIC basically has 2 major parts, one that connects to the computer and the other slot for the communications media like an ethernet or something.

    4. Ethernet PORT is not the only thing, we can even have WIFI Cards, but now a days laptop devices have both Ethernet PORTS and WIFI cards.

  5. Protocols and Topologies

    1. Protocols are set of rules for communication between various computers or for communication in the netwirk.

    2. Communication was possible between 2 computers because they were following the same protocol.

    3. HTTP is the most famous protocol that works at the APplication layer.

    4. https://www.mraghav.tech/algo.html

      1. https - Protocol
      2. mraghav.tech - Web server
      3. algo.html - file
    5. Bus Topology:

      1. It has a main cable and all the devices are connected along the way through that cable.
      2. The ends for the cables are called terminals.
      3. If PC1 on the cable wants to send some information to PC2, it sends the data along the cable, and only the server for which message is intended responds.
      4. Terminators basically absorb the signals when it reaches the end of the cable.
      5. It is really cheap as all we need is a cable.
    6. Ring Topology:

      1. It hits node by node and even if it reaches the destination it goes on until it reaches back to the source.
      2. Double ring topology is also used and that is kind of more reliable.
      3. It is a bit more costly than the Ring Topology.
    7. Star Topology

      1. Suppose we have our home network and we have various devices like Laptop, Mobile Phones, Apple Watch, Apple Tv and in the middle we have a central device (Switch/Router) and all these devices are connected to the central router either through Wifi card or ethernet cable.
      2. It has a disadvantage that if ROuter/central device fails, everything will fail.
      3. It is very easy to expand and it is aalso cheap to set up.
      4. This is generally used in Home networks as it is very easy to set up.
    8. Mesh Topology

      1. In case of Mesh Topology, each device is connected to every other device.
      2. This is usually a preffered setup in case of MAN and WAN type of networks.
      3. Mesh topology sometimes becomes very complicated.
  6. OSI Model

    1. Application Layer - Firefox/Chrome/Email - Closest to the user.
    2. Presentation Layer - Operating System/Letters and Numbers computers can understand.
    3. Session Layer - Setting up connection between 2 computers
    4. Transport Layer - Ensures that Packets are delivered reliably (Packets of data)
    5. Network Layer - Determine the best route for the data - It determines the most reliable route - Routers are involved at this layer
    6. Data Link Layer - Error checking/Sending to NIC or a particular computer
    7. Physical Layer - This is just like a physical media like ethernet cable/Fible optic cable/Radio waves.
  7. Network Hardware

    1. Modem - Modem basically stands for Modulator Demodulator, Model is basically a device that converts signal from analog to digital while it receives signal from the ISP and converts from digital to analog while it receives signal from the router.

    2. Router - Router is basically a device to which various devices connect either using Ethernet cable or using Wifi cards. Router is the main gateway for us to connect with the ISP's network.

    3. Switch - Switch is basically a device to which we can connect more devices. For example - We take a cable out from the router and connect it to the switch. And then various devices connect to the switch

    4. Repeater - Repeater is basically a device which is used to strengthen a WiFi signal. Usually switches have built in repeaters.

  8. IP Address & Subnets:

    1. IP address is basically a unique address that identifies a computer on the internet.

    2. An IP address has 2 parts, Host Address and the Network Address. Network Address is basically the address of the router and the Host Address is the address of the Host inside the network.

    3. IP : 169.174.141.10 Subnet : 255.255.255.240 /28

      Basically the part till where we have 1 for both IP and subet, we take that as the IP address and the remaining part as the HOST Address. 2 Hosts are reserved -> 0, for the network and the ending one for broadcast.

    4. The notation in which IP addresses are denoted is called as CIDR Notation. 169.174.141.10/28 -> This is the way we represent it to get the Network and the Host ID part.

  9. Working with a cloud server

    1. ssh [email protected] and then password
    2. sudo adduser raghav
    3. To add this to the root group - sudo gpasswd -a raghav sudo
  10. DHCP - Dynamic Host Configuration Protocol

    1. DHCP is basically responsible for assigning and deassigning IP addresses. DHCP is built into most of the routers.
    2. I have 2 computers connected to the router and now i get a 3rd Computer, so it needs to have an IP address when connected to internet.
    3. The new computer sends a broadcast message called DHCP Discover. When Routers hear this message and it sends a DHCP Offer giving an IP address (This is sent over broadcast too)
    4. Then the new computer sends a DHCP request saying this looks good, can i get it please ?
    5. The router will send an ACK (Acknowledgement) saying this is yours now along with some other information as well.
    6. DHCP also takes care of freeing up the IP addresses whenever a computer leaves the network.
  11. DNS (Domain Name System Server)

    1. Whenever we type https://www.mraghav.tech , my computer is going to connect to a special server called the DNS Server that has a mapping of domain names and IP addresses. The DNS server returns the IP address of the mraghav.tech's server and then the browser sets up a TCP connection with my website.

    2. Go inside etc folder on linux and we will find a hosts file, there we can actually map some domains to url for our local computer.

    3. There 127.0.0.1 -> is mapped to our localhost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment