Change IP
Here are the commands used to change the network settings by adding or removing IP addresses and turning on or off network interfaces.
They can be useful when you want to connect your computer to a different network or when you want to troubleshoot network connectivity issues.
ip addr del 192.168.1.2/24 dev eno1
ip addr add 192.168.0.2/24 dev eno1
ip link set up dev eno1- Remove the IP address
192.168.1.2that is assigned to a network interface calledeno1. The/24part is a fancy way of saying that it is a small network (it is equivalent to the255.255.255.0network mask). - Add a new IP address
192.168.0.2to the same network interface calledeno1. This is like giving your computer a new phone number that other devices can use to call it. - Turn on the network interface eno1 so that it can start communicating with other devices on the network. It's like turning on the switch for a light bulb so that it can start working.
Set default gateway
ip route change default via 192.168.0.1 dev eno1It's like telling your computer to use a specific road to get to your friend's house, "go through the big park".