Visit complete Cyber Security roadmap

← Back to Topics List

route

route is a command-line utility that allows you to view and manipulate the IP routing table in your computer. The primary function of the routing table is to determine the best path for sending IP packets to their destination. Properly managing this table is crucial for network administrators, as it plays a direct role in your computer’s ability to communicate with other devices on the network effectively.

Using the Route Command

The syntax for the route command is as follows:

route [COMMAND] [OPTIONS]

Here are some basic commands that you can use with route:

  • route add - Adds a new route to the table
  • route delete - Removes a route from the table
  • route change - Modifies a specific route in the table
  • route get - Retrieves information about a specific route
  • route show - Displays the entire routing table

Please note that, to modify the routing table, administrative privileges may be needed.

Examples of Route Usage

  • View the routing table
route -n

This command will display the current routing table in a numerical format, which includes the destination, gateway, and interface.

  • Add a new route
sudo route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1

This command adds a new route to the destination network 192.168.2.0 with a netmask of 255.255.255.0 and a gateway of 192.168.1.1.

  • Delete a route
sudo route delete -net 192.168.2.0 netmask 255.255.255.0

This command removes the route to the destination network 192.168.2.0 with a netmask of 255.255.255.0.

  • Change an existing route
sudo route change -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.2

This command modifies the existing route to the destination network 192.168.2.0 with a new gateway of 192.168.1.2.

Conclusion

The route command is an essential tool for network administrators and anyone involved in cyber security. Understanding and being able to manipulate the IP routing table can help ensure that your computer is able to communicate effectively with other devices on the network, thus contributing to a more secure and efficient network environment.

Community

roadmap.sh is the 6th most starred project on GitHub and is visited by hundreds of thousands of developers every month.

Roadmaps Best Practices Guides Videos Store YouTube

roadmap.sh by Kamran Ahmed

Community created roadmaps, articles, resources and journeys to help you choose your path and grow in your career.

© roadmap.sh · FAQs · Terms · Privacy

ThewNewStack

The leading DevOps resource for Kubernetes, cloud-native computing, and the latest in at-scale development, deployment, and management.