Linux Network Troubleshooting: ping, traceroute, සහ ss
Internet ගැටලු Fix කරන, Server ගැටලු Diagnose කරන, සහ IT Departments දිනපතා use කරන ප්රධාන Commands
හැඳින්වීම...
"Server එක down."
"මට database එකට connect වෙන්න බෑ."
"Website එක load වෙන්නේ නෑ."
සෑම IT professional කෙනෙක්, system administrator කෙනෙක්, සහ developer කෙනෙක්ම මේ වචන නිතරම අහනවා. ඒත් ඔවුන් panic වෙන්නේ නෑ ඔවුන් එය troubleshoot කරනවා.
Linux network troubleshooting magic එකක් නෙවෙයි. එය ඔබේ computer එක සහ ලෝකයේ සෙසු කොටස අතර ඇත්තටම මොකද වෙන්නේ කියලා හරියටම reveal කරන ශක්තිමත්, built-in tools භාවිතා කරන ක්රමානුකූල ක්රියාවලියක්. ඔබ networking ඉගෙන ගන්න student කෙනෙක් වුණත්, applications debug කරන developer කෙනෙක් වුණත්, හෝ infrastructure manage කරන system administrator කෙනෙක් වුණත් ping, traceroute, සහ ss master කිරීමෙන් network problems අභිරහස් වලින් එහාට ගිය විසඳිය හැකි ප්රහේලිකා බවට පරිවර්තනය වෙනවා.
Network සන්නිවේදනය වැඩ කරන ආකාරය
Troubleshooting වලට කලින්, මේ සරල සත්යය තේරුම් ගන්න:
Network සන්නිවේදනය ලිපියක් යැවීම වගේ:
- ඔබේ computer එක sender
- Destination (server/website) receiver
- Routers-මාර්ගයේ තැපැල් කාර්යාල
- Data packets වලින් ගමන් කරනවා (ලියුම් කවර)
සන්නිවේදනය බිඳෙනකොට, විය හැක්කේ:
- ඔබේ connection එක (නිවසින් පිටවෙන්න බෑ)
- අතරමග router එකක් (තැපැල් කාර්යාලය වසා දමා)
- Destination server එක (ලබන්නා ගෙන ගියා)
- Traffic block කරන Firewall (ආරක්ෂක මුරපොලක්)
ping:
ping කරන දේ
ping සරල පණිවිඩයක් යවනවා: "ඔබ එතනද?" සහ "ඔව්, මම මෙතන" ආපහු බලාපොරොත්තුවෙන් ඉන්නවා.
දොරකට තට්ටු කරනවා වගේ හිතන්න. කවුරුහරි පිළිතුරු දුන්නොත්, connection වැඩ කරනවා. නැත්නම්, යමක් වැරදියි.
මූලික භාවිතය
ping google.com
Output:
PING google.com (142.250.185.46): 56 data bytes
64 bytes from 142.250.185.46: icmp_seq=0 ttl=117 time=12.3 ms
64 bytes from 142.250.185.46: icmp_seq=1 ttl=117 time=11.8 ms
64 bytes from 142.250.185.46: icmp_seq=2 ttl=117 time=12.1 ms
මේකෙන් ඔබට කියන්නේ:
- ✅ Connection වැඩ කරනවා – Google හි server respond වුණා
- Response time: 12.3 ms – වේගවත් (50ms වලට අඩුවන විට විශිෂ්ටයි)
- TTL (Time To Live): 117 – Packet මිය යන්න කලින් routers 117ක් හරහා hop කරන්න පුළුවන්
Real-World Scenario 1: Website Load වෙන්නේ නෑ
ගැටලුව: Customer කියනවා ඔබේ website එක down කියලා.
Troubleshooting:
ping yourwebsite.com
Outcome A: Response එකක් නෑ → Server down හෝ unreachable
Outcome B: Respond කරනවා → Server up; ගැටලුව වෙන තැනක (DNS, firewall, හෝ web service විය හැකි)
කුඩා කතාවක්:
Startup එකක website එක හදිස්සියේ load වෙන්න නැවැත්තුණා. Panic එකක් ඇති වුණා. එක ping command එකකින් server එක හොඳින් තියෙනවා කියලා හෙළි වුණා—ගැටලුව ඔවුන්ගේ DNS configuration expire වෙලා තිබීමයි. විනාඩි දහයකට පස්සේ, DNS update වුණා, website ආපහු online. අර්බුදය වළක්වා ගත්තා.
A dvanced ping Options
Packet count සීමා කරන්න:
ping -c 4 google.com
Packets 4ක් විතරක් යවලා නවත්වනවා.
Response time statistics check කරන්න:
ping -c 10 google.com
Min/avg/max response times බලන්න, අස්ථාවර connections හඳුනාගන්න ප්රයෝජනවත්.
Flood ping (root අවශ්යයි):
sudo ping -f 192.168.1.1
හැකි තරම් වේගයෙන් packets යවනවා network stress test කරනවා (ප්රවේශමෙන් use කරන්න!).
traceroute:
traceroute කරන දේ
traceroute ඔබේ computer එකේ සිට destination එක දක්වා data ගමන් කරන සම්පූර්ණ path එක map කරනවා. සෑම router එකක්, සෑම hop එකක්, සෑම delay එකක්.
Data packets සඳහා GPS tracking වගේ හිතන්න.
ping ඔබට "destination එකට reach වෙන්න බෑ" කියනවා නම්, traceroute ඔබට කොහේද එය නැවැත්තුණේ කියනවා.
මූලික භාවිතය
traceroute google.com
Output:
traceroute to google.com (142.250.185.46), 30 hops max, 60 byte packets
1 router.local (192.168.1.1) 1.234 ms 1.189 ms 1.156 ms
2 10.0.0.1 (10.0.0.1) 8.456 ms 8.234 ms 8.123 ms
3 isp-gateway.net (203.94.x.x) 12.345 ms 12.234 ms 12.123 ms
4 google-edge.net (142.250.x.x) 15.678 ms 15.567 ms 15.456 ms
5 google.com (142.250.185.46) 16.789 ms 16.678 ms 16.567 ms
මෙන්න මේකෙන් පෙන්වන්නේ:
- Hop 1: ඔබේ local router (නිවස/කාර්යාල network)
- Hop 2: ISP උපකරණ
- Hop 3: Internet එකට ISP gateway
- Hop 4: Google හි edge server
- Hop 5: Destination reached
සෑම hop එකක්ම response times තුනක් පෙන්වනවා (test packets තුනක් යැවුවා).
Real-World Scenario 2: Database Connections
ගැටලුව: Application එකට database එකට connect වෙන්න පුළුවන්, ඒත් queries අතිශයින් slow.
Troubleshooting:
traceroute database.company.com
සොයාගත්තා: Hop 7 * * * (timeout) පෙන්වනවා, ඉන්පස්සේ Hop 8 ms 200ක delay එකක් සමඟ continue වෙනවා.
Diagnosis: Hop 7 හි Router congested හෝ misconfigured, විශාල latency එකක් add කරනවා.
විසඳුම: Network team ගැටළුකාරී router එක වටේ traffic reroute කළා. Database performance restore වුණා.
Advanced traceroute භාවිතය
UDP වෙනුවට ICMP use කරන්න (සමහර විට වඩාත් විශ්වසනීයයි):
traceroute -I google.com
Maximum hops set කරන්න:
traceroute -m 15 google.com
Hops 15කට පස්සේ නවත්වනවා (දුරස්ථ/unreachable servers සඳහා ප්රයෝජනවත්).
Hostnames resolve නොකර IP addresses පෙන්වන්න (වේගවත්):
traceroute -n google.com
ss:
ss කරන දේ
ss (socket statistics) ඔබේ system එකේ සියලුම network connections පෙන්වනවා. මොනවද listen කරන්නේ, මොනවද connected, කවුද කවුරු සමඟ කතා කරන්නේ.
ඔබේ network ක්රියාකාරකම් සඳහා ආරක්ෂක කැමරා footage වගේ හිතන්න.
එය පැරණි netstat command එක replace කළා සහ වේගවත්, වඩාත් ශක්තිමත්, සහ ක්රියාකාරීව maintain කරනවා.
මූලික භාවිතය
සියලුම connections පෙන්වන්න:
ss
Listening ports පෙන්වන්න (connections සඳහා බලාපොරොත්තුවෙන් ඉන්න services):
ss -tuln
Output:
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:443 0.0.0.0:*
මෙන්න මේකෙන් පෙන්වන්නේ:
- Port 22: SSH server listening (remote access)
- Port 80: HTTP web server listening
- Port 443: HTTPS web server listening
- 0.0.0.0: සියලුම network interfaces මත listening
Real-World Scenario 3: Security Audit
කාර්යය: Production server එකක unauthorized services run වෙනවද කියලා check කරන්න.
Command:
sudo ss -tuln | grep LISTEN
සොයාගත්තා: Port 3306 (MySQL) internet එකට expose වෙලා.
ආරක්ෂක අවදානම: Database internally විතරක් accessible විය යුතුයි, publicly නෙවෙයි.
Fix:
sudo ufw deny 3306
Firewall දැන් external MySQL access block කරනවා. Breach වළක්වා ගත්තා.
Advanced ss භාවිතය
Established connections පෙන්වන්න:
ss -tun state established
මේ මොහොතේ active connections බලන්න.
විශේෂිත port එකට connections පෙන්වන්න:
ss -tn sport = :80
Web server (port 80) වලට සියලුම connections.
සෑම connection එකක් භාවිතා කරන process එක පෙන්වන්න:
ss -tulnp
සෑම connection එකක් own කරන program එක හෙළි කරනවා—troubleshooting සඳහා තීරණාත්මක.
උදාහරණ output:
tcp LISTEN 0 128 *:80 *:* users:(("nginx",pid=1234,fd=6))
Nginx (PID 1234) port 80 මත listen කරනවා කියලා පෙන්වනවා.
Real-World Troubleshooting Workflow
ගැටලුව: "මට company file server එකට access කරන්න බෑ."
පියවර 1: ඔබට එය reach කරන්න පුළුවන්ද?
ping fileserver.company.com
- Success: Server reachable → ගැටලුව authentication හෝ permissions
- Failure: Server unreachable → තව investigate කරන්න
පියවර 2: Connectivity බිඳෙන්නේ කොහේද?
traceroute fileserver.company.com
- Hop 3 හිදී නවතිනවා නම් → Network infrastructure ගැටලුව
- Server එකට reach වුණත් timeout නම් → Server firewall හෝ service down
පියවර 3: Service එක run වෙනවද?
ssh user@fileserver.company.com
sudo ss -tuln | grep 445
- Port 445 (SMB/file sharing) listening? → Service up
- Port 445 නෑද? → Service crash හෝ misconfigured
ප්රතිඵලය: පැය ගණනක් guess කරන එකට වඩා විනාඩි 5කින් අඩුවෙන් ක්රමානුකූල diagnosis එකක්.
මේ Skills Career-Essential වන්නේ ඇයි?
System Administrators
දෛනික network troubleshooting, uptime maintain කිරීම, connectivity ගැටලු diagnose කිරීම.
DevOps Engineers
Microservices සන්නිවේදනය debug කිරීම, distributed systems monitor කිරීම, latency optimize කිරීම.
Cybersecurity Professionals
සැක සහිත connections හඳුනාගැනීම, port scans හඳුනාගැනීම, breaches විමර්ශනය කිරීම.
Cloud Engineers
VPC connectivity troubleshoot කිරීම, load balancers debug කිරීම, network bottlenecks විශ්ලේෂණය කිරීම.
Developers
API calls debug කිරීම, service availability test කිරීම, application behavior තේරුම් ගැනීම.
පොදු Network ගැටලු සහ ඒවායේ විසඳුම්
ගැටලුව 1: ඉහළ Latency (Slow Connections)
රෝග ලක්ෂණය: ping ms 100කට වැඩි response times පෙන්වනවා
Diagnosis:
traceroute destination.com
හදිසි latency spikes සහිත hops සොයන්න.
විසඳුම්:
- Congested network link → Bandwidth upgrade හෝ reroute
- Distant server → CDN හෝ regional deployment use කරන්න
- WiFi interference → Wired connection එකට switch වෙන්න
ගැටලුව 2: Connection Refused
රෝග ලක්ෂණය: ping වැඩ කරනවා, ඒත් application fail
Diagnosis:
ss -tuln | grep PORT_NUMBER
Service listening නැත්නම්:
- Service crash වෙලා → Restart කරන්න
- වැරදි port configure කරලා → Configuration check කරන්න
- Firewall blocking → Rules adjust කරන්න
ගැටලුව 3: Intermittent Failures
රෝග ලක්ෂණය: සමහර විට වැඩ කරනවා, සමහර විට නෑ
Diagnosis:
ping -c 100 destination.com
Packet loss percentage check කරන්න.
ඉහළ packet loss indicate කරනවා:
- අසාර්ථක network උපකරණ
- Overloaded connection
- ISP routing ගැටලු
ඔබ දැනගෙන සිටියාද?
- ping නම් කළේ submarines objects හඳුනාගන්න භාවිතා කරන sonar ශබ්දය අනුව
- traceroute routes map කරන්න TTL manipulation use කරනවා. දක්ෂ networking උපක්රමයක්
- ss විශාල connection lists සඳහා පැරණි
netstatcommand එකට වඩා 10x වේගවත් - ප්රධාන internet outages බොහෝ විට මේ හරියටම tools use කරලා diagnose කරනවා
Pro ඉඟි
Tip 1: පොදු troubleshooting commands සඳහා aliases සාදන්න:
alias netcheck='ping -c 4 8.8.8.8 && ss -tuln'
Tip 2: Continuous real-time monitoring සඳහා mtr (my traceroute) use කරන්න:
mtr google.com
Ping සහ traceroute live updates සමඟ combine කරනවා.
Tip 3: හැමදේම සාමාන්යයෙන් වැඩ කරන විට baselines document කරන්න. Troubleshooting වලදී ඒවාට එරෙහිව compare කරන්න:
ping -c 10 server.com > baseline-ping.txt
traceroute server.com > baseline-route.txtNetwork Troubleshooting Master කරන්න free Resources
- TryHackMe – Networking fundamentals සහ labs
- Cisco Networking Academy – නොමිලේ networking courses
- Professor Messer (YouTube) – Network+ certification videos
- Linux man pages –
man ping,man traceroute,man ss

Comments
Post a Comment