route is a network administration tool used to view and modify the IP routing table in a system. The routing table contains a list of all the available routes for the system to communicate with other networks or hosts. The route command displays the current routing table and allows you to add or delete routes, set the default gateway, and modify other routing-related settings.
Basic Syntax
route [options]
Commonly Used Options
-
-n: This displays the routing table in numerical format, which shows the IP addresses instead of the hostnames. -
-v: This displays the routing table in verbose mode, which provides additional information about the routes. -
add: This adds a new route to the routing table. -
del: This deletes a route from the routing table. -
default: This sets the default gateway for the system. -
netmask mask: This specifies the network mask for the route. -
gw gateway: This specifies the gateway for the route.
Useful Examples
-
route: This displays the current routing table. -
route -n: This displays the routing table in numerical format. -
route -v: This displays the routing table in verbose mode. -
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.0.1: This adds a new route to the routing table for the network 192.168.1.0/24 via the gateway 192.168.0.1. -
route del -net 192.168.1.0 netmask 255.255.255.0: This deletes the route for the network 192.168.1.0/24 from the routing table. -
route add default gw 192.168.0.1: This sets the default gateway for the system to 192.168.0.1.
Leave a Reply