基于双栈服务器的原生IPv6地址,用V2ray解锁当地Netflix HBO等流媒体 2022-03-01

段落1、需求

服务器的IPv4看Netflix,没希望,被Netflix的IP地址库封的死死的,手里有一台服务器,它的IPv6地址是英国的原生IPv6,可以支持观看Netflix

那么,就简单了,我们通过配置让Netflix的流量走到IPv6出口即可

入站的流量通过服务器的IPv4地址进入,出站的Netflix流量通过原生IPv6出站,其余非Netflix流媒体的流量,还是通过IPv4出站

通过 基于sjlleo/netflix-verify,检测VPS服务器IP地址或节点IP是否支持Netflix流媒体 2022-2-28

段落2、部署操作

操作1-3

// 在routing的rules列表中增加Netflix的相关域名,指定它走IPv6的路由

  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "domain": [
          "netflix.com",
          "netflix.net",
          "netflixdnstest1.com",
          "netflixdnstest2.com",
          "netflixdnstest3.com",
          "netflixdnstest4.com",
          "netflixdnstest5.com",
          "netflixdnstest6.com",
          "netflixdnstest7.com",
          "netflixdnstest8.com",
          "netflixdnstest9.com",
          "netflixdnstest10.com",
          "netflixinvestor.com",
          "netflixtechblog.com",
          "nflxext.com",
          "nflximg.com",
          "nflximg.net",
          "nflxsearch.net",
          "nflxso.net",
          "nflxvideo.net",
          "geosite:netflix"
        ],
        "outboundTag": "IPv6_OUT"
      },
      {
        "type": "field",
        "outboundTag": "IPv4_OUT",
        "network": "udp,tcp"
      }
    ]
  },

操作2-3

// 在入站的inbounds中增加"sniffing"的参数

  "inbounds": [
    {
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "clients": [
          {
            "id": "dc0d52a2-c6c3-44e4-85cf-b479f736c378",
            "alterId": 0
          }
        ]
      },
      "port": 8080,
      "protocol": "vmess"
    }
  ],

操作3-3

// 在outbounds出站中区分开IPv4/IPv6两项内容

  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "IPv4_OUT"
    },
    {
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIPv6"
      },
      "tag": "IPv6_OUT"
    },
    {
      "settings": {},
      "protocol": "blackhole",
      "tag": "blocked"
    }
  ]

段落9、额外信息

同理,一些主流的支持IPv6的网站,也可以根据这个办法,进行IPv6分流

"geosite:netflix"
"geosite:google"
"geosite:youtube"

还有一种方式备用,sni+dnsmasq 分流

搭建完后,修改配置/etc/sniproxy.conf,设置ipv6优先,完重启机器

resolver {
    nameserver 8.8.8.8
    nameserver 8.8.4.4 # local dns should be better
    mode ipv6_first
}

系统环境Ubuntu 20.04或者Debian 10,安装MySQL 8数据库 2022-03-01

段落1、需求

在Ubuntu 20.04 LTS环境上,编译安装MySQL数据库

段落2、部署实施

更新包索引

apt-get update

安装MySQL Server

apt install mysql-server

安装的一些包信息如下

The following NEW packages will be installed:
  libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-7
  libevent-pthreads-2.1-7 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmecab2 libtimedate-perl liburi-perl mecab-ipadic
  mecab-ipadic-utf8 mecab-utils mysql-client-8.0 mysql-client-core-8.0
  mysql-common mysql-server mysql-server-8.0 mysql-server-core-8.0
0 upgraded, 25 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.4 MB of archives.
After this operation, 262 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

段落3、MySQL的安全加固

mysql_secure_installation
Press y|Y for Yes, any other key for No: y


LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

// 数据MySQL数据库root用户的密码,密码可自定义,假设密码为,CbA5_eaC8_b0d4_Ff0a_2b76,输入密码时候,密码不显示,直接输入按回车
New password: CbA5_eaC8_b0d4_Ff0a_2b76
Re-enter new password: CbA5_eaC8_b0d4_Ff0a_2b76


Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y

// 移除匿名用户
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y

// 禁止root远程登录
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N

// 移除测试库实例
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y

// 重载一下权限
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

段落4、创建数据库的普通帐号

root@UK-d68b93f1d5:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
// 数据库的版本信息
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)

// 进入数据库,需要输入刚刚的密码
root@server:~# mysql -u root -p

// 创建数据库的普通用户 wordpress,看你本地版本,选择创建普通用户的命令,二选一执行
// MySQL 8.0, caching_sha2_password is the default authentication plugin
// MySQL 5.7, mysql_native_password is the default
mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'wordpress_57AADFEF668Ae2E8E6285858';
mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED WITH mysql_native_password BY 'wordpress_57AADFEF668Ae2E8E6285858';

// 如果是删除普通用户 wordpress
mysql> DROP USER 'wordpress'@'localhost';

// 如果是删除普通的数据库实例 wordpress
mysql> drop database wordpress;

// 查看数据库中的用户
mysql> select User from mysql.user;

// 查看数据库中的数据库实例
mysql> show databases;

// 创建一个数据库实例 wordpress
// MySQL 8.0比较推荐使用 utf8mb4
// MySQL 5.5比较推荐使用 utf8
// MySQL supports two kinds of UTF8 character sets: utf8 and utf8mb4
// MySQL's utf8mb4 character table is a superset of BMP and contains also 4-bytes characters. This character tables is supported since MySQL 5.5.3
// MySQL version 5.5.3 or later, use the utf8mb4 character set
mysql> create database wordpress character set utf8mb4 collate utf8mb4_bin;
mysql> create database wordpress character set utf8 collate utf8_bin;

// 把普通数据库账号和数据库实例关联起来
mysql> GRANT ALL privileges ON wordpress.* to wordpress@localhost;

// 也可以只把某个表的权限给到数据库用户
mysql> GRANT PRIVILEGE ON wordpress.tablename TO 'wordpress'@'host';

// 如果是单项权限的修改,可参考命令
mysql> GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on wordpress.* TO 'wordpress'@'localhost' WITH GRANT OPTION;

// 权限生效
mysql> flush privileges;

// 推出交互
mysql> exit

// 查看MySQL服务状态 
systemctl status mysql.service
systemctl restart mysql.service

系统环境Ubuntu 20.04或者Debian 10,安装php 7.4版本 2022-03-01

需求

为了衔接Nginx和MySQL数据库,我们需要安装php

Nginx没有内在支持php,故而,我们需要PHP-FPM (“fastCGI process manager”)来驱动它

部署实施

更新包清单

apt update

安装

apt install php-fpm
// Ubuntu 20.04.4 LTS 安装的日志记录 2022-3-1
The following additional packages will be installed:
  php-common php7.4-cli php7.4-common php7.4-fpm php7.4-json php7.4-opcache
  php7.4-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php-common php-fpm php7.4-cli php7.4-common php7.4-fpm php7.4-json
  php7.4-opcache php7.4-readline
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,080 kB of archives.
After this operation, 18.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
Setting up php-fpm (2:7.4+75) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for php7.4-cli (7.4.3-4ubuntu2.9) ...
Processing triggers for php7.4-fpm (7.4.3-4ubuntu2.9) ...

查看服务的状态

systemctl status php7.4-fpm

增加修改对于Nginx的衔接

server {

    # . . . other code

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    }
}

重启服务

systemctl restart nginx

安装扩展模块,比如MySQL支持的模块

apt install php-mysql 

安装扩展模块,比如图片的模块

GD is an open source code library for the dynamic creation of images. GD is used for creating PNG, JPEG and GIF images and is commonly used to generate charts, graphics, thumbnails on the fly.

apt install php-gd

创建一个临时的PHP INFO测试文件,测试通的之后,记得删除

一般的路径为 /var/www/html/info.php

<?  phpinfo(); ?>

备注1, 一般推荐安装这个php 7.4的版本,不推荐安装旧的版本了。

基于sjlleo/netflix-verify,检测VPS服务器IP地址或节点IP是否支持Netflix流媒体 2022-2-28

需求描述

检测某个服务器的IP地址,或者节点服务器IP地址,是否持Netflix流媒体

项目地址

https://github.com/sjlleo/netflix-verify

如果检测Disney Plus

https://github.com/sjlleo/VerifyDisneyPlus

实践使用,一般如果是自己的服务器,在自己的amd64/Linux服务器上面执行如下:

mkdir /root/bin/
cd /root/bin/

# 获取文件
wget https://github.com/sjlleo/netflix-verify/releases/download/2.61/nf_2.61_linux_amd64

# 给到执行权限
chmod +x nf_2.61_linux_amd64 

# 测试Netflix支持情况,一般选用lite即可,如果要测试IPv6,选择参数full
./nf_2.61_linux_amd64 -method lite  
./nf_2.61_linux_amd64 -method full

如果本地的Windows电脑,则推荐使用clash for windows客户端的全局模式,配合进行检测

# 浏览器下载
https://github.com/sjlleo/netflix-verify/releases/download/2.61/nf_2.61_windows_amd64.exe

# 打开V2rayN-core 3.29的仅开启HTTP代理,不改变系统设置
# 打开CMD命令提示符,设置环境变量,即可执行检测。
set HTTP_PROXY=http://127.0.0.1:10809
set HTTPS_PROXY=http://127.0.0.1:10809

冷门的隧道协议Ping Tunnel,进阶配置,第二课,增加iptables双端限速 2022-02-27

段落1、前章

本篇章的Ping Tunnel进阶配置教程,承接上一篇,进阶第一课,在此基础上的配置需求,如果不了解Ping Tunnel项目基础用法,不了解增加入口服务器,前置代理的,请先看原先的两期教程和视频

基础教程

冷门的隧道协议PingTunnel概览,配置简单,可用于过市面上绝大部分的硬件防火墙 2021-12-12
https://dasmz.com/?p=867

进阶1

冷门的隧道协议Ping Tunnel,进阶配置,第一课,增加ping tunnel客户端国内云VPS入口服务器 2022-02-21
https://dasmz.com/?p=1404

段落2、概述

需求的由来:

大家在实际使用Ping Tunnel的过程中,会发现,带宽占用的问题,比如我这里的资源为

1、US服务器的配置为 1核心 1GB 15GB磁盘 500Mbps带宽,配置为Ping Tunnel服务端,操作系统为Ubuntu 20.04 LTS

2、CN沃云服务器配置为 1核心 1GB 20GB磁盘 6Mbps带宽,配置为Ping Tunnel客户端 + 前置入口代理Gost/SS服务端,操作系统为Ubuntu 18.04 LTS

3、CN自己的手机/电脑,配置为SS客户端

整体路由已经是优化的高QoS出口流量,但是,由于作为接入点的CN服务器,一般带宽都比较小(国内的商业宽带基本都很贵),所以,就像水流一样,这个数据流在这里形成了一个束缚。

故而,为了避免CN入口服务器的上行带宽被Ping Tunnel打满形成阻塞的情况,我们有必要进行双端的限速。

限速的方式,我这里推荐大家选iptables,简单实用。

段落3、配置实施

我这里的场景是端到端的TCP/IP协议簇里的ICMP协议的通信,有源IP地址,有目的IP地址,ICMP协议无端口。

iptables限速,一般可通过限制时间范围内的数据包个数来约束网络载荷。

CN服务器,带宽为6Mbps,折算其对外的上行速度为 6 * 1024 / 8 = 768.0 KB/s

先进行CN服务器,入站限速的配置,基于limit模块,进行统计匹配

基于PingTunnel的入口socks5,进行wget http/https下载测速,经过4论次的参数匹配的测速结果如下

# 创建测速脚本 /root/speedtest.sh
# 参数--limit-burst 20 即满足20秒次的突发

#!/bin/sh
rm /root/*_speedtest_report.txt
for speed in 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000
do
  echo "= = = = = = =  SPLIT  = = = = = = ="
  echo "GOGOGO "${speed}
  cd /root/
  /usr/sbin/iptables --flush
  /usr/sbin/iptables -A INPUT -s US服务器的IP地址 -p icmp -m icmp --icmp-type any -m limit --limit ${speed}/sec --limit-burst 20 -j ACCEPT
  /usr/sbin/iptables -A INPUT -s US服务器的IP地址 -p icmp -m icmp --icmp-type any -j DROP
  /usr/bin/proxychains4 -q wget -O /dev/null -o ${speed}_speedtest_report.txt https://mia.hostodo.com/10MB.test

done
# END

网络性能测试用例A,limit-burst参数定为20,前后多时间段,四轮次下载测速,结果如下

对照均值,建立图形可视

由图可发现,在 参数为 –limit 1500/second –limit-burst 20的时候,下载速度多次的均值为766.5KB/s,贴近我们这台CN服务器的网络性能。再往后,即便开放更高的包入站,也无法提升网络性能。故而,如果burst参数为20时候,这台CN入口服务器,优先选择1500/s的包过滤参数。

网络性能测试用例B,下面,我们把limit-burst参数设置为30,再进行一轮次测试

同样的,我们根据均值,建立折线图,可以根据图,观察到参数为 –limit 1500/second –limit-burst 30的时候,本次速度为838.75KB/s,基本实现网络性能最优组合。

如果为了保证贴近我这台6Mbps入口服务器的上行网络性能,就应该选择–limit 1300/second –limit-burst 30的参数组合。

网络性能测试用例C,limit-burst 40的时候,测试了3论次,数据如下

网络性能曲线图

总结时刻

通过观察,增加limit-burst的数值,可以增加整体速度,对于入口低的服务器,选择的条件不多。

因为我的这台入口服务器的上行带宽是6Mbps,为了保证贴近我自己的服务器的效果,我这里就有3组数据可选,是比较合适的。

--limit 1500/second --limit-burst 20   # 速度为766.5KB/s
--limit 1300/second --limit-burst 30   # 速度为769.7KB/s
--limit 1200/second --limit-burst 40   # 速度为785.0KB/s

在入口服务器设置防火墙规则,在终端中执行即可,注意保存防火墙规则,以免重启后失效

iptables -A INPUT -s 此处US服务器IP地址 -p icmp -m icmp --icmp-type any -m limit --limit 1200/second --limit-burst 40 -j ACCEPT
iptables -A INPUT -s 此处US服务器IP地址 -p icmp -m icmp --icmp-type any -j DROP

另外,US服务器,出站限速,可选做,我这里没有进行设置,因为流量多,没必要折腾。海外服务器是出站,所以是OUTPUT链,包的limit可以多一点,因为发包的网络流量,过程中,考虑丢包的情况。

iptables -A OUTPUT -d 此处CN服务器IP地址 -p icmp -m icmp --icmp-type any -m limit --limit 1300/second --limit-burst 40 -j ACCEPT
iptables -A OUTPUT -d 此处CN服务器IP地址 -p icmp -m icmp --icmp-type any -j DROP

冷门的隧道协议Ping Tunnel,进阶配置,第一课,增加ping tunnel客户端国内云VPS入口服务器 2022-02-21

段落1、需求描述

本章是Ping Tunnel的进阶设置教程玩法,请不熟悉Ping Tunnel的观众优先阅读第39期视频的配套博客

第39期视频博客地址 基础设置教程

冷门的隧道协议PingTunnel概览,配置简单,可用于过市面上绝大部分的硬件防火墙 2021-12-12 https://dasmz.com/?p=867

段落2、进阶需求的来历

1、增加国内云服务器VPS入口,可以优化自身网络出入的路由,使用高QoS等级的网络出口

2、增加国内云服务器VPS入口,对于未root的安卓Android手机,未越狱的苹果手机来说,体验Ping Tunnel的结果,成为可能

段落3、配置环境介绍

本期视频,用来做视频例子的国内云服务器,是联通沃云的云主机,上海机房,配置为4核心 8GB内存 6Mbps带宽,在国内来说,这台VPS服务器配置属于高级性能的了,一般而言,推荐1核心 1GB内存 5Mbps左右的配置,比较合适个人,大的配置适合工作室用。

这里,打个小广告,如果需要联通沃云的服务器,可以找我给你介绍客户经理。1核心 1GB 5Mbps,只需要1000 RMB/年管理型主机,可呼叫到技术支撑的。

段落4、配置实施

4.1 登录云服务器,安全组,配置规则,放行ICMP入站和出站,及配套TCP入站规则。

规则方向: 入方向 和 出方向
协议: ICMP
端口: 无需
授权对象: IPv4  0.0.0.0/0
出战和入站ICMP放行
配置成功的标志为 ping xx.aa.bb.cc代表你国内云服务器的地址,可以显示回包延迟数据。
PING xx.aa.bb.cc (xx.aa.bb.cc) 56(84) bytes of data.
64 bytes from xx.aa.bb.cc: icmp_seq=1 ttl=50 time=7.06 ms
64 bytes from xx.aa.bb.cc: icmp_seq=2 ttl=50 time=5.40 ms
64 bytes from xx.aa.bb.cc: icmp_seq=3 ttl=50 time=7.45 ms
64 bytes from xx.aa.bb.cc: icmp_seq=4 ttl=50 time=7.15 ms
64 bytes from xx.aa.bb.cc: icmp_seq=5 ttl=50 time=7.08 ms
^C
--- xx.aa.bb.cc ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 5.401/6.828/7.453/0.727 ms

4.2 SSH登录云服务器,下载Ping Tunnel并开启客户端

在国内云主机服务器上面,执行Ping Tunnel客户端程序,其中mm.nn.hh.zz代表你Ping Tunnel的服务器端地址

测试用
/usr/bin/TunNEL -type client -l 0.0.0.0:11818 -s mm.nn.hh.zz -sock5 1 -key 102030 -noprint 1 -nolog 1

正式用
/usr/bin/TunNEL -type client -l 127.0.0.1:11111 -s mm.nn.hh.zz -sock5 1 -key 102030 -noprint 1 -nolog 1

参数说明

/usr/bin/TunNEL,是我把PingTunnel解压之后,挪到这个位置,改成的名字

-type client,是代表执行的客户端程序

-l 0.0.0.0:11818,是代表,在本地开启一个监听,我这里临时让它监听在云服务器的公网,测试功能是否正常,正常后,改为本地监听。

-s mm.nn.hh.zz,是指定Ping Tunnel服务端的IP地址

-sock5 1 ,开启socks5转发

-key 102030,客户端服务端交互认证的密码

-noprint 1 -nolog 1,无日志显示

截至此处,你就可以在浏览器插件里面,用switchy omega配置socks5 国内云服务器的地址 刚刚配置的socks5端口18818,进行联网测试了,我这里测试下来,非常棒!但是,它是无认证的socks5,这里,我们需要给它一个前置代理程序。

4.3 使用gost给pingtunnel 客户端,增加一个有认证的前置代理

比较推荐用SS作为前置代理,算法选择aes-128-gcm即可,项目地址 https://github.com/ginuerzh/gost

实际运行的就是2段程序

1、 Ping Tunnel客户端,到服务器的隧道
/usr/bin/TunNEL -type client -l 127.0.0.1:11111 -s mm.nn.hh.zz -sock5 1 -key 102030 -noprint 1 -nolog 1

2、 前置代理,SS的入口
/usr/bin/gTun -L=ss://aes-128-gcm:P11223344w@0.0.0.0:18616 -F=socks5://127.0.0.1:11111

4.4 电脑或者手机客户端配置

电脑或者手机客户端上配置的就是 ss://aes-128-gcm:P11223344w@xx.aa.bb.cc:18616

xx.aa.bb.cc代表你国内云服务器的IP地址

基于全国多地ping工具,测试云服务器的网络状况 2022-02-17

自己购买了一台联通沃云的服务器,目前,到手之后,我们先来测试一下它的网络状况

使用搜索引擎搜索 全国多地ping ,如果英文,搜索 multi location ping

有很多网站提供类似的工具

https://ping.chinaz.com/

http://www.webkaka.com/ping.aspx

https://ping.aizhan.com/

https://www.itdog.cn/ping

https://www.wepcc.com

https://www.17ce.com/

云平台挖矿病毒的核查,工作记录 2022-2-16

客户要求,进行一次挖矿病毒的核查,由于我们属于项目方,无权限登录用户虚机,故而,没有办法从虚机层面进行检查。

当时,想到另一个思路,来进行挖矿病毒的检查

原理,挖矿病毒在寄宿的主机上运行后,会连接到黑客设置的矿池,提交自身的算力。

基于上面的原理,今日,项目上,通过提取互联网资源区/边界出口防火墙的会话记录,筛选出其中南北向出口流量的记录,通过过滤目标IP地址的地理位置信息(因为国内打击挖矿,国内IP很少有矿池IP了),通过请求目标IP的返回信息(绝大部分矿池访问后,会提示矿池Active/Online),这样把整个云平台互联网区的对外会话请求都人工筛了一遍。

迅雷赚钱宝二代,矿渣复活记,它几乎是市面上最便宜的4核armbian Linux低功耗设备硬件了2022-2-14

前缀、文档修改记录

20220214 初始化编辑此文章,完稿
20240507 更新一下文章,整体过程汇总

迅雷赚钱宝二代,这个设备,ARM架构的,性能很有限,不过现在有大神做好了相关的固件,买了一跟USB公对公的线回来,就可以愉快的折腾了。

设备清单

1、 赚钱宝二代(型号WS1508)的设备,含电源线。配置参数为1个ARM核心(1.5GHz ARM Cortex-A5 四核处理器),512MB DDR3内存,USB2.0接口,100Mbps网口。ARMv7

2、USB公对公线,一根,淘宝价格3.9元

3、网线一根

4、恩山论坛大佬的固件,及配套的USB烧录软件

第一章,下载armbian固件及配套软件

恩山的原帖地址 https://www.right.com.cn/forum/thread-4137698-1-1.html

原作者禁止其他人转载刷机包到其他地方,各位可以从上面的原贴去下载,支持一下。

第二章,安装工具,刷设备固件

安装usb_burning_tool,这个就是普通的Windows软件安装,基本一路下一步就行。

打开usb_burning_tool这个软件。

用USB公对公的线,连接电脑的USB口和赚钱宝的USB口,长按住复位,插上赚钱宝二代的电源,直到usb_burning_tool工具上,显示连接成功。

点击菜单的IMG导入,把那个镜像导入,点击开始刷ROM。

等待大概2分多钟,等进度条绿色,就OKAY了。

第三章,设备的初始化配置

刷完把电源和USB线拔掉,然后插电开机,等一会儿,然后在路由器里找设备IP,我这里这次主机名是aml,IP地址是10.11.0.115

SSH会话,登录,初始root密码为1234,进去后请按照提示修改密码

调整扩充根目录空间大小,充分利用磁盘的4GB容量,执行

resize2fs /dev/data

手动设置一次日期与时间:执行 date -s 2021-xx-xx,把日期提前一天!如果今天是2021-10-10,那就设置2021-10-11

date -s 2022-02-14

安装ntp自动校时服务:执行 apt-get install ntp,稍后可能要确认一下输入y。

apt-get install ntp

整体过程整理出来,如下

整理了一下过程,大概如下: Dasmz 2024-05-07

初始默认密码 1234
date -s 2024-05-07
resize2fs /dev/data
apt update
apt-get install ntp
systemctl enable ntp
dpkg-reconfigure tzdata
apt-get install iptables iptables-persistent
echo "S0FC107092" > /etc/hostname
chattr +i /etc/hostname
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
apt-get install vim gcc make curl wget

完工

预览图

Ubuntu/Debian/Raspberry环境上,配置samba服务 20230309

需求描述:

在我的那台树莓派设备系统上,系统为Raspbian,安装samba服务,非常给力,好用。

而且,现在市面上多数的安卓智能电视,电视盒子,都支持samba,可以直接在家里通过该协议观看samba服务里的影视剧集。

推荐,仅在局域网环境下使用samba服务。在公网使用,性能差,且安全风险高。

20220420,文档更新校正,完善内容,增加samba多目录,samba权限控制,账号。

20230309,文档更新内容,增加Linux命令行下如何挂载samba卷。

第一章,服务器,SAMBA安装,过程非常简单

root@server:~# apt-get update
root@server:~# apt-get install samba

第二章,配置

先停止安装后自动开启的samba服务,然后修改配置文件

root@server:~# systemctl stop smbd

假设如下的几个是我的分享目录,创建几个目录

mkdir -p /media/HDD1TB/downloads /media/HDD1TB/ingDowns /media/HDD1TB/TVSHOW

为samba配置一个普通的用户,名字为fd

root@server:~# mkdir -p /home/fd
root@server:~# useradd -U -s '/bin/bash' -d '/home/fd' fd
root@server:~# chown -R fd:fd /home/fd
root@server:~# passwd fd  
root@server:~# chown -R fd:fd /media/HDD1TB/
root@server:~# chmod 777 /media/HDD1TB

root@server:~# usermod -aG fd debian-transmission # 我下载BT到这个目录,所以,把BT用户归纳到fd组

root@server:~# 
root@server:~# smbpasswd -a fd     # 增加samba用户 
root@server:~# smbpasswd -a root   # 增加samba用户
root@server:~# smbpasswd -x fd     # 删除samba用户,新建时,无需执行
root@server:~# smbpasswd -x root   # 删除samba用户,新建时,无需执行

修改配置文件 /etc/samba/smb.conf

// 配置的逻辑为, /media/HDD1TB这个目录root用户可以全部访问,而用户fd只能访问其中的子目录/media/HDD1TB/TVSHOW

[MULTI_SHARE]
comment = Multi Media Files Share
path = /media/HDD1TB
browseable = yes
valid users = root
force group = root
create mask = 0660
directory mask = 0771
writable = yes
read only = no
guest ok = no

[TV]
comment = TV SHOW ACCESS
path = /media/HDD1TB/TVSHOW
browseable = yes
valid users = fd
force group = fd
create mask = 0660
directory mask = 0771
writable = yes
read only = no
guest ok = no
// 查看SAMBA服务器上的版本
root@server:~# samba --version
Version 4.9.5-Debian
root@server:~#

// 查看当前SAMBA服务器的运行情况
root@server:~# smbstatus

root@VMSMB:~# smbstatus -p

Samba version 4.9.5-Debian
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing              
----------------------------------------------------------------------------------------------------------------------------------------
1799    nobody       nogroup      Dell (ipv4:10.11.11.179:54212)       NT1               -                    -                    
1142    fd           fd           10.11.11.179 (ipv4:10.11.11.179:5029)     SMB3_11           -                    partial(AES-128-CMAC)
1985    fd           fd           10.11.11.179 (ipv4:10.11.11.179:38794)    SMB3_11           -                    partial(AES-128-CMAC)
参数
MULTI_SHARE,TV 这些是你自定义的服务项的名称,后面客户端访问时候需要
comment 一些用于提醒的消息,这个一般都是配置提示
path 需要分享的目录
browseable 默认为yes,一般不需要修改

第三章,重启samba服务

root@server:~# systemctl restart smbd

第四章,客户端访问

1、Linux桌面环境

smb://ipaddress/MULTI_SHARE    # 如果用root访问

smb://ipaddress/TV   # 如果用普通用户fd访问

2、Windows桌面环境

\\ip-address\MULTI_SHARE

第五章,客户端访问,Linux的Shell 命令行环境

// 安装 smbclient 功能组件
# apt install smbclient

// 查看确认SAMBA服务器信息
# smbclient -L //SAMBA-SERVER-IP

// 安装cifs-utils 功能组件
// 支持的协议版本
// SMB 1
// SMB 2.0
// SMB 2.1
// SMB 3.0 带加密
# apt install cifs-utils

// 创建需要的挂载目录,并给到充足的读写权限,本地挂载目录,假设为 /SAMBA
# mkdir /SAMBA
# chmod 777 /SAMBA

// 执行挂载操作
// 参数 serverUserName SAMBA用户
// 参数 myServerIpAdress SAMBA服务地址
// 参数 sharename SAMBA服务配置的[MULTI_SHARE]分享名称
// 参数 /mnt/myFolder/  本地挂载目录,假设为 /SAMBA
# mount -t cifs -o username=serverUserName //myServerIpAdress/sharename /mnt/myFolder/
# mount -t cifs -o vers=3.0,username=fd,password=PassValid  //10.11.11.200/SD /SAMBA        




// 可选,增加一个用户名,密码的文件,共mount调用
// 参数 credentials=/path/samba/smb.token
// username=fd
// password=PassValid
// domain=WORKGROUP
# chmod 600 /path/samba/smb.token
# mount -t cifs -o credentials=./smb.token  //10.11.11.200/SD /SAMBA        

附录1、参考文档

https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html

https://ubuntu.com/tutorials/install-and-configure-samba#4-setting-up-user-accounts-and-connecting-to-share