CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了CENTOS查看网关大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

---恢复内容开始--- 1.ifconfig -a 和 cat /etc/resolv.conf  (主要查看ip/netmask和dns) 2.netstat -rn 3.cat /etc/sysconfig/network 4.cat /etc/sysconfig/network-scripts/ifcfg-eth0 5.traceroute 第一行就是自己的网关 6.ip route sh

---恢复内容开始---

1.ifconfig -a 和 cat /etc/resolv.conf  (主要查看ip/netmask和dns)

2.netstat -rn

3.cat /etc/sysconfig/network

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

5.traceroute 第一行就是自己的网关

6.ip route show

7.route -n

以上几个是比较常用的查询网关的命令。下面是范例:

 

[[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


[@L_909_9@m]# 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

---恢复内容结束---

大佬总结

以上是大佬教程为你收集整理的CENTOS查看网关全部内容,希望文章能够帮你解决CENTOS查看网关所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。