Agl*_*tas 4 linux wifi command-line-interface
我在家里和工作中都使用我的个人笔记本电脑,在这两种情况下我都安装了 nfs 共享。我想在每次打开笔记本电脑时自动安装这些共享。
我不能让它成为一个正常的启动命令来运行,因为无线连接需要大约半分钟才能定位网络并连接。
所以我想写一个脚本,每 5 秒检查一次我是否连接到网络以及网络的 essid 是什么,以便我可以安装适当的共享。
我查看了 iwconfig 和 ifconfig,但没有一个返回 essid,只有一个实际的 IP 地址。
ifconfig 返回...
eth0 Link encap:Ethernet HWaddr 00:26:2d:a2:01:a8
UP 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)
Interrupt:16
eth1 Link encap:Ethernet HWaddr f0:7b:cb:45:36:b2
inet addr:192.168.0.48 Bcast:192.168.3.255 Mask:255.255.252.0
inet6 addr: fe80::f27b:cbff:fe45:36b2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30972 errors:0 dropped:0 overruns:0 frame:124824
TX packets:31414 errors:16 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25279206 (25.2 MB) TX bytes:4716009 (4.7 MB)
Interrupt:17
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:336 errors:0 dropped:0 overruns:0 frame:0
TX packets:336 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:48501 (48.5 KB) TX bytes:48501 (48.5 KB)
Run Code Online (Sandbox Code Playgroud)
iwconfig 返回...
lo no wireless extensions.
eth0 no wireless extensions.
eth1 IEEE 802.11 Access Point: Not-Associated
Link Quality:5 Signal level:210 Noise level:165
Rx invalid nwid:0 invalid crypt:0 invalid misc:0
vboxnet0 no wireless extensions.
Run Code Online (Sandbox Code Playgroud)
iwlist 没有返回任何有用的东西......
iwlist scan
lo Interface doesn't support scanning.
eth0 Interface doesn't support scanning.
eth1 Interface doesn't support scanning.
vboxnet0 Interface doesn't support scanning.
Run Code Online (Sandbox Code Playgroud)
有谁知道一种简单的方法来找出您通过 linux 命令行连接到的无线网络的 essid。
更新 我在上面添加了 ifconfig 和 iwconfig 信息,而且我正在运行 Ubuntu 10.10 并且它是从 10.04 升级的,这似乎与无线有些混乱。他们不再使用来自 gnome 的旧网络管理器应用程序。我也无法连接到我的学校无线网络,因此无线网络肯定有一些时髦的开始。
iwevent 返回...
iwevent
Waiting for Wireless Events from interfaces...
16:34:33.614296 eth1 Set ESSID:"" [13]
16:34:33.615723 eth1 Custom driver event:
16:34:33.615774 eth1 New Access Point/Cell address:Not-Associated
16:34:33.714835 eth1 Set ESSID:"" [62]
16:34:41.869636 eth1 Set Mode:Managed
16:34:41.869688 eth1 Set ESSID:"" [254]
16:34:42.815795 eth1 Custom driver event:
16:35:07.141450 eth1 Set Mode:Managed
16:35:07.141502 eth1 Set Frequency:24.12 GHz
16:35:07.141601 eth1 Set ESSID:"" [121]
16:35:08.160515 eth1 New Access Point/Cell address:00:1E:00:00:19:0E
16:35:08.252912 eth1 Registered node:00:1E:52:79:19:0E
16:35:08.252970 eth1 Custom driver event:
Run Code Online (Sandbox Code Playgroud)
小智 8
运行 iwgetid 可以获得无线设备和连接网络的 SSID。它是无线工具的一部分 - 您似乎已经安装了,因为 iwevent 也是其中的一部分。