Show IPv4 and IPv6 interfaces
$ ip -4 a
$ ip -6 a
Show interface ens4 details
$ ip a show ens4
$ ip a show dev ens4
$ ip a list ens4
Show only running interfaces
$ ip link ls up
Add the IP address to the interface
Add IP address to the interface
$ sudo ip address add 192.168.100.100/255.255.2550 dev ens4
$ sudo ip address add 192.168.100.100/24 dev ens4
Add broadcast address to the interface
$ sudo ip address add broadcast 192.168.100.255 dev ens4
Remove the IP address from the interface
Delete IP address from the interface
$ sudo ip address del 192.168.100.100/24 dev ens4
Flush all IP addresses from the private network
$ sudo ip -s -s a f 192.168.100.100/24
Change state of the interface
Make the interface down
$ sudo ip link set dev ens4 down
Make the interface up
$ sudo ip link set dev ens4 up
Change the MTU of the interface
$ sudo ip link set mtu 1500 dev ens4
Show neighbour / arp cache
$ sudo ip neighbor show
Add new ARP entry
$ sudo ip neighbor add 192.168.100.100 lladdr 42:01:0a:80:00:01 dev ens4 nud perm
nud states:
- permanent – Entry is valid forever and can only be removed administratively.
- noarp – Entry is valid, and can be removed when its lifetime expires
- stale – Entry is valid but suspicious.
- reachable – Entry is valid until the reachability timeout expires
Delete a ARP entry
$ sudo ip neighbor del 192.168.100.100 dev ens4
Change the state of the ARP entry
$ sudo ip neighbor change 192.168.100.100 dev ens4 nud reachable
Flush ARP entry
$ ip -s -s n flush 192.168.100.100
ip route
Show routing table
$ ip r list
$ ip route list
Display routing for 192.168.100.1/24
$ ip route list 192.168.100.1/24
Add new route
$ ip route add {NETWORK/MASK} via {GATEWAY}
$ ip route add 192.168.100.0/24 via 192.168.100.1
Delete route
$ ip route del default