This guide will go through how to set default route to network in Linux. Linux systems needs network route to access the internet, you can as well call it gateway.
- Let us stating by checking the current route using the command below.
default via 192.168.171.2 dev ens33 proto dhcp metric 100 169.254.0.0/16 dev ens33 scope link metric 1000 192.168.171.0/24 dev ens33 proto kernel scope link src 192.168.171.144 metric 100
Set default route to Network in Linux using IP Command
- Run the IP command below with your preferred route to the network e.g.
sudo ip route add default via 192.168.171.35
- You can delete the route that was set using the following command.
sudo ip route del default via 192.168.171.35
Set default route to Network in Linux using route Command
- Set the default route using the command below.
sudo route add default gw 192.168.171.10
- To delete the route set use the following command.
sudo route del default gw 192.168.171.10
- You have made it to the end of our article. We have gone through how to set default route to network in Linux.
Read more about network route
Create Data Map Visualization in Kibana
How to find path to a command in Linux