AWS · मराठी आवृत्ती
4.7 Network तपासण्याचे commands
Server चा problem की network चा? ss, curl आणि dig हे तीन tools रोज उपयोगी.
| Command | काम | उदाहरण |
|---|---|---|
| ip addr / ip a | Interfaces/IPs | ip -4 a |
| ip route | Routes/default gateway | ip r |
| ss -tulnp | Listening TCP/UDP आणि process | sudo ss -tlnp |
| netstat -tulnp | जुना पर्याय; net-tools | sudo netstat -tlnp |
| ping | ICMP reachability | ping -c 4 google.com |
| curl | HTTP/API test | curl -I http://localhost |
| wget | Download | wget https://wordpress.org/latest.tar.gz |
| dig / nslookup | DNS; dnsutils/bind-utils | dig +short example.com |
| traceroute / tracepath | दिसणारे route hops | tracepath google.com |
| nc | TCP connection test | nc -zv 10.0.1.25 3306 |
| hostnamectl | Hostname पहा/बदला | sudo hostnamectl set-hostname web01 |
sudo ss -tlnp # which programs listen on which ports?
sudo ss -tlnp | grep ':80 ' # is anything on port 80?
curl -I http://localhost # only response headers (HTTP status)
curl -s http://localhost:3000/api/health
curl -o page.html https://example.com
wget -q -O - https://checkip.amazonaws.com # print public IP
ping -c 3 8.8.8.8
Listening address चा अर्थ
0.0.0.0:80 म्हणजे सर्व IPv4 interfaces; *:80 चा address family सहित context तपासा. Route/firewall/SG योग्य असेल तर बाहेरून access शक्य. 127.0.0.1:3000 फक्त server वरून; reverse proxy मागच्या app साठी चांगलं.
Ping fail म्हणजे server down नाही. ICMP allowed नसू शकतो. Actual service वर curl/nc करा; गरज असल्यास फक्त स्वतःच्या IP मधून ICMP testing allow करा.
Tools install
# Ubuntu
sudo apt install -y net-tools dnsutils traceroute netcat-openbsd
# Amazon Linux 2023 / CentOS Stream 9
sudo yum install -y net-tools bind-utils traceroute nmap-ncat
Lab
EC2 वर ip -4 a, ip r, sudo ss -tlnp, curl -I http://localhost. Laptop वर nc -zv <PUBLIC_IP> 22. IP, default gateway, listening ports आणि HTTP status नोंदवा.