KandZ – Tuts

We like to help…!

Linux CLI 31🐧 ip and netstat commands

a - ip command
ip command is a tool for managing network tasks
ip address → displays detailed information about all Network interfaces.
ip link → displays link layer information
ip link -s → displays link layer statistics
ip neighbour → lists devices in the same network
ip route → displays routing table
Other objects: neighbour → ARP or NDISC cache entry rule → Rule in routing policy database.
tunnel → tunnel over IP maddress → Multicast address

b - ip command examples
ip addr add 192.168.1.2/24 dev eth0 → sets to eth0 interface specific IP and subnet mask
ip route add default via 192.168.1.1 dev eth0 → sets new default gateway
ip addr del 192.168.1.100/24 dev eth0 → deletes specific IP address
sudo ip route flush → flushes routing tables
sudo ip neighbor flush → flushes neighbour entries
ip rule show → show IP rules
ip rule add priority 1000 from 192.168.1.0/24 to 10.0.0.0/8 table main → example of adding new rule

c - netstat command
netstat displays network related statistics and connections
It provides various options to filter, sort, display or modify network-related data
netstat -tulpn → shows all listening (LISTEN) TCP connections
netstat -nr → shows the routing table
netstat -tna | grep :25 → checks network connections on a specific port
sudo netstat -tcp → lists all established TCP connections
sudo netstat --statistics → shows network statistics
netstat -au → lists all UDP ports
netstat -l → lists all listening ports

Leave a Reply