# Linux Routing
# read the kernel routing table
route
route -n
ip route show
ip route list
# set default route
route add default gw 192.168.0.1 eth0
ip route add default via <GatewayIP>
ip route delete default
# there is a difference between host and network routing.
# a route to a host is a route to only this one host
# and a route to a network reaches all devices in a network segment
# set an additional network route
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
route add -net 192.168.0.0/24 dev eth0
ip route add <network/mask> via <GatewayIP> dev <device>
ip route add <network/mask> dev <device>
ip route add <network/mask> dev <device>
# set a route to a certain host
route add -host 192.168.1.1 dev eth0
# delete a route
route del -net 192.168.0.0/24
route del -host 192.168.1.2
ip route delete network/mask dev <device>
# the route / gateway is written in the following files:
CentOS
/etc/sysconfig/network
or
/etc/sysconfig/network-scripts/ifcfg-enp5s0
or
/etc/sysconfig/network-scripts/route-enp5s0:
GATEWAY=192.168.0.1
Debian
/etc/network/interfaces
gateway 192.168.0.1
openSUSE
/etc/sysconfig/network/ifroute-eth0