IEEE 802.11 k/r/s 说明

IEEE 802.11k

IEEE 802.11k阐述了无线局域网中频谱测量所能提供的服务,并以协议方式规定了测量的类型及接收发送的格式。此协议制定了几种有测量价值的频谱资源信息,并创建了一种请求/报告机制,使测量的需求和结果在不同终端之间进行通信。协议制定小组的工作目标是要使终端设备能够通过对测量信息的量读做出相应的传输调整,为此,协议制定小组定义了测量类型。

这些测量报告使在IEEE 802.11规范下的无线网络终端可以收集临近AP的信息(信标报告)和临近终端链路性质信息(帧报告,隐藏终端报告和终端统计报告)。测量终端还可以提供信道干扰水平(噪声柱状报告)和信道使用情况(信道负荷报告和介质感知柱状图)。

IEEE802.11r

IEEE802.11r-2008,或快速BSS切换(英语:Fast Basic Service Set Transition,简称FT),也称为快速漫游,是一项IEEE802.11标准的修正案,于2008年7月15日发布,并被收录在802.11-2012中[1]。其允许移动中的无线设备以不断开链接的方式,快速和安全地在热点之间无缝切换。

IEEE802.11s

IEEE 802.11s,电机电子工程师学会(IEEE)标准之一,为802.11中对于无线网状网络的延伸与增补标准(amendment)。它规范了无线装置之间如何进行互动,以形成 WLAN网状网络,可以被用来形成无线随意网络。

它扩展了 IEEE 802.11 介质访问控制(MAC)标准,定义了利用自我组态的多点跳跃拓朴(multi-hop topologies),进行无线感知(radio-aware metrics),以支援广播、群播与单播传送网络封包的架构与协定。

来源

https://zh.wikipedia.org/wiki/IEEE_802.11

DHT22温湿度传感器的使用

使用python读取dht22温湿度传感器的值。

 import sys
 import Adafruit_DHT
 import requests
 import json
 url = 'https://www.3gcomet.com/iot/iot_receive.php'
 sensor = Adafruit_DHT.DHT22
 pin = 4
 humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
 if humidity is not None and temperature is not None:
     temp = '{:.1f}'.format(temperature)
     humi = '{:.1f}'.format(humidity)
     payload = {"ac":'iotofict',"loc":'CloudDC',"tem":temp,"hum":humi}
     response = requests.post(url=url,data=payload)
     print(response.text)
     #print('Temp={0:0.1f}*  Humidity={1:0.1f}%'.format(temperature, humidity))
 else:
     print('Failed to get reading. Try again!')
     sys.exit(1)

常用温湿度传感器比较

SensorDHT11DHT22 (AM2302)LM35DS18B20BME280BMP180
MeasuresTemperature
Humidity
Temperature
Humidity
TemperatureTemperatureTemperature
Humidity
Pressure
Temperature
Pressure
Communication
protocol
One-wireOne-wireAnalogOne-wireI2C
SPI
I2C
Supply
voltage
3 to 5.5V DC3 to 6V DC4 to 30 V DC3 to 5.5V DC1.7 to 3.6V (for the chip) 3.3 to 5V for the board1.8 to 3.6V (for the chip) 3.3 to 5V for the board
Temperature
range
0 to 50ºC-40 to 80ºC-55 to 150ºC-55 to 125ºC-40 to 85ºC0 to 65ºC
Accuracy+/- 2ºC (at 0 to 50ºC)+/- 0.5ºC (at -40 to 80ºC)+/-0.5ºC (at 25ºC)+/-0.5ºC (at -10 to 85ºC)+/-0.5ºC (at 25ºC)+/-0.5ºC (at 25ºC)
Support
(Arduino IDE)
Adafruit DHT Library

Adafruit Unified Sensor Library
Adafruit DHT Library

Adafruit Unified Sensor Library
analogRead()DallasTemperature

OneWire
Adafruit BME280 library

Adafruit Unified Sensor Library
Adafruit BME085

Adafruit Unified Sensor Library
Support
(MicroPython)
dht module (included in MicroPython firmware)dht module (included in MicroPython firmware)from machine import ADC
ADC().read
ds18b20 module (included in MicroPython firmware)BME280 Adafruit LibraryBMP180 module

Proxmox集群配置

使用Proxmox 5.4进行集群配置,支持冷迁移。没有配置共享存储,不支持热迁移。

1 环境准备

1.1网络

pve2 192.168.189.2 集群主

pve3 192.168.189.3

pve4 192.168.189.4

openwrt 192.168.189.254

1.2主机名

/etc/hosts

192.168.189.2 pve2 pve2.ict.com

192.168.189.3 pve3 pve3.ict.com

192.168.189.4 pve4 pve4.ict.com

1.3硬盘

除开安装系统的盘,另外有一个500G的SCSI硬盘,路径为 /dev/sdb

1.4重新生成密钥对

root@pve2:~# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa already exists. Overwrite (y/n)? y Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub.

cat .ssh/id_rsa.pub > .ssh/authorized_keys

1.5改源

没有付费,那就去掉企业版的源,用免费的。

sed -i 's/deb/#deb/g' /etc/apt/sources.list.d/pve-enterprise.list

echo "deb http://download.proxmox.com/debian/pve stretch pve-no-subscription" >/etc/apt/sources.list.d/pve-install-repo.list

wget http://download.proxmox.com/debian/proxmox-ve-release-5.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-5.x.gpg

apt update && apt dist-upgrade

1.6安装常用工具

安装net-tools , ntpdate, vim,openvswitch-switch

apt install ntpdate net-tools vim

apt install openvswitch-switch

1.7同步时间

ntpdate-debian

1.8注意

三台主机都要操作第4~7步骤。

2 建立集群

2.1创建集群

通过网页操作, 在pve2上建立集群。

2.2加入集群

通过网页操作,加入时需复制主控机的信息到本机。

frp 安装与配置

1 Download

wget https://github.com/fatedier/frp/releases/download/v0.23.1/frp_0.23.1_linux_amd64.tar.gz

2 Install

tar xvf frp_0.23.1linux_amd64.tar.gz
mv frp_0.23.1_linux_amd64 frp
mv ./frp/frps /bin/
mv ./frp/frpc /bin/
mv frp /etc

3 Configure Server Service

vi /etc/frp/frps.ini

[common]

bind_port = 6666
vhost_http_port = 8666
dashboard_port = 8667
dashboard_user = comet
dashboard_pwd = 12345678
privilege_token = 3gcomet
allow_ports = 20001-49999
log_file = /var/log/frps.log
log_level = info
log_max_days = 7

4 Enable Server Service

vi /lib/systemd/system/frps.service

[Unit]
Description=frps
After=network.target

[Service]
TimeoutStartSec=30
ExecStart=/bin/frps -c /etc/frp/frps.ini
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

systemctl enable frps
systemctl start frps

5 Configure Client Service

Repeat Step No.1 and Step No.2 to get frp in client mechine.

vi /etc/frp/frpc.ini

[common]

server_addr = f.3gcomet.com
server_port = 6666
privilege_token = 3gcomet

log_file = /var/log/frpc.log
log_level = info
log_max_days = 3

[ssh204]

type = tcp
local_ip = 127.0.0.1
local_port = 9230
remote_port = 20422

[web204]

type = http
local_port = 80
local_ip = 127.0.0.1
remote_port = 20480
custom_domains = test.3gcomet.com

6 Enable Client Service

vi /lib/systemd/system/frpc.service

[Unit]
Description=frpc
After=network.target

[Service]
TimeoutStartSec=30
ExecStart=/bin/frpc -c /etc/frp/frpc.ini
ExecStop=/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

systemctl enable frpc
systemctl start frpc

7 Configure DNS

set test.3gcomet.com to the frp server.

8 Connect

ssh -p 20422 test.3gcomet.com
w3m http://test.3gcomet.com:8666

在OMV4下使用树莓派3B+的无线网卡

1 更新系统

apt-get update

apt-get upgrade

2 安装rpi-update并更新

apt-get install rpi-update

rpi-update

3 更新固件

wget https://archive.raspberrypi.org/debian/pool/main/f/firmware-nonfree/firmware-brcm80211_20161130-3+rpt4_all.deb

dpkg -i firmware-brcm80211_20161130-3+rpt4_all.deb

4 连接wifi

nmtui connect

解决win10不能访问samba共享问题

0 问题情况

win10 访问samba共享(如linux、NAS等系统的共享文件夹)时,提示“你没有权限访问\IP\folder。请与网络管理员联系请求访问权限。”

1 安装cifs共享支持

在控制面板-程序和功能-启用或关闭 Windows 功能,安装 SMB 1.0/CIFS 文件共享支持中的 SMB 1.0/CIFS 客户端。

2 更改本地组策略

运行 gpedit.msc 打开本地组策略,找到计算机配置-管理模板-网络-Lanman 工作站中的不安全的来宾登录,启用该配置。

3 添加凭证

在控制面板-用户帐户-凭证管理器-管理 Windows 凭据,添加 Windows 凭据,输入samba服务器的网络地址、用户名、密码。

4 重启系统

重启 Windows 10,登录后访问samba服务器,可以利用刚才添加到用户访问到共享。

查看mysql数据库及表编码格式

1.查看数据库编码格式

1mysql> show variables like 'character_set_database';

 2.查看数据表的编码格式

1mysql> show create table <表名>;

 3.创建数据库时指定数据库的字符集

mysql>create database <数据库名> character set utf8;

4.创建数据表时指定数据表的编码格式

create table tb_books (     
name varchar(45) not null,
price double not null,
bookCount int not null,
author varchar(45) not null
)
default charset = utf8;

5.修改数据库的编码格式

mysql>alter database <数据库名> character set utf8;

6.修改数据表格编码格式

mysql>alter table <表名> character set utf8;

7.修改字段编码格式

mysql>alter table <表名> change <字段名> <字段名> <类型> character set utf8; 
mysql>alter table user change username username varchar(20) character set utf8 not null;

 8.添加外键

mysql>alter table tb_product add constraint fk_1 foreign key(factoryid) references tb_factory(factoryid); 
mysql>alter table <表名> add constraint <外键名> foreign key<字段名> REFERENCES <外表表名><字段名>;

9.删除外键

mysql>alter table tb_people drop foreign key fk_1; 
mysql>alter table <表名> drop foreign key <外键名>;

docker-compose命令

#1.docker-compose

Compose 是一款用于使用 Docker 定义和运行复杂应用的工具。借助 Compose,您可以在单个文件中 定义一个多容器应用,然后在一条命令中激增您的应用,该命令可以执行使此应用运行所需完成的全部操作。

也称为: docker-compose, fig

#2.命令
docker-compose build docker-compose build
docker-compose bundle Create a distributed application bundle from the Compose file.
docker-compose config Config validates and view the compose file.
docker-compose create Create creates containers for a service.
Docker Compose release notes Release notes for Docker Compose
docker-compose down docker-compose down
docker-compose events Receive real time events from containers.
docker-compose exec docker-compose exec
docker-compose help docker-compose help
docker-compose images Lists images used by the project.
docker-compose kill Forces running containers to stop.
docker-compose pause Pauses running containers for a service.
docker-compose port Prints the public port for a port binding.s
docker-compose ps Lists containers.
docker-compose pull Pulls service images.
docker-compose push Pushes service images.
docker-compose restart Restarts Docker Compose services.
docker-compose rm Removes stopped service containers.
docker-compose run Runs a one-off command on a service.
docker-compose scale Sets the number of containers to run for a service.
docker-compose start Starts existing containers for a service.
docker-compose stop Stops running containers without removing them.
docker-compose top Displays the running processes.
docker-compose unpause Unpauses paused containers for a service.
docker-compose up Builds, (re)creates, starts, and attaches to containers for a service.