How do you use the ip command for network configuration?
Answer
The ip command is the modern replacement for ifconfig and route. Key subcommands: ip addr show (or ip a) lists all network interfaces and their IP addresses. ip addr add 192.168.1.100/24 dev eth0 adds an IP address to an interface. ip link set eth0 up/down brings an interface up or down. ip route show displays the routing table. ip route add default via 192.168.1.1 adds a default gateway. ip neigh show displays the ARP cache. ip -s link shows interface statistics (packets sent/received, errors). Changes made with ip are non-persistent — they are lost on reboot. For persistent configuration, edit network config files (/etc/netplan/ on Ubuntu, /etc/sysconfig/network-scripts/ on RHEL).
Previous
How do netstat and ss show network connections?
Next
What are the basics of iptables for packet filtering?