Ad space (banner)
📡Networking Lessons
Lesson 19 / 39

Adding a Static Route with ip route

When you want to steer traffic for another network along a specific path by hand, use ip route. It manually adds a static route to the routing table.

The syntax is ip route destination-network subnet-mask next-hop-ip, in configuration mode. Specifying 0.0.0.0 0.0.0.0 creates a default route matching every network.

Running ip route 0.0.0.0 0.0.0.0 192.168.1.254 forwards any traffic that matches no other route to 192.168.1.254.

A common stumble is a next-hop IP that doesn't actually exist or can't be reached, leaving the traffic to die quietly.

In real work, this is extremely common as the default route pointing a small network's traffic at its internet gateway.

Networking
Try it (type this into the pseudo terminal)
ip route 0.0.0.0 0.0.0.0 192.168.1.254

🧑‍💻 You can type this command into the Networking pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)