@maorongrong
2017-11-20T15:05:50.000000Z
字数 4670
阅读 643
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 all0: phy0: Wireless LANSoft blocked: noHard blocked: no# but if I type shortkey (Fn+F5) to turn off wifi light, it's soft blocked!amy@heizi:~$ rfkill list all0: phy0: Wireless LANSoft blocked: yesHard 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 0amy@heizi:~$ rfkill list all0: phy0: Wireless LANSoft blocked: noHard blocked: no# so if I use wifi hard-buttun under the Laptap to turn off wifi light.amy@heizi:~$ rfkill list all0: phy0: Wireless LANSoft blocked: yesHard blocked: yesamy@heizi:~$ cat /sys/class/rfkill/rfkill0/soft1amy@heizi:~$ cat /sys/class/rfkill/rfkill0/hard1# use cmd (rfkill unblock 0) just unblock soft blocked!!!amy@heizi:~$ rfkill unblock allamy@heizi:~$ rfkill list all0: phy0: Wireless LANSoft blocked: noHard blocked: yes# 本想通过强制更改hard block状态为0(unblocked),但是发现该文件mode为root:root 444!amy@heizi:~$ sudo -i echo 0 > /sys/class/rfkill/rfkill0/hardbash: /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/hardroot@heizi:~# sudo -i echo 0 > /sys/class/rfkill/rfkill0/hard-bash: 第 0 行: echo: 写错误: 输入/输出错误# 还是不行啊,所以细心点吧,自己手动把wifi开关打开吧!
sudo lshw -C net
amy@heizi:~$ sudo lshw -C net*-networkdescription: Ethernet interfaceproduct: 82566MM Gigabit Network Connectionvendor: Intel Corporationphysical id: 19logical name: enp0s25capacity: 1Gbit/s......(以太网卡信息略过)......*-networkdescription: Wireless interfaceproduct: PRO/Wireless 3945ABG [Golan] Network Connectionvendor: Intel Corporationphysical id: 0bus info: pci@0000:03:00.0logical name: wls3version: 02serial: 00:1f:3c:c2:f6:fewidth: 32 bitsclock: 33MHzcapabilities: pm msi pciexpress bus_master cap_list ethernet physical wirelessconfiguration: 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.11abgresources: irq:29 memory:dfcff000-dfcfffff# 记住点网卡逻辑名 wls3, 以及driver名 iwl3945;
OK!!! 我们来看看,打开wifi硬阻塞后,查看lshw -C net情况:
amy@heizi:~$ rfkill list all #硬阻塞0: phy0: Wireless LANSoft blocked: yesHard blocked: yesamy@heizi:~$ rfkill unblock allamy@heizi:~$ rfkill list all0: phy0: Wireless LANSoft blocked: noHard blocked: yesamy@heizi:~$ sudo lshw -C net # 查看网络硬件信息*-network DISABLEDdescription: Wireless interfaceproduct: PRO/Wireless 3945ABG [Golan] Network Connection...physical id: 0logical 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.11abgresources: 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:~$ lsmodModule Size Used byipt_MASQUERADE 16384 1xfrm_user 32768 1xfrm_algo 16384 1 xfrm_useriptable_nat 16384 1nf_conntrack_ipv4 16384 2nf_defrag_ipv4 16384 1 nf_conntrack_ipv4nf_nat_ipv4 16384 1 iptable_natiptable_filter 16384 1ip_tables 24576 2 iptable_filter,iptable_natx_tables 36864 5 ip_tables,ipt_MASQUERADE,xt_conntrack,iptable_filter,xt_addrtype......bridge 126976 1 br_netfilter......kvm 544768 1 kvm_inteliwl3945 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 -rfor 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的文件里。