Linux routing decides which gateway and interface should be used to reach another network. Older systems often used the route command; on current Linux systems, ip route is the preferred tool.
View the routing table
ip route
A typical default route might look like default via 10.0.0.1 dev eth0.
Add a temporary route
sudo ip route add 10.1.0.0/16 via 10.0.0.10 sudo ip route add 10.2.0.0/16 via 10.0.0.20
These commands change the running routing table only. For a persistent route, configure it through the distribution’s network manager, such as NetworkManager, systemd-networkd, Netplan, or the relevant interface configuration.
Before adding a route, confirm that the gateway is reachable on a directly connected network and that the destination prefix does not overlap an existing route.