How to Find Default Gateway IP address on Linux

Related Articles

A default gateway is the node (a router) or network point on the computer network that serves as an access point and entrance to another network. It passes traffic between different subnets and networks. Computers running on the network using IP, a default gateway address is needed to reach all computers that are not on the same local IP subnet. This post will show you how to Find default gateway IP address on linux operating system. This command has been tested on CentOS 6.3.

1. Print default gateway using route command :

[root@centos63 ~]# route

Output :

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     *        U     0      0        0 eth0
link-local      *          U     1002   0        0 eth0
default         UG    0      0        0 eth0

2. Print default gateway using netstat command :

[root@centos63 ~]# netstat -rn

Output :

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth0     U         0 0          0 eth0         UG        0 0          0 eth0

Note : The flag U indicates that route is up and G indicates that it is gateway.

Sign up for the WP Engine affiliate program and receive a minimum of $150 per referral!

As always if you need any help you can reach us on twitter @ehowstuff or drop us a comment below. Jumping through archives page to read more articles..

Skytech is a part time blogger that has over 6 years experience in servicing, repairing and configuring computers and administering the server systems.

Related Articles

Powered by WordPress · Designed by Theme Junkie