[网络]Linux一些网络知识

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

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

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

eth0      Link encap:Ethernet  HWaddr bc:ee:7b:c7:33:ed  
          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:17 

eth0:avahi Link encap:Ethernet  HWaddr bc:ee:7b:c7:33:ed  
          inet addr:169.254.10.167  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          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:65536  Metric:1
          RX packets:923 errors:0 dropped:0 overruns:0 frame:0
          TX packets:923 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:107174 (107.1 KB)  TX bytes:107174 (107.1 KB)

wlan0     Link encap:Ethernet  HWaddr 24:0a:64:6d:03:1f  
          inet addr:192.168.0.7  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::260a:64ff:fe6d:31f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6124 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5628 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3442818 (3.4 MB)  TX bytes:801863 (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

 

转载于:https://www.cnblogs.com/aaronLinux/p/6581517.html

你可能感兴趣的:([网络]Linux一些网络知识)