快速查看Linux网络状态

来源:互联网 发布:python 手写爬虫 编辑:程序博客网 时间:2024/05/19 09:15

快速查看Linux网络状态

1、查看各网卡的状态

ifconfig -a
包括IP,子网掩码

eth0      Link encap:Ethernet  HWaddr 00:0C:29:6E:EB:AB            inet addr:192.168.232.178  Bcast:192.168.232.255  Mask:255.255.255.0          inet6 addr: fe80::20c:29ff:fe6e:ebab/64 Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          RX packets:163336 errors:0 dropped:0 overruns:0 frame:0          TX packets:17220 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000           RX bytes:218194934 (208.0 MiB)  TX bytes:1780297 (1.6 MiB)


2、查看网关

route
通过路由查看网关等信息,其中有default的就是本地网关

Kernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface192.168.232.0   *               255.255.255.0   U     0      0        0 eth0link-local      *               255.255.0.0     U     1002   0        0 eth0default         192.168.232.2   0.0.0.0         UG    0      0        0 eth0


1 0