Breaking News
Loading...
Monday, July 29, 2013

How to configure default gateway on CentOS 6.4

4:35 PM

1. Introduction
CentOS default gateway, what is it and what is its purpose? A computer needs to know the address of at least one gateway in order to connect to another network, this is called the Default Gateway. Whenever a computer tries to connect to a machine on a different network it will connect to the default network gateway and then the network gateway will route the traffic to the right network. In this tutorial, we’ll learn how to configure a CentOS default gateway. This tutorial can also be applied to other distributions which are still in the Red Hat family, such as RHEL or Fedora.
2. Configure
Print routing table
To print routing table, we can use
#route -n
 This will show current route(s) in IP format not as DNS name :

Delete default gateway

As you can see above the default route is on the last line with Flags UG. if we want to change default route we have to delete current default gateway first. The command pattern for deleting default gateway is route del default gw.
For example
When we see the routing table, there are no default gateway right now

Add default gateway

Now, it’s time to add new gateway. The command pattern to add new default gateway is route add default gw.
For example :
When we use route add command above, the change that we made is not permanent, The changes will back to old value when the machine reboot. To make the change permanent, you have to edit file /etc/sysconfig/network, find line
GATEWAY=192.168.1.1
This changes the gateway IP to the new gateway.

Good Luck For You!!

1 comments:

  1. Lagardere digital horoscope azteque

    Take a look at my homepage - voyance gratuite

    ReplyDelete

 
Toggle Footer