While the ip commands aren't nearly as full featured as nmcli (network manager ) there is still a lot you can do.
IP stands for internet protocol. This has to do with network commands. The "ip" command does not directly support wi-fi connections. This is for ethernet connections.
How to view your current IP address and settings.
How to bring an interface up.
Note: your interface name won't always be "eth0". Just replace eth0 with your interface name. You can see your interface
name with the "ip addr" command above.
How to shut an interface down.
Again, your interface name might not be eno1.
How to add a static IP address to your interface.
As mentioned before, your interface may not be eth0. You will need the netmask, most of the time it will be /24 which is the same as 255.255.255.0. Note, it is possible to assign more than one IP address to an interface. (This is not recommended, unless you know
what you are doing, it can break things).
How to delete an IP address from an interface.
Again, you will need to include the netmask.
How to view your default route (default gateway)
How to add a default route (default gateway)
How to delete a route
The ip command doesn't have a direct dns command, but you can do something like...
That will add two DNS servers.
There is also not a direct dhcp client setting for the ip command. But you can do this with another command.
To release a dhcp lease, and add a new one.
That's the basic commands. I will do more advanced commands in another post.
IP stands for internet protocol. This has to do with network commands. The "ip" command does not directly support wi-fi connections. This is for ethernet connections.
How to view your current IP address and settings.
Code:
ip addr show
How to bring an interface up.
Code:
ip link set dev eth0 up
Note: your interface name won't always be "eth0". Just replace eth0 with your interface name. You can see your interface
name with the "ip addr" command above.
How to shut an interface down.
Code:
ip link set dev eno1 down
Again, your interface name might not be eno1.
How to add a static IP address to your interface.
Code:
ip addr add 192.168.1.100/24 dev eth0
As mentioned before, your interface may not be eth0. You will need the netmask, most of the time it will be /24 which is the same as 255.255.255.0. Note, it is possible to assign more than one IP address to an interface. (This is not recommended, unless you know
what you are doing, it can break things).
How to delete an IP address from an interface.
Code:
ip addr del 192.168.1.100/24 dev eth0
Again, you will need to include the netmask.
How to view your default route (default gateway)
Code:
ip route show
How to add a default route (default gateway)
Code:
ip route add 192.168.2.0/24 via 192.168.1.1 dev eth0
How to delete a route
Code:
ip route del 192.168.2.0/24
The ip command doesn't have a direct dns command, but you can do something like...
Code:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf
That will add two DNS servers.
There is also not a direct dhcp client setting for the ip command. But you can do this with another command.
Code:
dhclient eth0
To release a dhcp lease, and add a new one.
Code:
dhclient -r eth0
dhclient eth0
That's the basic commands. I will do more advanced commands in another post.
Last edited:

