Adding IP address at runtime: IP ADDR

The IP ADDR command, as the name implies, allows you to display your currently configured IP addresses and add or delete new ones.

Command Short command Explanation  Example 
ip addr  ip a  show currently configured IP addresses  
ip addr add <IP/subnet> dev <interface>  ip a a <IP/subnet> dev <interface>  add an IP address to an interface ip a a dev ens3
ip addr del <IP/subnet> dev <interface>  ip a d <IP/subnet> dev <interface>  remove an IP address from an interface     ip a d dev ens3
ip addr flush dev <interface>  ip a f dev <interface>  remove all IP addresses from an interface         ip a f dev ens3
To complete this example,
ip route add default via 
adds a default gateway to your runtime IP address configuration.

Add Feedback