Linux Set Up Routing with ip Command

ht‮‬tps://www.lautturi.com
Linux Set Up Routing with ip Command

To set up routing in Linux using the ip command, you can use the following steps:

  1. Check the current routing table: You can use the ip route command to view the current routing table. This will show you the routes that are currently configured on your system.

  2. Add a new route: To add a new route to the routing table, you can use the ip route add command. For example, to add a route to network 192.168.1.0/24 via the gateway 192.168.1.1, you would run:

sudo ip route add 192.168.1.0/24 via 192.168.1.1
  1. Delete a route: To delete a route from the routing table, you can use the ip route del command. For example, to delete the route to network 192.168.1.0/24, you would run:
sudo ip route del 192.168.1.0/24
  1. Modify a route: To modify an existing route, you can use the ip route replace command. For example, to change the gateway for the route to network 192.168.1.0/24 to 192.168.1.2, you would run:
sudo ip route replace 192.168.1.0/24 via 192.168.1.2

Keep in mind that these commands are just a few examples of the many options available with the ip command for managing routing. You can use the ip route command with various options to view, add, delete, and modify routes in the routing table. Consult the ip command's documentation for more detailed instructions and options.

Created Time:2017-10-30 10:17:38  Author:lautturi