route

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 192.168.7.1.

/sbin/route add default gw 192.168.7.1

Show the routing table:

/sbin/route

Show routing table with numerical IPs and not resolve hostnames:

/sbin/route -n

Add a route

/sbin/route add -net 192.168.7.0/24 gw 10.0.10.1

Delete a route

/sbin/route del -net 192.168.7.0/24

(Comments)

Comments