Configuring routes on Linux


Linux offers administrators the possibility to configure static routes to reach external networks. You should know by now that, in networking, the protocol that defines the means of communication is the IP. Machines communicates with each other by using several elements that define its unique identity within the network. These elements are (IP address, network mask, gateway). If you are familiar with routing under Windows or CISCO devices then, this short tutorial should be simple to digest. If you have trouble assimilating this information, please read the following articles:
IP Routing in Windows Server and Routing protocols – How to configure static routes and more

To view the routes on a CentOS machine type route or route -e:
linux routing software

To add a route for 192.168.2.0/24 network by using my default gateway, I would execute the following command:

route add -net 192.168.2.0 netmask 255.255.255.0 gw 10.18.6.1
The routing table for my server looks like this:
unix tutorial
With route command you can add/delete routes, specify hosts, networks, configure default gateway and loopback interface. For all available options please check out the manpage for this command:
man route
network security
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s