Cyber Security · मराठी आवृत्ती
Networking तपासण्यासाठी Linux commands
या page मध्ये
IP, route, DNS आणि service port हे वेगवेगळे भाग आहेत. योग्य प्रश्नासाठी योग्य command निवडा.
| Command | उपयोग | Example |
|---|---|---|
ip addr (ip a) |
Interfaces आणि IP addresses | ip -4 a |
ip route |
Routing table आणि default gateway | ip r |
ss -tulnp |
Process सहित listening TCP/UDP ports | sudo ss -tlnp |
netstat -tulnp |
ss चा जुना पर्याय (net-tools package) | sudo netstat -tlnp |
ping |
ICMP reachability | ping -c 4 google.com |
curl |
HTTP client—website/API test | curl -I http://localhost |
wget |
Files download करणे | wget https://wordpress.org/latest.tar.gz |
dig / nslookup |
DNS lookup (bind-utils/dnsutils package) | dig +short example.com |
traceroute / tracepath |
Host पर्यंत path चे clues | tracepath google.com |
nc (netcat) |
TCP connect होतो का तपासणे | 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
ip addr interfaces/IPs, ip route routing/default gateway, ss -tulnp listening sockets आणि संबंधित processes दाखवतो. netstat जुना पर्याय आहे. ping ICMP reachability, curl HTTP/API test, wget download, dig/nslookup DNS, traceroute/tracepath path clues आणि nc -zv TCP connect check साठी वापरतात. hostnamectl hostname पाहतो/बदलतो.
ss output कसं वाचायचं?
0.0.0.0:80 म्हणजे सर्व local IPv4 interfaces वर listen. बाहेरून access मिळण्यासाठी routes, security group आणि इतर firewalls सुद्धा allow असायला हवेत. 127.0.0.1:3000 फक्त local loopback वर आहे—reverse proxy च्या मागच्या app साठी हे उपयोगी. *:80 दिसल्यास address family/output context तपासा.
EC2 ला ping होत नाही?
Security group/routing मध्ये ICMP allow नसेल तर ping fail होऊ शकतो. त्यावरून server बंद आहे असं ठरवू नका. प्रत्यक्ष service साठी curl किंवा nc वापरा. ICMP test हवी असेल तर trusted source IP पुरता योग्य rule द्या.
Missing 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
OS योग्य command वापरा. Ubuntu आणि Amazon Linux/CentOS-family मध्ये DNS/netcat package names वेगळी आहेत.
Security मध्ये उपयोग
Listening sockets ची local list संभाव्य entry points दाखवते. Public interface वर listening आणि public network मधून प्रत्यक्ष reachable असणं वेगळं आहे. पुढे authorized external scan मधल्या results शी ही list compare करा.
Practice
तुमच्या instance चा private IP, default gateway, cat /etc/resolv.conf मधली resolver configuration आणि listening ports लिहा. काही systems मध्ये resolv.conf local stub दाखवतो, हे लक्षात घ्या. Laptop वरून स्वतःच्या instance चा port 22 nc -zv ने तपासा.