Centos/Linux下如何查看网关地址/Gateway地址
2015-09-10 16:49
579 查看
Centos/Linux下如何查看网关地址/Gateway地址? Linux下查看网关的命令还是很多的,不过如果IP是DHCP获取,那么有些命令是不适用的,当然也有通用的查询网关命令.
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
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
相关文章推荐
- Linux多线程(转)
- linux下如何从终端打开文件夹,并且获取管理员权限
- 深刻理解Linux进程间通信(IPC)
- 个人学习笔记---软中断(下半部)和软件中断(系统调用)的区别
- Linux vmstat命令实战详解
- virualbox 复制linux,启用网卡报错:device "eth0" does not seem to be present, delaying initialization
- linux safe-rm
- Linux iostat监测IO状态
- Linux服务器定时备份脚本
- Ubuntu与Windows双系统安装流程
- 使用过的Linux命令
- Linux 内核的排队自旋锁(FIFO Ticket Spinlock)
- 虚拟机VMware安装ArchLinux
- LINUX下动态库及版本号控制
- 一个计时类,可以同时用在windows 和 linux 环境下
- ARM板烧录LinuxQt程序步骤
- 如何查看系统是 centos 还是 redhat
- linux yum-updatesd进程占用内存过多
- [部署]CentOS yum源
- boost 1.47.0 linux/windows 编译库:regex与iostreams