👨‍💻
Guide
Laura's GithubSimon's Github
  • What is this gitbook for?
  • 🛠️Useful tools
    • 🏁Header files
    • 🧱C Structures
    • 🔗Linked Lists (todo)
    • 📄Makefiles
    • 🔄Switch statement
    • 🗃️File descriptors (FD)
  • 🖌️MiniLibX
    • MiniLibX Helper Function
    • MiniLibX Hook Examples
  • 0️⃣ Rank 00
    • Libft
      • 📑LIBC functions
        • ft_isalpha
        • ft_isdigit
        • ft_isalnum
        • ft_isascii
        • ft_isprint
        • ft_strlen
        • ft_memset
        • ft_bzero
        • ft_memcpy
        • ft_memmove
        • ft_strlcpy
        • ft_strlcat
        • ft_toupper
        • ft_tolower
        • ft_strchr
        • ft_strrchr
        • ft_strncmp
        • ft_memchr
        • ft_memcmp
        • ft_strnstr
        • ft_atoi
        • ft_calloc
        • ft_strdup
      • 📑Additional functions
        • ft_substr
        • ft_strjoin
        • ft_strtrim
        • ft_split
        • ft_itoa
        • ft_strmapi
        • ft_striteri
        • ft_putchar_fd
        • ft_putstr_fd
        • ft_putendl_fd
        • ft_putnbr_fd
      • 📑Bonus functions
        • ft_lstnew
        • ft_lstadd_front
        • ft_lstsize
        • ft_lstlast
        • ft_lstadd_back
        • ft_lstdelone
        • ft_lstclear
        • ft_lstiter
        • ft_lstmap
  • 1️⃣ Rank 01
    • Born2beRoot
      • 📠What's a virtual machine ?
      • 📠Install your virtual machine
      • 📠P2P Evaluation - Questions
    • ft_printf
      • ▪️Variadic functions
      • ▪️Building the thing
    • get_next_line
      • ▪️open() & read()
      • ▪️Static variables
      • ▪️Building the thing
      • ▪️Commented solution
  • 2️⃣ Rank 02
    • so_long
      • ▪️Understand so_long
      • ▪️Core concepts
      • ▪️Building the thing
    • pipex
      • ▪️Understand pipex
      • ▪️Functions used
      • ▪️Building the thing
    • minitalk
      • ▪️Understand minitalk
      • ▪️Functions used
      • ▪️Building the thing
    • push_swap
      • ▪️Algorithms
      • ◾Building the thing
    • FdF
      • 🗡️Understand FdF
      • 🗡️Graphics programming
      • 🗡️Building the thing
  • 3️⃣ RANK 03
    • Philosophers
      • ▪️Understand Philosophers
      • ▪️Functions used
      • ▪️Building the thing
    • Minishell
      • ▪️Understand Minishell
      • ▪️Functions
      • ◾Building the thing
  • 4️⃣ RANK 04
    • CPP (00 - 04) (doing)
      • CPP00
      • CPP01
      • CPP02
      • CPP03
      • CPP04 (doing)
    • NetPractice
      • Theory
      • Level 1 & 2
    • MiniRT
      • Understand MiniRT
      • Building the thing
  • 5️⃣ RANK 05
    • CPP (05-09) (to-do)
      • CPP05
      • CPP06 (to-do)
      • CPP07
      • CPP08 (to-do)
      • CPP09 (to-do)
    • Inception (doing)
      • 🕓The basics (Docker, Images, etc...)
      • Project Files
    • webserv (to-do)
  • 6️⃣ rank 06
    • ft_transcendence (to-do)
  • 🛂Exams
    • Exam Rank 02
      • Level 1
        • first_word
        • fizz_buzz
        • *ft_putstr
        • *ft_strcpy
        • *ft_strlen
        • ft_swap
        • repeat_alpha
        • rev_print
        • rot_13
        • rotone
        • search_and_replace
        • ulstr
      • Level 2
        • alpha_mirror
        • camel_to_snake
        • do_op
        • *ft_atoi
        • *ft_strcmp
        • ft_strcspn
        • ft_strspn
        • *ft_strdup
        • ft_strpbrk
        • ft_strrev
        • inter
        • last_word
        • ft_is_power_2
        • max
        • print_bits
        • reverse_bits
        • wdmatch
        • swap_bits
        • union
        • snake_to_camel
      • Level 3
        • add_prime_sum
        • epur_str
        • expand_str
        • ft_atoi_base
        • ft_list_size
        • ft_range
        • ft_rrange
        • hidenp
        • lcm
        • paramsum
        • pgcd
        • print_hex
        • rstr_capitalizer
        • str_capitalizer
        • tab_mult
      • Level 4
        • flood_fil
        • fprime
        • ft_split
        • ft_itoa
        • ft_list_foreach
        • ft_list_remove
        • rev_wstr
        • rotstring
        • sort_int_tab
        • sort_list
    • Exam Rank 03
    • Exam Rank 04
    • Exam Rank 05
      • Module 0
  • 👥Team
Powered by GitBook
On this page
  • TCP : Transmission Control Protocol
  • IP : Internet Protocol
  • Private Networks
  • Loopback Addresses
  • TCP/IP
  • Masks (subnet masks)
  • Switches

Was this helpful?

  1. 4️⃣ RANK 04
  2. NetPractice

Theory

Before we begin, we need to understand three important concepts: the TCP (Transmission Control Protocol), the IP and the TCP/IP

TCP : Transmission Control Protocol

It ensures reliable data transfer by breaking information into small packets, sending them across the network, and ensuring they arrive in the correct order at the destination.

It also handles error correction and congestion control, thus ensuring reliable data transmission.

IP : Internet Protocol

For this project we only use IPv4 (so i will not explain IPv6) : An IPv4-adress is a 32-bit number divided into 4 "blocks", each 8 bits. i.e.:

Every device connected to the Internet is assigned a unique IP address, which is used to identify and locate it. It is responsible for addressing and routing data packets across the network.

An IP address is made up of two parts:

  • one identifies the host, such as a computer or other device

  • the other identifies the network to which it belongs.

--> TCP/IP uses a subnet mask to separate the two (corresponds to the "mask" part under each device when doing an exercise)

For example if the IP is 104.95.23.12, then the real representation in bits would be: 01101000.01011111.00010111.00001100 (the numbers can only go from 0 to 255).

Private Networks

  • Private network IP address ranges are reserved for internal use within organizations or home/small office networks.

  • The following address ranges are reserved for private networks:

    • 10.0.0.0 - 10.255.255.255

    • 172.16.0.0 - 172.31.255.255

    • 192.168.0.0 - 192.168.255.255

  • These ranges provide a large number of available IP addresses for private network infrastructure, allowing organizations to assign unique addresses to devices within their network without requiring public IP addresses.

Loopback Addresses

  • The loopback address range is reserved for internal testing and communication within a device.

  • The loopback IP range is represented by 127.0.0.0 - 127.255.255.255.

  • The loopback address 127.0.0.1, often referred to as "localhost," is used to access the device itself. It allows network applications running on the device to communicate with each other without accessing the external network.

These reserved IP address ranges ensure that private networks can operate without conflicting with public IP addresses on the internet and provide convenient mechanisms for internal testing and communication within devices.

There is some more special ip-ranges, but for this project, you only need to remember those above.

TCP/IP

Together, TCP and IP provide a standardized and reliable means of transferring data between devices connected to the Internet, whether it's sending emails, browsing the web, downloading files, or streaming multimedia content.

I recommend you to watch this small video (5min) just to understand better how everything works.

And here is a little scheme that shows how everything works:

Masks (subnet masks)

A subnet mask, also known as subnetting mask or network mask, is a combination of bits used to divide an IP network into smaller subnets. It is used in conjunction with an IP address to determine the network address and the host address of a device on a network.

A subnet mask defines the portion of the IP address that represents the network and the portion that represents the hosts within that network.

--> It is often represented as a series of numbers, typically in the form of four octets separated by periods, such as 255.255.255.0. And as for IPs, we can represent this number in bits, which would give: 11111111.11111111.11111111.00000000

Through which 255.255.255.0 is a valid mask and 255.255.128.128 is not a valid mask.

CIDR

Dot-decimal

Number of IP-addresses per subnet

Usable IP-addresses per subnet

Number of subnets

/32

255.255.255.255

1

0

256

/31

255.255.255.254

2

0

128

/30

255.255.255.252

4

2

64

/29

255.255.255.248

8

6

32

/28

255.255.255.240

16

14

16

/27

255.255.255.224

32

30

8

/26

255.255.255.192

64

62

4

/25

255.255.255.128

128

126

2

/24

255.255.255.0

256

254

1

----------------------------------------------------------------------------

Switches

A switch is a networking device that allows you to connect multiple devices to the same network. Its main function is to receive incoming network packets and forward them to the appropriate destination device within its network.

Imagine you have a network with multiple computers, printers, and other devices. Instead of connecting each device directly to the router or modem, you can connect them to a switch. The switch acts as a central point of connection, allowing devices to communicate with each other.

When a device sends a data packet, such as a file or a request for information, the switch receives the packet and examines its destination address. Based on this information, the switch determines the appropriate port to which the packet should be forwarded. This ensures that the packet reaches the intended device and not unnecessary devices on the network.

By using a switch, you can efficiently distribute network traffic and enable communication between devices. It helps to reduce network congestion and improve overall network performance.

To see a working example, you can take a look at Level 3.

Now that you know almost all the definitions, let's take a look at a few examples to help you get the hang of it! Click on the next page :)

PreviousNetPracticeNextLevel 1 & 2

Last updated 1 year ago

Was this helpful?

Source:
https://www.internalpointers.com/post/introduction-tcp-ip-protocol
TCP/IP in a nutshell