@maorongrong
2017-11-20T15:05:50.000000Z
字数 4670
阅读 509
Linux
本本无线网络经常会出现问题,首先需要判断什么问题,是否涉及到需要手动安装驱动。
sudo rfkill list all
phsical id
及其 Soft Block
,Hard Block
状态:
# List the current state of all available rfkill-using devices(wireless devices), good, all is unblocked!
amy@heizi:~$ rfkill list all
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
# but if I type shortkey (Fn+F5) to turn off wifi light, it's soft blocked!
amy@heizi:~$ rfkill list all
0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: no
# so let's use command (rfkill unblock IDENTIFIER where IDENTIFIER is the index no. of an rfkill switch or one of: <idx> all wifi wlan bluetooth uwb ultrawideband wimax wwan gps fm nfc) to turn up! OOOps, it works!
amy@heizi:~$ rfkill unblock 0
amy@heizi:~$ rfkill list all
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
# so if I use wifi hard-buttun under the Laptap to turn off wifi light.
amy@heizi:~$ rfkill list all
0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: yes
amy@heizi:~$ cat /sys/class/rfkill/rfkill0/soft
1
amy@heizi:~$ cat /sys/class/rfkill/rfkill0/hard
1
# use cmd (rfkill unblock 0) just unblock soft blocked!!!
amy@heizi:~$ rfkill unblock all
amy@heizi:~$ rfkill list all
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes
# 本想通过强制更改hard block状态为0(unblocked),但是发现该文件mode为root:root 444!
amy@heizi:~$ sudo -i echo 0 > /sys/class/rfkill/rfkill0/hard
bash: /sys/class/rfkill/rfkill0/hard: 权限不够
amy@heizi:~$ ll /sys/class/rfkill/rfkill0/hard
-r--r--r-- 1 root root 4096 11月 20 21:21 /sys/class/rfkill/rfkill0/hard
# 那咱强改文件mode,再试
root@heizi:~# chmod 744 /sys/class/rfkill/rfkill0/hard
root@heizi:~# sudo -i echo 0 > /sys/class/rfkill/rfkill0/hard
-bash: 第 0 行: echo: 写错误: 输入/输出错误
# 还是不行啊,所以细心点吧,自己手动把wifi开关打开吧!
sudo lshw -C net
amy@heizi:~$ sudo lshw -C net
*-network
description: Ethernet interface
product: 82566MM Gigabit Network Connection
vendor: Intel Corporation
physical id: 19
logical name: enp0s25
capacity: 1Gbit/s
......(以太网卡信息略过)......
*-network
description: Wireless interface
product: PRO/Wireless 3945ABG [Golan] Network Connection
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:03:00.0
logical name: wls3
version: 02
serial: 00:1f:3c:c2:f6:fe
width: 32 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwl3945 driverversion=4.4.0-98-generic firmware=15.32.2.9 ip=192.168.1.113 latency=0 link=yes multicast=yes wireless=IEEE 802.11abg
resources: irq:29 memory:dfcff000-dfcfffff
# 记住点网卡逻辑名 wls3, 以及driver名 iwl3945;
OK!!! 我们来看看,打开wifi硬阻塞后,查看lshw -C net
情况:
amy@heizi:~$ rfkill list all #硬阻塞
0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: yes
amy@heizi:~$ rfkill unblock all
amy@heizi:~$ rfkill list all
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes
amy@heizi:~$ sudo lshw -C net # 查看网络硬件信息
*-network DISABLED
description: Wireless interface
product: PRO/Wireless 3945ABG [Golan] Network Connection
...
physical id: 0
logical name: wls3
...
configuration: broadcast=yes driver=iwl3945 driverversion=4.4.0-98-generic firmware=15.32.2.9 latency=0 link=no multicast=yes wireless=IEEE 802.11abg
resources: irq:29 memory:dfcff000-dfcfffff
我的ThinkPad carbon one第一代确实老了, 总是wifi几个小时之后莫名其妙drop 问题。
lsmod
lsmod is a trivial program which nicely formats the contents of the /proc/modules, showing what kernel modules are currently loaded.
amy@heizi:~$ lsmod
Module Size Used by
ipt_MASQUERADE 16384 1
xfrm_user 32768 1
xfrm_algo 16384 1 xfrm_user
iptable_nat 16384 1
nf_conntrack_ipv4 16384 2
nf_defrag_ipv4 16384 1 nf_conntrack_ipv4
nf_nat_ipv4 16384 1 iptable_nat
iptable_filter 16384 1
ip_tables 24576 2 iptable_filter,iptable_nat
x_tables 36864 5 ip_tables,ipt_MASQUERADE,xt_conntrack,iptable_filter,xt_addrtype
......
bridge 126976 1 br_netfilter
......
kvm 544768 1 kvm_intel
iwl3945 69632 0
iwconfig
sudo iwlist wls3 scanning [essid,eg FAST_D16E]
iwconfig
已经有的和没有的信息。lspci | grep -i net
lspci is a utility for displaying information about PCI buses in the system and devices connected to them.
Host bridge: <==主板芯片
VGA compatible controller <==显卡
Audio device <==音频设备
PCI bridge <==接口插槽
USB Controller <==USB控制器
ISA bridge
IDE interface
SMBus
Ethernet controller <==网卡
sudo ifconfig wls3 down/up
Ifconfig is used to configure the kernel-resident network interfaces.
It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
sudo rmmod -f iwl3945
rmmod is a trivial program to remove a module (when module unloading support is provided) from the kernel. Most users will want to use modprobe(8) with the -r option instead.
用 rmmod
命令主要用于卸载正在使用的Linux内核模块,与 modprobe -r
命令相似。
sudo modprobe iwl3945 11n_disable=1
modprobe intelligently adds or removes a module from the Linux kernel:
note that for convenience, there is no difference between _ and - in module names.
modprobe looks in the module directory /lib/modules/uname -r
for all the modules and other files, except for the optional configuration files in the /etc/modprobe.d directory。
dmesg
dmesg命令设备故障的诊断是非常重要的。将系统启动信息保存到文件中:
$ sudo dmesg > messages.txt
Linux命令dmesg用来显示开机信息,kernel会将开机信息存储在ring buffer中。您若是开机时来不及查看信息,可利用dmesg来查看。开机信息亦保存在/var/log目录中,名称为dmesg的文件里。