🔏
Tech
  • 🟢App aspects
    • Software architecture
      • Caching
      • Anti-patterns
      • System X-ability
      • Coupling
      • Event driven architecture
        • Command Query Responsibility Segregation (CQRS)
        • Change Data Capture (CDC)
      • Distributed transactions
      • App dev notes
        • Architecture MVP
      • TEMP. Check list
      • Hexagonal arch
      • Communication
        • REST vs messaging
        • gRPC
        • WebSocket
      • Load balancers
      • Storage limits
      • Event storming
    • Authentication
    • Deployment strategy
  • Databases
    • Classification
    • DB migration tools
    • PostreSQL
    • Decision guidance
    • Index
      • Hash indexes
      • SSTable, LSM-Trees
      • B-Tree
      • Engines, internals
    • Performance
  • System design
    • Interview preparation
      • Plan
        • Instagram
        • Tinder
        • Digital wallet
        • Dropbox
        • Live video streaming
        • Uber
        • Whatsup
        • Tiktok
        • Twitter
        • Proximity service
    • Algorithms
    • Acronyms
  • 🟢Programming languages
    • Java
      • Features
        • Field hiding
        • HashCode() and Equals()
        • Reference types
        • Pass by value
        • Atomic variables
      • Types
      • IO / NIO
        • Java NIO
          • Buffer
          • Channel
        • Java IO: Streams
          • Input streams
            • BufferedInputStream
            • DataInputStream
            • ObjectInputStream
            • FilterInputStream
            • ByteArrayInputStream
        • Java IO: Pipes
        • Java IO: Byte & Char Arrays
        • Java IO: Input Parsing
          • PushbackReader
          • StreamTokenizer
          • LineNumberReader
          • PushbackInputStream
        • System.in, System.out, System.error
        • Java IO: Files
          • FileReader
          • FileWriter
          • FileOutputStream
          • FileInputStream
      • Multithreading
        • Thread liveness
        • False sharing
        • Actor model
        • Singleton
        • Future, CompletableFuture
        • Semaphore
      • Coursera: parallel programming
      • Coursera: concurrent programming
      • Serialization
      • JVM internals
      • Features track
        • Java 8
      • Distributed programming
      • Network
      • Patterns
        • Command
      • Garbage Collectors
        • GC Types
        • How GC works
        • Tools for GC
    • Kotlin
      • Scope functions
      • Inline value classes
      • Coroutines
      • Effective Kotlin
    • Javascript
      • Javascript vs Java
      • TypeScript
    • SQL
      • select for update
    • Python
      • __init.py__
  • OS components
    • Network
      • TCP/IP model
        • IP address in action
      • OSI model
  • 🟢Specifications
    • JAX-RS
    • REST
      • Multi part
  • 🟢Protocols
    • HTTP
    • OAuth 2.0
    • LDAP
    • SAML
  • 🟢Testing
    • Selenium anatomy
    • Testcafe
  • 🟢Tools
    • JDBC
      • Connection pool
    • Gradle
    • vim
    • git
    • IntelliJ Idea
    • Elastic search
    • Docker
    • Terraform
    • CDK
    • Argo CD
      • app-of-app setup
    • OpenTelemetry
    • Prometheus
    • Kafka
      • Consumer lag
  • 🟢CI
    • CircleCi
  • 🟢Platforms
    • AWS
      • VPC
      • EC2
      • RDS
      • S3
      • IAM
      • CloudWatch
      • CloudTrail
      • ELB
      • SNS
      • Route 53
      • CloudFront
      • Athena
      • EKS
    • Kubernetes
      • Networking
      • RBAC
      • Architecture
      • Pod
        • Resources
      • How to try
      • Kubectl
      • Service
      • Tooling
        • ArgoCD
        • Helm
        • Istio
    • GraalVM
    • Node.js
    • Camunda
      • Service tasks
      • Transactions
      • Performance
      • How it executes
  • 🟢Frameworks
    • Hibernate
      • JPA vs Spring Data
    • Micronaut
    • Spring
      • Security
      • JDBC, JPA, Hibernate
      • Transactions
      • Servlet containers, clients
  • 🟢Awesome
    • Нейробиология
    • Backend
      • System design
    • DevOps
    • Data
    • AI
    • Frontend
    • Mobile
    • Testing
    • Mac
    • Books & courses
      • Path: Java Concurrency
    • Algorithms
      • Competitive programming
    • Processes
    • Finance
    • Electronics
  • 🟢Electronics
    • Arduino
    • IoT
  • Artificial intelligence
    • Artificial Intelligence (AI)
  • 🚀Performance
    • BE
  • 📘Computer science
    • Data structures
      • Array
      • String
      • LinkedList
      • Tree
    • Algorithms
      • HowTo algorithms for interview
  • 🕸️Web dev (Frontend)
    • Trends
    • Web (to change)
  • 📈Data science
    • Time series
Powered by GitBook
On this page
  • LAN
  • Subnet mask
  • CIDR (Classless inter-domain routing)
  • DHCP (Dynamic IP addressing)
  • DHCP relay

Was this helpful?

  1. OS components
  2. Network
  3. TCP/IP model

IP address in action

PreviousTCP/IP modelNextOSI model

Last updated 1 year ago

Was this helpful?

LAN

  • Network ID = 202.120.10.0

  • Host ID = e.g. 42, or 164 (in this case)

  • IP = Network ID + Host ID

In order to interconnect LANs we need a router (interconnection happens through router).

The router interface that connects LAN to the router is called default gateway

  • must have same Network ID

  • usually has the lowest host address in LAN

  • in above case it will have IP 202.120.10.1

Ranges of addresses that are designed as private IP addresses:

127.0.0.0/8 subnet is reserved as loopback address

Subnet mask

Every TCP/IP host needs to know whether the destination IP is local or long distance. Subnet mask helps here.

Short notation for subnet masks:

  • 11111111.11111111.11111111.00000000 = /24 (24 ones)

  • 11111111.11111111.00000000.00000000 = /16 (16 ones)

Below picture shows how Subnet mask helps to understand that Computer A and B are in the same LAN.

If we need to send a request to another LAN:

  • send ARP request to realise MAC address of default gateway

  • IP packet will be sent to default gateway

CIDR (Classless inter-domain routing)

CIDR and subnetting are virtually the same thing.

Subnetting enables much more efficient use of IP addresses compared to class blocks.

example of subnet calculation

there is a cafe with network ID 192.168.4.0/24 and you need to split it to subnets.

  • start with a given subnet mask and mote it to the right until you have a number of subnets you need

  • forget the dots (never try to subnet without first converting to binary)

How many hosts we have on /24 subnet? 2^8 - 2 = 254

How many hosts we have on /26 subnet? 32 digits - 26 = 6 => you have 6 zeroes left after 26 ones => 2^6 - 2 = 62 hosts.

Original network ID: 192.168.4.0/24 translates to this binary (grey below):

By taking 2 more bits (red ones) for subnetting we can have 2^2 new subnets (we get 4 new Network ids).

DHCP (Dynamic IP addressing)

DORA (DHCP four-way handshake):

(Discover) [Client] -> {broadcast} -> is there DHCP server here
(Offer) [DHCP Server] -> [Client] : I am, here is your IP address, subnet mask, default gateway
(Request) [Client] -> [DHCP Server] : I am accepting your information
(Acknowledgmnet) [DHCP Server] -> [Client] : ok, I save you IP and MAC to my db

------ in around 5-6 days:
(Request) [Client] -> [DHCP Server] : can I use my setting?
(Acknowledgmnet) [DHCP Server] -> [Client] : I know you, I look up your data in db and give it back

Usually routers are blocking broadcasting traffic, but what if in big company there are many subnets and just one DHCP server for convenience =>

DHCP relay

DHCP relay enables DHCP traffic (broadcast) to cross routers.