The “route” command is used to show and modify the IP routing table.

Set the default gateway in CentOS:

This command will set the default gateway of your CentOS based machine to

/sbin/route add default gw

Show the routing table:


Show routing table with numerical IPs and not resolve hostnames:

/sbin/route -n

Add a route

/sbin/route add -net gw

Delete a route

/sbin/route del -net