Static IP
2018-03-13
Network configuration - static IP. Useful for installations and repairs, when dhcp does not work as intended.
https://wiki.archlinux.org/index.php/Network_configuration#Static_IP_address
I use it way too much.
Display all the info with a following command:
$ ip a
Bring the interface up:
$ ip link set eth0 up
Set the IP:
$ ip addr add 192.168.1.13 broadcast 192.168.1.255 dev eth0
$ ip route add 192.168.1.1 dev eth0
$ ip route add default via 192.168.1.1 dev eth0
You may try that, instead of these two last commands above:
$ ip route add default via 192.168.1.1
Delete all address settings for a given interface:
$ ip addr flush dev eth0
A newer way to set the IP:
$ ip address add 192.168.1.13/24 broadcast + dev eth0
Of course replace 'eth0' with whatever your interface is called (for example: enp1s0) and properly adjust all the IPs.