Linux networking cheatsheet
Linux networking: Interfaces and routes
8 common Linux networking tasks.
Find which route a destination uses
Show the interface and gateway used to reach an address.
ip route get 8.8.8.8
Find your public IP address
Ask an external service for your public address.
curl -s https://ifconfig.me
Add an IP address temporarily
Assign an extra address to an interface. It is lost on reboot.
sudo ip addr add 192.168.1.50/24 dev eth0
Bring an interface up or down
Enable or disable an interface.
sudo ip link set eth0 up
Caution: Taking down the interface you are connected through will cut off an SSH session.