![Forrest logo](/images/logo.png)
ip-route:tldr:928dd
ip-route: Add a static route.
$ sudo ip route add ${destination_ip} via ${gateway_ip} dev ${eth0}
try on your machine
This command is used to add a new entry to the IP routing table on a Linux system. Here is an explanation of the different parts of the command:
sudo
: This command is used to run the subsequent command with administrative privileges. It allows the user to execute commands as a superuser or another user with privileges.ip
: This is the command-line utility for configuring and administering network interfaces and IP routing in Linux.route
: This is a subcommand of theip
utility used for managing the IP routing table.add
: This subcommand is used to add a new route to the routing table.${destination_ip}
: This is a placeholder that should be replaced with the actual IP address of the destination network or host that you want to reach.via ${gateway_ip}
: This specifies the IP address of the gateway through which the traffic should be routed to reach the destination. The gateway is typically the next hop on the network path.dev ${eth0}
: This specifies the network interface through which the traffic should be sent.${eth0}
is a placeholder that should be replaced with the actual network interface name (e.g., eth0, eth1, enp0s3).
Overall, this command adds a new route to the IP routing table, specifying the destination IP address, the gateway through which to reach that destination, and the network interface to use for routing the traffic.
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.