Showing posts with label Cent OS. Show all posts
Showing posts with label Cent OS. Show all posts

Wednesday, April 22, 2020

Default gateway on CentOS



On Cent OS you can check the routing table with the following command:
$ route -n

The above command prints a table like this below:
Kernel IP routing table
Destination     Gateway        Genmask         Flags Metric Ref    Use Iface
10.254.1.0      0.0.0.0        255.255.255.0   U     0      0        0 eth0
192.168.185.0   0.0.0.0        255.255.255.0   U     0      0        0 eth1
0.0.0.0         192.168.185.2  0.0.0.0         UG    0      0        0 eth1


The last line of the table indicates the default gateway of the machine. In this case:
0.0.0.0         192.168.185.2  0.0.0.0         UG    0      0        0 eth1


Change default gateway
You can control default gateway using route command:
$ route del default gw <default_gateway_ip>
$ route add default gw <default_gateway_ip>


Keep in mind that this changes are only temporary. To change default gateway permanently you need to edit the file /etc/sysconfig/network and change to:
GATEWAY=<new_default_gateway_ip>



With many interfaces on the same sub-net it's also possible choose the preferred route to the default gateway with below command:

GATEWAYDEV=<network_interface>



How to Change IP Address in Bitnami Tomcat and configure SSH properly?

         How to change IP Address in Bitnami Tomcat and configure SSH properly?         While Configuring Bitnami Tomcat VM , I have to fac...