Forrest logo
back to the route tool

route:tldr:70227

route: Add a route to a destination through a gateway.
$ sudo route add "${destination_ip_address}" "${gateway_address}"
try on your machine

This command is used to add a new route to the routing table of a network device in a Unix-like operating system.

Here is the breakdown of the command:

  • sudo: This command is used to execute the subsequent command with administrative privileges. It allows the user to run the command as a superuser or another user with elevated permissions.

  • route: This is the command-line tool used for managing the IP routing table. It allows you to view, add, and delete entries in the routing table.

  • add: This option specifies that we want to add a new route to the routing table.

  • "${destination_ip_address}": This variable represents the IP address of the destination network or host you want to reach. It could be in the IPv4 or IPv6 format.

  • "${gateway_address}": This variable represents the IP address of the gateway or next-hop router used to reach the destination network or host. The gateway is responsible for forwarding the network traffic to the appropriate destination.

By executing this command with the actual IP addresses in place of the variables, a new entry will be added to the routing table, allowing the network device to send traffic destined for the specified IP address through the specified gateway.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the route tool