Table of Contents
Route Command (now ip route)
2016 - updated Jun 2017
—
The route command has now been replaced. The command was deprecated some time ago, but continued to be used. The replacement is part of the IP command set.
Pre CentOS 7 you can still use route, but as of v7 the IP command should be used.
ip route default via 192.168.27.254 dev enp4s0f0 proto static metric 100 10.0.0.0/8 dev ens513f0 proto kernel scope link src 10.0.222.2 metric 100 11.0.0.0/8 dev ens513f2 proto kernel scope link src 11.0.222.4 metric 100 192.168.27.0/24 dev enp4s0f0 proto kernel scope link src 192.168.27.222 metric 100
—
The route command allows dynamic setting of a route from the command line, however using route without any parameters will show the currently configured routes.
Raspbian
Raspbian Jessie on a Raspberry Pi 3 (LAN connected only, no wifi or bluetooth)
route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 137.58.71.254 0.0.0.0 UG 202 0 0 eth0 137.58.68.0 * 255.255.252.0 U 202 0 0 eth0
Here we can see the default gateway is 137.58.71.254 on eth0
CentOS
CentOS 6.6 on a server with 6 network interfaces (only eth0 is physically connected).
route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.5.0 * 255.255.255.0 U 0 0 0 eth4 192.168.4.0 * 255.255.255.0 U 0 0 0 eth2 192.168.4.0 * 255.255.255.0 U 0 0 0 eth3 192.168.3.0 * 255.255.255.0 U 0 0 0 eth1 192.168.27.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 1002 0 0 eth2 link-local * 255.255.0.0 U 1003 0 0 eth3 link-local * 255.255.0.0 U 1004 0 0 eth4 link-local * 255.255.0.0 U 1005 0 0 eth5 link-local * 255.255.0.0 U 1006 0 0 eth0 link-local * 255.255.0.0 U 1007 0 0 eth1 default 192.168.27.254 0.0.0.0 UG 0 0 0 eth0
Here we can see the default gateway is 192.168.27.254 on eth0
testing…