注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

星期五

明天不上班

 
 
 

日志

 
 
关于我

一个特立独行的Java程序员,比较宅,上上网,写博客,听音乐,看电影。

网易考拉推荐

获取IP地址和Mac地址方法(AIX,HP-UX,SUN,Linux)  

2011-10-25 19:04:50|  分类: Linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
1.HP-UX (测试环境 HP-UX_B.11.31)
获取网卡信息

所有网卡列表
# netstat -in
Name      Mtu  Network         Address         Ipkts              Ierrs Opkts              Oerrs Coll
lan0      1500 172.25.238.0    172.25.238.203  168806491          0     168284607          0     0  
lo0      32808 127.0.0.0       127.0.0.1       2275260            0     2275260            0     0  

IP信息
# ifconfig lan0
lan0: flags=1843<UP,BROADCAST,RUNNING,MULTICAST,CKO>
        inet 172.25.238.203 netmask ffffff00 broadcast 172.25.238.255

MAC地址
# lanscan -ia
0x0018FE8C6FC9 lan0 snap0

2.AIX (测试环境 AIX_5.3.0.0)
获取网卡信息

网卡列表和IP信息
# ifconfig -a
en0: flags=4e080863,80<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG,CHAIN>
        inet 172.25.238.107 netmask 0xffffff00 broadcast 172.25.238.255
        inet6 2ffe:ffff:0:f101::220/64
lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
        inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
        inet6 ::1/0
         tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1

获取en0的MAC地址
# entstat en0
-------------------------------------------------------------
ETHERNET STATISTICS (en0) :
Device Type: IBM 10/100 Mbps Ethernet PCI Adapter (23100020)
Hardware Address: 00:06:29:6c:d4:58
Elapsed Time: 76 days 20 hours 59 minutes 22 seconds
 
Transmit Statistics:                          Receive Statistics:
--------------------                          -------------------
Packets: 3413899458                           Packets: 3458651727
Bytes: 532996177731                           Bytes: 812430639716
Interrupts: 1356911                           Interrupts: 3353062899
Transmit Errors: 3                            Receive Errors: 0
Packets Dropped: 2                            Packets Dropped: 411
                                              Bad Packets: 0
Max Packets on S/W Transmit Queue: 189      
S/W Transmit Queue Overflow: 0
Current S/W+H/W Transmit Queue Length: 1
 
Broadcast Packets: 17469                      Broadcast Packets: 21073429
Multicast Packets: 52201                      Multicast Packets: 165786
No Carrier Sense: 0                           CRC Errors: 0
DMA Underrun: 3                               DMA Overrun: 0
Lost CTS Errors: 0                            Alignment Errors: 0
Max Collision Errors: 0                       No Resource Errors: 0
Late Collision Errors: 0                      Receive Collision Errors: 0
Deferred: 0                                   Packet Too Short Errors: 411
SQE Test: 0                                   Packet Too Long Errors: 0
Timeout Errors: 0                             Packets Discarded by Adapter: 0
Single Collision Count: 0                     Receiver Start Count: 0
Multiple Collision Count: 0
Current HW Transmit Queue Length: 1
 
General Statistics:
-------------------
No mbuf Errors: 0
Adapter Reset Count: 0
Adapter Data Rate: 200
Driver Flags: Up Broadcast Running
        Simplex AlternateAddress 64BitSupport
        PrivateSegment DataRateSet


3.SUN (测试环境 Solaris_10_11/06_s10s_u3wos_10_SPARC)

获取网卡信息
# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 172.25.238.189 netmask ffffff00 broadcast 172.25.238.255
        ether 0:3:ba:94:2c:f6

4.Linux (测试环境 Red Hat Enterprise Linux Server release 5.4 (Tikanga))

获取网卡信息
# /sbin/ifconfig  -a
eth0      Link encap:Ethernet  HWaddr 00:16:36:47:71:51 
          inet addr:172.17.9.233  Bcast:172.17.9.255  Mask:255.255.255.0
          inet6 addr: fe80::216:36ff:fe47:7151/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:443750485 errors:0 dropped:1 overruns:0 frame:0
          TX packets:459215844 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:66210623136 (61.6 GiB)  TX bytes:85706506984 (79.8 GiB)
          Interrupt:185 Base address:0xa000
 
eth1      Link encap:Ethernet  HWaddr 00:16:36:47:71:51 
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
 
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16366254 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16366254 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3697831614 (3.4 GiB)  TX bytes:3697831614 (3.4 GiB)
 
sit0      Link encap:IPv6-in-IPv4 
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
  评论这张
 
阅读(1523)| 评论(0)
推荐

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017