今天刚搬到新家,ubuntu一启动,无线网络又连不上了,之前就是大费周折才搞好的,于是又花了两小时才搞好。

下面就先来了解一些基础知识:

1. ifconfig输出的eth0/lo/wlan0分别代表什么?

eth0      Link encap:Ethernet  HWaddr bc:ee:7b:c7::ed
UP BROADCAST MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 B) TX bytes: (0.0 B)
Interrupt: eth0:avahi Link encap:Ethernet HWaddr bc:ee:7b:c7::ed
inet addr:169.254.10.167 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU: Metric:
Interrupt: lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::/ Scope:Host
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (107.1 KB) TX bytes: (107.1 KB) wlan0 Link encap:Ethernet HWaddr :0a::6d::1f
inet addr:192.168.0.7 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::260a:64ff:fe6d:31f/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (3.4 MB) TX bytes: (801.8 KB)
  • eth0: 代表以太网的有线网卡接口,如果电脑上的有线网卡只有1个,ifconfig却能看到eth1/eth2,那么说明有虚拟网卡被创建
  • lo: localhost, 也就代表了127.0.0.1,127.0.0.1是私有回环测试地址,就是本机地址,内网IP是不可以回环的,常用来做本机既是主又是从的测试使用。
  • wlan0: 无线网卡对应的接口

2. rfkill unblock all

今天就是用这条命令把电脑的无线网重新用起来的,之前用rfkill list看wireless lan的soft/hard block都是no, 所以就没纠结在此,没想到最后还是这个。

Many computer systems contain radio transmitters, including Wi-Fi, Bluetooth, and 3G devices. These devices consume power, which is wasted when the device is not in use.
RFKill is a subsystem in the Linux kernel that provides an interface through which radio transmitters in a computer system can be queried, activated, and deactivated. When transmitters are deactivated, they can be placed in a state where software can reactive them (a soft block) or where software cannot reactive them (a hard block).

也就是说rfkill是linux的一个子系统,可以用它来激活/取消激活一些WIFI/Bluetooth/3G等设备。

可以使用rfkill block wifi或者rfkill unblock wifi来取消激活和激活wifi.

3. /etc/network/interfaces和/etc/init.d/networking

04-14 03:56