ip addr showor
ifconfig # (Older systems)Practice: Check your active interfaces and IPs:
ip addr show | grep inetping google.comPractice: Ping a specific server for 5 packets:
ping -c 5 8.8.8.8ip route showor
route -nPractice: Check your default gateway:
ip route | grep defaultnetstat -tulnor
ss -tulnPractice: List all TCP connections:
ss -tnnslookup google.comor
dig google.comPractice: Get the A record of a domain:
dig +short google.comtraceroute google.comPractice: Trace path to Cloudflare DNS:
traceroute 1.1.1.1curl -O http://example.com/file.zipor
wget http://example.com/file.zipPractice: Download a webpage source:
curl https://example.comInstall:
sudo yum install -y iperf3Start a server (on one terminal):
iperf3 -sRun client (on another terminal/server):
iperf3 -c <server-ip>curl ifconfig.meor
curl ipinfo.io/ipCheck firewalld status:
sudo systemctl status firewalldOpen HTTP port:
sudo firewall-cmd --add-port=80/tcp --permanent
sudo firewall-cmd --reloadDisable eth0:
sudo ip link set eth0 downEnable eth0:
sudo ip link set eth0 upscp file.txt user@192.168.1.20:/home/user/Practice:
Transfer a local file to a remote server's /tmp/ directory:
scp /etc/hosts user@<remote-ip>:/tmp/A bash script to check if a list of hosts is reachable:
Create ping_hosts.sh
#!/bin/bash
for ip in "8.8.8.8" "1.1.1.1" "google.com"
do
ping -c 2 $ip &> /dev/null
if [ $? -eq 0 ]; then
echo "$ip is reachable"
else
echo "$ip is NOT reachable"
fi
doneRun it
bash ping_hosts.sh