iklan

Jumat, 23 Mei 2025

Advanced Linux Networking Commands

 Here’s a deep dive into advanced Linux networking commands, tools, and techniques — ideal for sysadmins, devops, or security enthusiasts:


🧠 Advanced Linux Networking Commands


πŸ” 1. Interface & IP Configuration

  • ip (replaces ifconfig)

ip a                # Show IP addresses
ip link set eth0 up # Bring interface up
ip addr add 192.168.1.100/24 dev eth0
  • ethtool – View/set Ethernet device parameters

ethtool eth0
  • nmcli (NetworkManager CLI)

nmcli con show
nmcli device status

🌐 2. Network Diagnostics

  • ping, traceroute

ping -c 4 google.com
traceroute example.com
  • mtr (combines ping + traceroute)

mtr google.com
  • dig / nslookup – DNS lookups

dig +short mx gmail.com
nslookup google.com
  • host

host github.com

πŸ›°️ 3. Socket & Port Inspection

  • ss (modern replacement for netstat)

ss -tuln               # TCP/UDP listening ports
ss -s                  # Summary of connections
ss -p                  # Show PID of connected processes
  • lsof -i

lsof -i :443           # Show which process is using port 443
  • fuser

fuser -v 80/tcp        # Find process using port 80

πŸ“‘ 4. Scanning & Discovery

  • nmap – Network scanner

nmap -sS -Pn 192.168.1.0/24
nmap -A -T4 example.com
  • arp-scan

sudo arp-scan --interface=eth0 --localnet
  • tcpdump – Packet sniffer

tcpdump -i eth0 port 80
  • wireshark / tshark – Deep packet inspection (GUI/CLI)


πŸ”Œ 5. Connection Testing

  • nc (netcat)

nc -zv example.com 22
nc -lvp 1234           # Listen on port 1234
  • telnet

telnet smtp.gmail.com 587
  • curl / wget

curl -I https://example.com
wget --spider -S https://example.com

πŸ” 6. Secure File Transfer & Tunneling

  • ssh / scp / rsync

ssh user@host
scp file user@host:/dest/
rsync -avzP file user@host:/dest/
  • SSH Tunneling

ssh -L 8080:localhost:80 user@remote-host
  • Port forwarding with socat

socat TCP-LISTEN:1234,fork TCP:example.com:80

🧰 7. Network Configuration Files

  • /etc/network/interfaces (Debian-based)

  • /etc/sysconfig/network-scripts/ (RHEL-based)

  • /etc/hosts – Manual hostname mapping

  • /etc/resolv.conf – DNS resolver settings

  • /etc/nsswitch.conf – Name resolution order


πŸ“ˆ 8. Real-Time Monitoring

  • iftop / nethogs / bmon

sudo iftop -i eth0
sudo nethogs eth0
  • vnstat – Bandwidth usage statistics

  • iptraf-ng – Detailed traffic stats per interface


πŸ”„ 9. Custom Packet Crafting

  • hping3

hping3 -S -p 80 example.com
  • ncat – Part of Nmap, like netcat but more powerful

  • scapy (Python) – Scriptable packet generation


πŸ›‘️ 10. Firewall / NAT / VPN

  • iptables / nftables

iptables -L -n -v
  • ufw – Simple firewall (Ubuntu)

ufw allow 22/tcp
ufw enable
  • ip rule, ip route – Advanced routing

  • openvpn, wireguard – VPN tools



Tidak ada komentar:

Posting Komentar