Dasar Networking dan TCP/IP
Memahami fundamental networking adalah kunci untuk menjadi network administrator yang kompeten.
Model OSI
OSI (Open Systems Interconnection) model terdiri dari 7 layers:
| Layer | Nama | Fungsi |
|---|---|---|
| 7 | Application | Interface dengan user aplikasi |
| 6 | Presentation | Formatting, encryption, compression |
| 5 | Session | Manajemen komunikasi antar aplikasi |
| 4 | Transport | End-to-end delivery, reliable/unordered |
| 3 | Network | Routing, logical addressing |
| 2 | Data Link | Physical addressing, error detection |
| 1 | Physical | Transmisi data fisik (cable, signal) |
TCP/IP Stack
TCP/IP menggunakan 4 layers yang lebih sederhana:
- Application Layer - HTTP, FTP, SMTP, DNS
- Transport Layer - TCP, UDP
- Internet Layer - IP, ICMP, ARP
- Network Access Layer - Ethernet, Wi-Fi
IP Addressing
IPv4 Address Format
IPv4 address terdiri dari 32-bit, ditulis dalam 4 octet (0-255):
192.168.1.1
10.0.0.1
172.16.0.1
Kelas IP Address
| Kelas | Range IP | Default Subnet | Penggunaan |
|---|---|---|---|
| A | 1.0.0.0 - 126.255.255.255 | 255.0.0.0 | Large networks |
| B | 128.0.0.0 - 191.255.255.255 | 255.255.0.0 | Medium networks |
| C | 192.0.0.0 - 223.255.255.255 | 255.255.255.0 | Small networks |
| D | 224.0.0.0 - 239.255.255.255 | - | Multicast |
| E | 240.0.0.0 - 255.255.255.255 | - | Reserved |
IP Address Private
- Class A: 10.0.0.0 - 10.255.255.255
- Class B: 172.16.0.0 - 172.31.255.255
- Class C: 192.168.0.0 - 192.168.255.255
IP Address Khusus
- 127.0.0.1 - Loopback address (localhost)
- 0.0.0.0 - Default route
- 255.255.255.255 - Broadcast address
- 169.254.x.x - APIPA (Auto Configuration IP)
Subnetting
CIDR Notation
192.168.1.0/24 - 256 IP addresses
192.168.1.0/25 - 128 IP addresses
192.168.1.0/26 - 64 IP addresses
192.168.1.0/27 - 32 IP addresses
Cara Menghitung Subnet
Formula:
- Total IP = 2^(32 - subnet_bits)
- Usable IP = Total IP - 2 (network & broadcast)
- Subnet Mask = 255.255.255.(256 - 2^(32 - subnet_bits))
Contoh /26:
- Total IP = 2^6 = 64
- Usable IP = 62
- Subnet Mask = 255.255.255.192
Transport Layer Protocols
TCP (Transmission Control Protocol)
- Connection-oriented
- Reliable delivery
- Three-way handshake
- Flow control
- Error checking
- Contoh: HTTP, FTP, SMTP, SSH
Three-way Handshake:
- SYN (Client -> Server)
- SYN-ACK (Server -> Client)
- ACK (Client -> Server)
UDP (User Datagram Protocol)
- Connectionless
- Unreliable (tanpa guarantee)
- Faster than TCP
- No flow control
- Contoh: DNS, DHCP, VoIP, Gaming
Port Numbers
| Range | Nama | Contoh |
|---|---|---|
| 0-1023 | Well-known | HTTP(80), SSH(22), DNS(53) |
| 1024-49151 | Registered | MySQL(3306), RDP(3389) |
| 49152-65535 | Dynamic/Ephemeral | Random client ports |
Perintah Networking Dasar
Linux/Unix
ifconfig # Cek interface network (deprecated)
ip addr show # Cek interface network
ip route show # Tampilkan routing table
ping host.example.com # Tes koneksi
traceroute host # Trace path ke host
mtr host # Combines ping & traceroute
netstat -tulpn # Tampilkan listening ports
ss -tulpn # Modern netstat
nslookup domain.com # DNS lookup
dig domain.com # Advanced DNS lookup
Windows
ipconfig # Cek IP config
ipconfig /all # Detail IP config
ping host.example.com # Tes koneksi
tracert host # Trace path ke host
netstat -an # Tampilkan connections
nslookup domain.com # DNS lookup
ARP (Address Resolution Protocol)
ARP memetakan IP address ke MAC address.
# Lihat ARP table
arp -a
# Clear ARP cache
arp -d
DNS (Domain Name System)
DNS menerjemahkan domain name ke IP address.
Record Types
| Type | Fungsi | Contoh |
|---|---|---|
| A | IP address (IPv4) | example.com -> 192.0.2.1 |
| AAAA | IP address (IPv6) | example.com -> 2001:db8::1 |
| CNAME | Alias name | www.example.com -> example.com |
| MX | Mail server | example.com -> mail.example.com |
| TXT | Text record | SPF, DKIM, verification |
| NS | Name server | example.com -> ns1.example.com |
Tools
# Simple lookup
nslookup example.com
# Detailed lookup
dig example.com ANY
# Check MX record
dig example.com MX
# Reverse lookup
dig -x 192.0.2.1
Routing
Static Routing
# Linux
ip route add 192.168.2.0/24 via 192.168.1.254
# Windows
route add 192.168.2.0 mask 255.255.255.0 192.168.1.254
Default Gateway
# Set default gateway Linux
ip route add default via 192.168.1.1
# Set default gateway Windows
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1
Firewall Basics
iptables
# List rules
iptables -L -n -v
# Allow HTTP
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# Drop all other
iptables -A INPUT -j DROP
UFW (Ubuntu)
ufw allow 22/tcp
ufw allow 80/tcp
ufw enable
Network Troubleshooting
Checklist
- Cek kabel fisik
- Cek IP configuration
- Ping local gateway
- Ping external IP (8.8.8.8)
- Ping domain name
- Cek DNS settings
- Cek firewall rules
- Cek routing table
Common Commands
# Check interface
ip link show
# Check IP address
ip addr show
# Test connectivity
ping -c 4 8.8.8.8
# Trace route
traceroute 8.8.8.8
# Check DNS
nslookup google.com
# Check listening ports
ss -tulpn
# Check connections
netstat -an
Kesimpulan
Memahami fundamental networking adalah pondasi penting untuk karir di IT. Latih konsep-konsep di atas dengan praktik langsung menggunakan lab virtual atau hardware yang tersedia.