找回密码
 立即注册
搜索
热搜: 流水 密码
查看: 51|回复: 0

CentOS 查看网关

[复制链接]

395

主题

120

回帖

2271

积分

管理员

积分
2271
发表于 2024-8-8 09:15:31 | 显示全部楼层 |阅读模式
查看网关
ip route show


查看IP地址
ifconfig -a
ifconfig
CentOS7.9-2009        ip addr


查看DNS
cat /etc/resolv.conf


默认网关
netstat -rn


查看默认网关
route -n


















标签:netmask   otp   ipa   sysconf   des   efault   .com   kernel   rpo   

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

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

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



[root@www.ctohome.com]# 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




[root@www.ctohome.com]# 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




[root@www.ctohome.com]# 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


[root@www.ctohome.com]# 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



[root@www.ctohome.com]#  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查看网关

标签:netmask   otp   ipa   sysconf   des   efault   .com   kernel   rpo   

原文地址:https://www.cnblogs.com/thoughtful-actors/p/9096991.html



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|红河在线

GMT+8, 2026-2-11 22:25 , Processed in 0.210191 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表