Centos/linux How to view the gateway address/gateway address

Source: Internet
Author: User

Centos/linux How to view the gateway address/gateway address? There are many commands to view the gateway under Linux, but if the IP is obtained by DHCP, then some commands are not applicable, and there are also common query gateway commands.



1.ifconfig-a and cat/etc/resolv.conf (main view ip/netmask and DNS)


2.netstat-rn


3.cat/etc/sysconfig/network


4.cat/etc/sysconfig/network-scripts/ifcfg-eth0


5.traceroute the first line is your own gateway


6.ip Route Show


7.route-n


These are the more common commands for querying gateways. Here's an example:


[[Email protected]]# netstat-rn

Kernel IP Routing Table

Destination Gateway genmask Flags MSS Window Irtt Iface

184.82.152.96 0.0.0.0 255.255.255.248 U 0 0 0 eth0

169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

0.0.0.0 184.82.152.97 0.0.0.0 UG 0 0 0 eth0


[[Email protected]]# cat/etc/sysconfig/network-scripts/ifcfg-eth0

# Intel Corporation 82567v-2 Gigabit Network Connection

Device=eth0

Bootproto=none

Hwaddr=00:1c:c0:f8:a1:ac

Onboot=yes

netmask=255.255.255.248

ipaddr=184.82.152.98

gateway=184.82.152.97

Type=ethernet


[[Email protected]]# IP Route Show

184.82.152.96/29 Dev eth0 proto kernel scope link src 184.82.152.98

169.254.0.0/16 Dev eth0 Scope link

Default via 184.82.152.97 Dev eth0



[[Email protected]]# route-n

Kernel IP Routing Table

Destination Gateway genmask Flags Metric Ref use Iface

184.82.152.96 0.0.0.0 255.255.255.248 U 0 0 0 eth0

169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

0.0.0.0 184.82.152.97 0.0.0.0 UG 0 0 0 eth0



[[Email protected]]# ifconfig-a

Eth0 Link encap:ethernet HWaddr 00:1c:c0:f8:a1:ac

inet addr:184.82.152.98 bcast:184.82.152.103 mask:255.255.255.248


This article from "Flat Light is true" blog, please be sure to keep this source http://ucode.blog.51cto.com/10837891/1893181

Centos/linux How to view the gateway address/gateway address

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.