Technically you can have multiple default gateways but that is the realm of core internet servers, network load balancers, and so on for the most part.
Much more common is a requirement for multiple routes, each with its own router.
Example: You have a computer sitting between two networks, like this: 192.168.1.5/24 and 192.168.2.5/24
You use 192.168.1.1 as Default Gateway - that is the default route for anything not locally attached. Locally attached is explicitly defined as anything which is in any of the subnets on which you have an interface in the UP/RUNNING state and for which there is no explicit static route defined.
In this configuration you already have three routes: A route for everything locally on 18.104.22.168.0/24, with the gateway being your own IP address on that subnet. You have a similar route for the systems on 192.168.2.0/24... And finally you have a default route, that being for "0.0.0.0" pointing to the default gateway. (There are also some other "psuedo" routes on some operating systems, eg for accessing the loopback device, or for broadcast traffic)
Now say there is a router at 192.168.2.2 which provides access to a number of networks. Usually these are "internal" networks. You can now add "static routes" to these networks. Example for a network with subnet 192.168.5.0/24
route add -net 192.168.5.0 netmask 255.255.255.0 gw 192.168.2.2
You can add multiple "static" routes through one router, or routes can use as many routers/gateways as needed.
You can view the table of known routes with the command
The Linux specific command will show the same information in a slightly different format.
ip route show
The router(s) specified must "know" how to reach the target network, otherwise it will go to its own default gateway and forward your packets that way.
To make this configuration changes persistent you need to add it to the system configuration files. Static routes are relevant to one specific interface so they do not go into /etc/sysconfig/network. In stead these go into files located in
You add "via" entries into this file for routes. These lines read like "Access network X via gateway Y on Network interface device Z. Example
default 192.168.1.1 dev eth0
192.168.5.0/24 via 192.168.2.2 dev eth0
192.168.6.0/24 via 192.168.2.2 dev eth0
And so on.