Linux ifconfig 查看网络接口状态

Linux ifconfig 如果不接任何参数,就会输出当前网络接口的情况;

  1. [root@localhost ~]# Linux ifconfig  
  2. eth0      Link encap:Ethernet  HWaddr 00:C0:9F:94:78:0E  
  3. inet addr:192.168.1.88  Bcast:192.168.1.255  Mask:255.255.255.0  
  4. inet6 addr: fe80::2c0:9fff:fe94:780e/64 Scope:Link  
  5. UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
  6. RX packets:850 errors:0 dropped:0 overruns:0 frame:0  
  7. TX packets:628 errors:0 dropped:0 overruns:0 carrier:0  
  8. collisions:0 txqueuelen:1000  
  9. RX bytes:369135 (360.4 KiB)  TX bytes:75945 (74.1 KiB)  

10. Interrupt:10 Base address:0x3000  

  1. 11.  

12. lo        Link encap:Local Loopback  

13. inet addr:127.0.0.1  Mask:255.0.0.0  

14. inet6 addr: ::1/128 Scope:Host  

15. UP LOOPBACK RUNNING  MTU:16436  Metric:1  

16. RX packets:57 errors:0 dropped:0 overruns:0 frame:0  

17. TX packets:57 errors:0 dropped:0 overruns:0 carrier:0  

18. collisions:0 txqueuelen:0  

19. RX bytes:8121 (7.9 KiB)  TX bytes:8121 (7.9 KiB)  

解说:eth0 表示第一块网卡, 其中 HWaddr 表示网卡的物理地址,我们可以看到目前这个网卡的物理地址(MAC地址)是 00:C0:9F:94:78:0E ; inet addr 用来表示网卡的IP地址,此网卡的 IP地址是 192.168.1.88, 广播地址, Bcast:192.168.1.255,掩码地址Mask:255.255.255.0

lo 是表示主机的回坏地址,这个一般是用来测试一个网络程序,但又不想让局域网或外网的用户能够查看,只能在此台主机上运行和查看所用的网络接口。比如我们把HTTPD服务器的指定到回坏地址,在浏览器输入 127.0.0.1 就能看到你所架WEB网站了。但只是您能看得到,局域网的其它主机或用户无从知道;

如果我们想知道主机所有网络接口的情况,请用下面的命令; [root@localhost ~]# Linux ifconfig -a 如果我们想查看某个端口,比如我们想查看eth0 的状态,就可以用下面的方法;[root@localhost ~]# Linux ifconfig eth0

猜你喜欢

转载自www.cnblogs.com/fanweisheng/p/11109273.html