Configure Networking and Hostname Resolution Statically or Dynamically Flashcards
Add/delete ip-address to specified interface
ip addr add/del 192.168.0.100/24 dev eth0
Show ip-address for specified interface
ip addr show eth0
ip addr show dev eth0
Test availability of destination host
Test the same but with specified number of packets
Test the same using ipv4 proto
Test the same using ipv6 proto
ping 192.168.0.35
ping -c 10 192.168.0.35
ping -4 -c 10 198.168.0.35
ping -6 -c 10 ::1 or ping6 -c 10 ::1
Display all hops a packet will traverse to get the destination
The same but instead of using icmp use tcp packets
The same but using ipv6 proto
traceroute google.com
traceroute -T 8.8.8.8
traceroute -6 ::1/ traceroute6 ::1
Display all hops a packet will traverse to get the destination using UDP instead of icmp by default
tracepath google.com
Display network status and states listening on tcp, udp protos
Display the same and show process id listening on these ports
Display routing table
Display all listening and non-listening sockets (established), show numerical addr instead symbolic host
netstat -tul
netstat -tulp
netstat -r
netstat -an
Modern tool to display network status and states
ss
P.S. (no support to show routing table i.e. -r switch)
Show link statistics
ip -s link show eth0
Show current device status on the system
ls /sys/class/net
nmcli dev status
Run UI tool for managing connections
The same text based interface
nm-connection-editor
nmtui
Connection config location
/etc/sysconfig/network-scripts/
Add new connection
nmcli con add con-name “backup” type ethernet ip4 192.168.0.122/24 gw4 192.168.0.1 ifname eth0 autoconnect
Get host name
hostname
hostnamectl status
Set host name which will survive after reboot
hostnamectl set-hostname Host1
Set dns to 8.8.8.8 for connection eth0
Set additional dns server to 4.4.0.0 for eth0
Remove dns entry=8.8.8.8 for eth0 connection
nmcli con mod “eth0” ipv4.dns 8.8.8.8
nmcli con mod “eth0” +ipv4.dns 4.4.0.0.
nmcli con mod “eth0” -ipv4.dns 8.8.8.8