Forrest logo
back to the ip tool

ip-route:tldr:f8850

ip-route: Add a default route using `eth0`.
$ sudo ip route add default dev ${eth0}
try on your machine

This command adds a default route to the IP routing table in Linux systems using the ip command.

Here's the breakdown of the command:

  • sudo: It is a command that allows a user with administrator privileges (root) to execute a command. It prompts the user to enter the root password before executing the command.

  • ip: It is a command-line utility that allows you to manage network interfaces, IP addresses, and routes on Linux systems.

  • route: It is one of the subcommands of the ip command used for managing IP routing.

  • add: It is an option used with the route subcommand to add a new route to the IP routing table.

  • default: It is a keyword that represents the default route, which is the route used when there is no specific route available for a destination IP address. Adding a default route allows traffic to be forwarded to other networks.

  • dev ${eth0}: It specifies the device (network interface) through which the traffic will be sent. ${eth0} is a placeholder that likely needs to be replaced with the actual interface name, such as eth0 or enp0s3. The interface specified should be the one connected to the network where the default route should point to.

Overall, this command adds a default route to the IP routing table, which ensures that any traffic for which there is no specific route defined will be forwarded out through the specified network interface.

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 ip tool