💻
Cheet Sheets
  • 🦁Başlarken
  • 🟧DevOps Pre-Requisite
    • ❤️Why Linux? | Linux Basics #1
    • 💛Vi Editor | Linux Basics #2
    • 💙Basics Commands | Linux Basics #3
    • 🧡Package Managers | Linux Basics #4
    • 💚Services | Linux Basics #5
    • 💛Networking Basics
    • 🤎DNS Basics
    • 🩶Applications Basics
    • 🟨Java introduction
    • 🟩NodeJS Introduction
    • 🟦Python Introduction
    • 🟪GIT Introduction
    • 🟧Apache Web Server Introduction
    • ⬛Apache Tomcat
    • 🟫Python Flask
    • 🟥Node.js Express App
    • 🟨Databases
    • 🟩MySQL
    • 🟪MongoDB
    • 🟨SSL & TLS
    • 🟦YAML & JSON - JSON Path
    • ⬛Labs Resources
  • 🍎Kubernetes
    • 🍏Kubernetes: Nedir ?
    • 🍒Bileşenler
    • 🍵Kubectl ve Versiyon
    • ❤️Pod
    • 🏷️Label ve Selector
    • 🔎Annotation
    • 📲Namespaces
    • 📦Deployments
    • 🔁ReplicaSet
    • 🔙Rollout & Rollback
    • 🌐Networking - 1
    • 🌏Service
    • 🛠️Liveness Probe & Readiness Probe
    • 🥐Resource Limits
    • 💰Environment Variables
    • 📃Ephemeral Volumes
    • 🔑Secrets
    • 🌂ConfigMap
    • 🖥️Node Affinity
    • 🔌Pod Affinity
    • ✍️Taint and Toleration
    • 🔦DaemonSet
    • 🧀PV/PVC
    • 🌜Storage Class
    • 🗿StatefulSet
    • 🕹️Job & Cronjob
    • 🔐Authentication
    • 📏Role-based access control (RBAC)
    • 🈷️Service Account
    • 📈Ingress
    • 📂ImagePullPolicy & ImageSecret
    • 📖Static Pods
    • 🌐Network Policy
    • 🫐Helm Nedir?
    • 📽️Prometheus Stack - Monitoring
    • 💼EFK Stack - Monitoring
    • 🥳CRD & Operator
  • 🧑‍⚕️GIT & GITHUB
    • 👉Girizgah
    • 🌴Branch
    • 🤝Merge
    • 🤔Conflict - Rebase
    • 🇸🇴Alias
    • 🛑Gitignore
    • 🥢Diff
    • ◀️Checkout
    • 🔦Stash
    • 👉Other
  • ☁️AWS
    • 🪣S3
    • 🚙EC2
    • ⚖️ELB
    • 🤝Auto Scaling
    • 🗄️EFS
    • 🔐VPC
    • 🎆CloudFront
    • ❤️Route53
    • 🦈RDS
    • 🏢ElastiCache
    • 🔭CloudWatch
    • 👀CloudTrail
    • 📃CloudFormation
    • 🔕SNS
    • 📬SQS
    • 🎇SWF
    • 📧SES
    • 📦Kinesis
    • 📐AWSConfig
    • 👩‍🏭OpsWork
    • 🚀Lambda - Api Gateway
    • 📌ECS - EKS
    • 🔑KMS
    • 📂Directory Service
    • 🏐Snowball
    • 💾Storage Gateway
    • 💽Volume Gateway
    • 📼Tape Gateway
    • 🏠Organizations
    • 🔙Backup-Transfer-CloudShell
    • 🆔IAM
    • 📀DataSync
    • 🗃️FSx
    • 🎒Aurora Serverless
    • 🌐Global Accelerator
    • 💪HPC
    • 🎰Outposts
    • 🗼Others
  • 👨‍🔬Ansible
    • 👉Girizhah
    • 📔YAML
    • ⚙️Komponentler
    • 🎒Inventory
    • 🏑ad-hoc
    • ▶️Playbook
  • 👨‍⚕️PROMETHEUS
    • 📈Terminoloji
    • 🦯Ubuntu 20.04 Prometheus Kurulum
    • 🗒️prometheus.yml dosyasına ilk bakış:
    • 🧭promQL up query
    • 📇Exporters
    • 🔦promQL Data Types
    • 🦯Selectors & Matchers
    • 🔢Binary Operators
    • 💀ignoring and on
    • ✍️Aggregation Operators
    • 🧠Functions
    • 🖊️Alıştırma
    • 💻Client Libraries
    • 🐍Examining the data of our Python application
    • 🐐Examining the data of our GO application
    • ⏺️Recording Rules
    • 💡rate functions
    • ⏰Alerting
    • ⌚Alert Routing
    • ⏰Slack integration with Prometheus
    • 🤯PagerDuty integration with Prometheus
    • ◼️BlackBox exporter
    • 📍Push Gateway
    • 🪒Service Discovery
    • 🧊kube cadvisor with external prometheus
    • 👉aws with prometheus
    • ☁️CloudWatch Exporter
    • 👨‍🚒mysql exporter
    • 🛃Custom exporter with Python
    • ⚙️Prometheus with HTTP API
    • 🤖Prometheus Federation For Kubernetes
    • 📺Grafana
    • ⁉️Prometheus: Ne zaman kullanılmalı? Ne zaman kullanılmamalıdır?
  • 🍪Sheets
    • 🛳️Docker Sheets
    • 🐐Kube Sheets
  • 🔢12 Factor APP
    • 🏗️Introduction
    • 1️⃣Codebase
    • 2️⃣Dependencies
    • 3️⃣Concurrency
    • 4️⃣Processes
    • 5️⃣Backing Services
    • 6️⃣Config
    • 7️⃣Build, release, run
    • 8️⃣Port binding
    • 9️⃣Disposability
    • 🔟Dev/prod parity
    • 🕚Logs
    • 🕛Admin processes
  • ☁️Azure 104
    • 👨‍👨‍👧‍👧Azure Active Directory ( Entra ID )
    • 💰Subscriptions
    • 🌎Virtual Network (VNET)
    • 💻Virtual Machines
    • 🧑‍🌾Load Balancing
    • 🥍Network Advanced
    • 🪡Automating Deployment and Configuration
    • 💂Securing Storage
    • 📓Administering Azure Blobs and Azure Files
    • 🔧Managing Storage
    • 🎁App Service
    • 🛳️Azure Container
    • 🥇Backup And Recovery
    • 🪐Network Watcher
    • ⏰Resource Monitoring And Alerts
  • ⛅AZURE 305
    • 🆔identity and access management
    • 💼Desing Azure AD (Entra ID)
    • 👨‍💼Desing for Azure B2B
    • 🛃Desing for Azure B2C
    • 💳Design for MFA and Conditional Access
    • ⛑️Design for Identity Protection
    • 🚶Access Reviews
    • 🚦Managed identity Demostration
    • 🔐Key Vault Demostration
    • 👑Governance hierarchy
    • 💠Design for Management Groups
    • 🔑Desing for Subscriptions
    • 🍇Desing for resource groups
    • 📟Design for resource tags
    • 🚷Azure Policy & RBAC
    • 🫐Desing For Blueprints
    • 🪡Desing for Virtual Networks
    • 🛫Design for on-premises connectivity to Azure
    • 🔽Design for network connectivity
    • 📦Design for application delivery
    • 🥞Design for network security and application protection
    • 📕Choose a compute solution
    • 🌊Design for virtual machines
    • 🔋Azure Batch Demostration
    • 🛰️Design for Azure App Service
    • ⛲Design for Azure Container Instances
    • 🎢Design for Azure Kubernetes Service
    • 📠Azure Functions Demostration
    • 💪Azure Logic Apps Demostration
    • 🧑‍💼Design for data storage
    • 🎞️Design for Azure storage accounts
    • 🌟Choose the storage replication
    • 📹Azure blob storage - Lifecycle & immutable demo
    • 🥌Azure Files Demostration
    • 🕸️Design Azure disks
    • 🦼Design for storage security
    • 🔮Azure Table Storage And Cosmos DB Demostration
    • 🟧Azure SQL Solutions
    • 🎡Azure SQL Database - Purchasing models
    • 🕯️Database availability
    • 📜Data security strategy
    • 🧮Azure SQL Edge
    • 🚲Azure Data Factory
    • 🔅Azure Data Lake Storage
    • 🧘‍♂️Azure Databricks
    • 🎒Azure Synapse Analytics
    • 🅰️Azure Stream Analytics
    • 📼Data flow strategy
    • 🍥Cloud Adoption Framework
    • ☣️Azure Migration Framework
    • 🦿Assessing workloads
    • 🪡Migration tools
    • 🤖Azure Database migration
    • 👥Storage migration
    • 👜Azure Backup
    • ⏲️Azure Blob Backup and Recovery
    • 💈Azure files backup and recovery
    • 🎞️Azure VM backup and recovery
    • 🧺Azure SQL backup and recovery
    • ⏰Azure Site Recovery
    • 📩Differentiate event and message
    • ✈️Azure messaging solutions
    • 🚜Event Hub
    • 🥍Application optimization solution
    • 🎁Application lifecycle
    • 📺Azure Monitor
    • 🅱️Log Analytics
    • 👥Azure workbooks and Insights
    • 🚌Azure Data Explorer
  • Github Actions
    • Github Actions Nedir?
    • Workflow & Schedule Triggers
    • Single and Multiple Events
    • Manuel Events
    • Webhook Events
    • Conditional Keywords For Steps
    • Expressions - 1
    • Expressions - 2
    • Runners
    • Workflow Commands
    • Workflow Context
    • Dependent Jobs
    • Encrypted Secrets
    • Configuration Variables
    • Default & Custom Env Varb
    • Set Env Varb with Workflow Commands
    • Github Token Secret
    • Add Script to workflow
    • Push Package #1
    • Push Package #2 Docker
    • Service Containers
    • Routing workflow to runner
    • CodeQL Step
    • Caching Package and Dependency Files
    • Remove workflow Artifact
    • Workflow Status Badge
    • Env Protection
    • Job Matrix Configuration
    • Disable & Delete Workflows
    • Actions type for Action
    • Inputs and Outputs for actions
    • Action Versions
    • Files and Directories for Actions
    • Exit Codes
    • Reusable Workflow & Reuse Templates for Actions and Workflows
    • Configure Self Hosted Runners for Enterprise
  • Loki
    • What is Loki?
    • Architecture of Loki
    • Install Loki For Ubuntu
    • Install Promtail For Ubuntu
    • Querying Logs
    • Loki in Kubernetes
    • Deploying Loki in Kubernetes
    • Connecting to Grafana
    • Viewing Kubernetes logs
    • Promtail Customize & Pipeline
  • Ansible
    • Ansible Introduction
    • Introduction to Ansible Configuration Files
    • Ansible Inventory
    • Inventory Formats
    • Ansible Variables
    • Variable Types
    • Registering Variables and Variable Precedence
    • Variable Scoping
    • Magic Variables
    • Ansible Facts
    • Ansible Playbooks
    • Verifying Playbooks
    • Ansible lint
    • Ansible Conditionals
    • Ansible Conditionals based on facts, variables, re-use
    • Ansible Loops
    • Ansible Modules
    • Introduction to Ansible Plugins
    • Modules and Plugins Index
    • Introduction to Handlers
    • Ansible Roles
    • Ansible Collections
    • Introduction to Templating
    • Jinja2 Templates for Dynamic Configs
  • 🅰️Ansible Advanced
    • Playbook run options
    • Facts
    • Configuration files
Powered by GitBook
On this page
  • Switch ve Ağ İletişimi:
  • Router Nedir?
  • Gateway Nedir?
  • Default Gateway Nedir?

Was this helpful?

  1. DevOps Pre-Requisite

Networking Basics

PreviousServices | Linux Basics #5NextDNS Basics

Last updated 11 months ago

Was this helpful?

Switch ve Ağ İletişimi:

Bir switch, ağdaki cihazların (bilgisayarlar, sunucular vb.) birbirleriyle iletişim kurmasına olanak sağlayan bir ağ cihazıdır. Switch, gelen veri paketlerini doğru hedefe yönlendirir, bu sayede cihazlar arasında iletişim sağlanır.

  • Cihaz A:

    • IP adresi: 192.168.1.10

    • Ağ arayüzü: eth0

  • Cihaz B:

    • IP adresi: 192.168.1.11

    • Ağ arayüzü: eth0

  • Switch:

    • Her iki cihazı (A ve B) birbirine bağlayan bir ağ cihazı.

Ağ Arayüzünün durumunu kontrol etmek,

ip link
# Açıklama: Bu komut, ağ arayüzlerinin durumunu gösterir.
# Çıktı Örneği:
# eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
# Bu çıktı, eth0 arayüzünün aktif (UP) olduğunu gösterir.

IP Adresi Ekleme (Cihaz A)

ip addr add 192.168.1.10/24 dev eth0
# Açıklama: Bu komut, eth0 arayüzüne 192.168.1.10 IP adresini ekler.

IP Adresi Ekleme (Cihaz B)

ip addr add 192.168.1.11/24 dev eth0
# Açıklama: Bu komut, eth0 arayüzüne 192.168.1.11 IP adresini ekler.

İki Cihaz Arasında Ping Testi

ping 192.168.1.11
# Açıklama: Cihaz A'dan Cihaz B'ye ping atarak bağlantının aktif olup olmadığını test eder.
# Çıktı Örneği:
# Reply from 192.168.1.11: bytes=32 time=4ms TTL=117
# Bu çıktı, Cihaz A'dan Cihaz B'ye veri paketlerinin başarıyla ulaştığını gösterir.

Özetle,

  1. ip link komutları ile her iki cihazda ağ arayüzlerinin aktif olduğunu kontrol ettik.

  2. ip addr add komutları ile her iki cihaza IP adresleri atadık.

  3. ping komutu ile Cihaz A'dan Cihaz B'ye veri göndererek bağlantıyı test ettik.

Router Nedir?

Router, iki veya daha fazla farklı ağı (subnet) birbirine bağlayan bir ağ cihazıdır. Router, paketleri bir ağdan diğerine yönlendirir ve bu sayede ağlar arasında veri iletişimi sağlar.

Ağ Yapısı:

  • Ağ A (Subnet 1):

    • Cihaz A: IP 192.168.1.10

    • Cihaz B: IP 192.168.1.11

    • Router'ın Ağ A tarafındaki IP'si: 192.168.1.1

  • Ağ B (Subnet 2):

    • Cihaz C: IP 192.168.2.10

    • Cihaz D: IP 192.168.2.11

    • Router'ın Ağ B tarafındaki IP'si: 192.168.2.1

  • Router, IP adreslerini kullanarak paketlerin hedefe ulaşmasını sağlar. IP paketlerinin hedef adresine bakarak uygun ağ arayüzüne yönlendirir.

  • Farklı subnet'ler arasındaki bağlantıyı sağlar ve bu ağlar arasında veri iletimine olanak tanır.

  • Router, kendisine gelen veri paketlerini hedef ağın IP adresine göre ilgili ağ arayüzüne iletir.

Router'ın IP Adreslerini Atama:

Ağ A tarafı (192.168.1.1)

ip addr add 192.168.1.1/24 dev eth0

Ağ B tarafı (192.168.2.1)

ip addr add 192.168.2.1/24 dev eth1

Yönlendirme Tablolarını Yapılandırma:

Cihaz A ve Cihaz B için Router'a Yönlendirme Ekleme

ip route add 192.168.2.0/24 via 192.168.1.1

Cihaz C ve Cihaz D için Router'a Yönlendirme Ekleme

ip route add 192.168.1.0/24 via 192.168.2.1

Bu yapılandırma ile, Ağ A'daki cihazlar (192.168.1.0/24) ve Ağ B'deki cihazlar (192.168.2.0/24) bir router aracılığıyla birbirleriyle iletişim kurabilirler. Router, bu iki ağ arasında veri paketlerini yönlendirir ve doğru hedefe ulaşmalarını sağlar. Bu sayede, iki farklı subnet'teki cihazlar arasında veri alışverişi yapılabilir.

Gateway Nedir?

Gateway, bir ağdan, diğerine veri paketlerinin geçişini sağlayan ağ geçididir. İki farklı ağ arasındaki veri trafiğini yönetir.

Default Gateway Nedir?

Default Gateway, bir cihazın hedefe ulaşamayan veri paketlerini yönlendirdiği varsayılan ağ geçididir. Başka bir deyişle, bir cihaz başka bir ağa veri göndermek istediğinde, IP yönlendirme tablosunda bir yol bulamazsa, veri paketlerini default gateway'e gönderir.

Cihaz A'da Default Gateway Ayarlama:

ip route add default via 192.168.1.1
# Açıklama: Cihaz A için default gateway'i 192.168.1.1 olarak ayarlar.

Cihaz B'de Default Gateway Ayarlama:

ip route add default via 192.168.2.1
# Açıklama: Cihaz B için default gateway'i 192.168.2.1 olarak ayarlar.
  • Cihaz A, 192.168.1.0/24 ağında olmayan bir hedefe veri göndermek istediğinde (örneğin, 192.168.2.10), bu veri paketi default gateway (192.168.1.1) üzerinden yönlendirilir.

  • Router (192.168.1.1), bu paketi alır ve uygun arayüze (192.168.2.1) yönlendirir.

  • Paket, sonunda 192.168.2.10 adresine ulaşır.

Routing Examples,

Durum,

  • Cihaz A: IP 192.168.1.5

  • Cihaz B:

    • eth0: 192.168.1.6

    • eth1: 192.168.2.6

  • Cihaz C: IP 192.168.2.5

Cihaz A ve C farklı subnet'lerde bulunuyor ve Cihaz B bu iki subnet arasında bir router görevi görüyor.

Sorun:

  • Cihaz A'dan Cihaz C'ye Ping: İlk denemede Network is unreachable hatası alınıyor.

ping 192.168.2.5
# Çıktı: Connect: Network is unreachable

Çözüm:

  • Cihaz A'ya 192.168.2.0/24 ağına nasıl ulaşacağını söyleyen bir route ekliyoruz.

ip route add 192.168.2.0/24 via 192.168.1.6

Cihaz B'nin iki farklı subnet'i (192.168.1.0/24 ve 192.168.2.0/24) birbirine bağlaması ve paket yönlendirmesi için IP forwarding'in etkinleştirilmesi gerekmektedir. IP forwarding, bir cihazın iki farklı ağ arasındaki trafiği yönlendirmesini sağlar. Bu özellik etkinleştirildiğinde, cihaz bir router gibi davranır ve gelen paketleri uygun ağa iletir.

Cihaz B'de, IP Forwarding Durumunu Kontrol Etme,

cat /proc/sys/net/ipv4/ip_forward
# Çıktı: 0 (IP forwarding kapalı)

Cihaz B'de, IP Forwarding Etkinleştirme,

echo 1 > /proc/sys/net/ipv4/ip_forward
# IP forwarding etkinleştirilir

Cihaz B'de, Kalıcı Olarak IP Forwarding Ayarlama,

/etc/sysctl.conf dosyasına aşağıdaki satırı ekleyerek IP forwarding'in kalıcı olmasını sağlayabilirsiniz.

net.ipv4.ip_forward = 1

Cihaz A'dan Cihaz C'ye ping atarak bağlantının başarılı olduğunu kontrol edebiliriz.

ping 192.168.2.5
# Çıktı: Reply from 192.168.2.5: bytes=32 time=4ms TTL=117


Basic Networking Cheat Sheets,

# Ağ arayüzlerinin durumunu gösterir
ip link
# Çıktı: 
# 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
#    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
#    link/ether 00:15:5d:22:25:84 brd ff:ff:ff:ff:ff:ff

# Ağ arayüzlerine atanmış IP adreslerini gösterir
ip addr
# Çıktı:
# 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
#    inet 127.0.0.1/8 scope host lo
#       valid_lft forever preferred_lft forever
#    inet6 ::1/128 scope host
#       valid_lft forever preferred_lft forever
# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
#    inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic eth0
#       valid_lft 172737sec preferred_lft 172737sec
#    inet6 fe80::215:5dff:fe22:2584/64 scope link
#       valid_lft forever preferred_lft forever

# eth0 arayüzüne 192.168.1.10/24 IP adresini ekler
ip addr add 192.168.1.10/24 dev eth0

# Yönlendirme tablosunu görüntüler
ip route
# Çıktı:
# default via 192.168.1.1 dev eth0
# 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.10

# 192.168.1.0/24 ağına erişimi 192.168.2.1 IP adresi üzerinden sağlar
ip route add 192.168.1.0/24 via 192.168.2.1

# IP forwarding'in etkin olup olmadığını kontrol eder
cat /proc/sys/net/ipv4/ip_forward
# Çıktı: 
# 0 (IP forwarding kapalı)

# IP forwarding'i etkinleştirir
echo 1 > /proc/sys/net/ipv4/ip_forward

# IP forwarding'in etkinleştirildiğini kontrol eder
cat /proc/sys/net/ipv4/ip_forward
# Çıktı:
# 1 (IP forwarding etkin)

🟧
💛