獲取openwrt mac位址

2021-10-09 08:20:41 字數 4937 閱讀 4009

在openwrt控制台輸入 ifconfig,可以獲取當前裝置網路資訊,mac位址也在其中,我們可以通過shell命令取出來。

br-lan    link encap:ethernet  hwaddr 52

:ce:c3:a0:

88:d7

inet addr:

192.168

.250

.10 bcast:

192.168

.250

.255 mask:

255.255

.255

.0 inet6 addr: fdc7:de6f:

69f5::

1/60 scope:global

inet6 addr: fe80:

:50ce:c3ff:fea0:

88d7/

64 scope:link

up broadcast running multicast mtu:

1500 metric:

1 rx packets:

842424 errors:

0 dropped:

0 overruns:

0 frame:

0 tx packets:

649856 errors:

0 dropped:

0 overruns:

0 carrier:

0 collisions:

0 txqueuelen:

1000

rx bytes:

84476314

(80.5 mib) tx bytes:

319068513

(304.2 mib)

eth0 link encap:ethernet hwaddr e2:

0a:ea:

0b:58

:89

inet6 addr: fe80:

:e00a:eaff:fe0b:

5889

/64 scope:link

up broadcast running multicast mtu:

1500 metric:

1 rx packets:

849411 errors:

0 dropped:

4 overruns:

0 frame:

0 tx packets:

715450 errors:

0 dropped:

0 overruns:

0 carrier:

0 collisions:

0 txqueuelen:

1000

rx bytes:

100066291

(95.4 mib) tx bytes:

333498099

(318.0 mib)

interrupt:

5 eth0.

1 link encap:ethernet hwaddr 52

:ce:c3:a0:

88:d7

up broadcast running multicast mtu:

1500 metric:

1 rx packets:

842513 errors:

0 dropped:

89 overruns:

0 frame:

0 tx packets:

687136 errors:

0 dropped:

0 overruns:

0 carrier:

0 collisions:

0 txqueuelen:

1000

rx bytes:

84480408

(80.5 mib) tx bytes:

321081969

(306.2 mib)

eth0.

2 link encap:ethernet hwaddr 52

:ce:c3:a0:

88:d8

inet6 addr: fe80:

:50ce:c3ff:fea0:

88d8/

64 scope:link

up broadcast running multicast mtu:

1500 metric:

1 rx packets:

0 errors:

0 dropped:

0 overruns:

0 frame:

0 tx packets:

28297 errors:

0 dropped:

0 overruns:

0 carrier:

0 collisions:

0 txqueuelen:

1000

rx bytes:0(

0.0 b) tx bytes:

9551819

(9.1 mib)

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:

65536 metric:

1 rx packets:

84361 errors:

0 dropped:

0 overruns:

0 frame:

0 tx packets:

84361 errors:

0 dropped:

0 overruns:

0 carrier:

0 collisions:

0 txqueuelen:

1 rx bytes:

7513025

(7.1 mib) tx bytes:

7513025

(7.1 mib)

tap0 link encap:ethernet hwaddr 7e:ef:b0:fd:50:

3e

up broadcast running multicast mtu:

1500 metric:

1 rx packets:

0 errors:

0 dropped:

0 overruns:

0 frame:

0 tx packets:

32473 errors:

0 dropped:

0 overruns:

0 carrier:

0 collisions:

0 txqueuelen:

100

rx bytes:0(

0.0 b) tx bytes:

3250540

(3.0 mib)

wlan0 link encap:ethernet hwaddr 30

:4a:26:

5b:fe:

84

inet addr:

192.168

.6.189 bcast:

192.168

.6.255 mask:

255.255

.255

.0 inet6 addr: fe80:

:324a:

26ff

:fe5b:fe84/

64 scope:link

up broadcast running multicast mtu:

1500 metric:

1 rx packets:

449934 errors:

0 dropped:

0 overruns:

0 frame:

0 tx packets:

339493 errors:

0 dropped:

0 overruns:

0 carrier:

0 collisions:

0 txqueuelen:

1000

rx bytes:

295640826

(281.9 mib) tx bytes:

62316576

(59.4 mib)

獲取有線上網wan口mac:

ifconfig

|grep eth0.2 |

awk''

52:ce:c3:a0:88:d8
獲取無線上網wan口mac:

ifconfig

|grep wlan0 |

awk''

30:4a:26:5b:fe:84
獲取lan口mac:

ifconfig

|grep br-lan |

awk''

52:ce:c3:a0:88:d7
在c語言中呼叫以上shell命令,返回值就是對應的mac。關於c語言中呼叫shell命令,可以看另一篇文章:c語言獲取linux shell命令返回值。

獲取IP位址

獲取ip位址 方法一 方法二 1.在asp.net 中專用屬性 獲取伺服器電腦名 page.server.manchinename 獲取使用者資訊 page.user 獲取客戶端電腦名 page.request.userhostname 獲取客戶端電腦ip page.request.userhost...

獲取MAC位址

簡單的辦法是在控制台輸入ping 目標ip,然後用 arp a 來檢視.或者下面的 記下來以備後用 private declare function inet addr function inet addr lib wsock32.dll byval s as string as int32 pri...

獲取IP位址

最簡單的就是安裝珊瑚蟲!與好友進行qq聊天是通過udp協議進行的,因此你首先要設定好kv2004防火牆,讓其自動監控udp埠,一旦發現有資料從udp埠進入的話,就將它自動記錄下來。在設定kv2004防火牆時,先單擊防火牆介面中的 規則設定 按鈕,然後單擊 新建規則 按鈕,彈出設定視窗 在該視窗的 名...