2022年7月12日星期二

中兴电信光猫更换省份地区

 经测试在F7600T上有效,教程是从一个改移动光猫的帖子上拼凑来的,用途应该更广。

下载工具:https://drive.google.com/file/d/1UcZAVpXTqqmiBDHpUcALdemIVVG0r0wy/view?usp=sharing

在命令提示行输入如下,如提示失败可更改-p 8080为80试试,联通移动更换相应超秘。

factorymode_crack.exe -l xxx open -i 192.168.1.1 -u telecomadmin -pw nE7jA%5m -p 8080

如果成功或出现Telnet的账号和密码,在两个=后边

Windows登录Telnet:telenet 192.168.1.1

分别输入刚才得到的账号密码,密码建议手动输入

进入后运行如下得到区域列表:/etc/init.d/regioncode

更改为广东省运行: upgradetest sdefconf 210
会自动重启

重启后超秘进去已经更改

以下未验证,应该问题不大:

sendcmd 1 DB set DevAuthInfo 1 Level 1(usesir用户提权为管理员)
sendcmd 1 DB set WLANCfg 0 ESSIDPrefix ""(设置2.4G的ssid前缀为空)
sendcmd 1 DB set WLANCfg 4 ESSIDPrefix ""(设置5G的ssid前缀为空)
sendcmd 1 DB save (手工保存配置文件)

参考:https://post.smzdm.com/p/aqm8r8e7/

2021年12月9日星期四

Openwrt允许外网访问内网IPv6

 查了很多资料有接口里边改的和DHCP/DNS里边改的,都没有实际起效就自己研究了一下。我的版本是OpenWrt 21.02.0

发现内部可以ping到外部,外部也可以ping回来,说明防火墙放行ICMP。在【网络】-【防火墙】-【Traffic Rules】中有如下记录:





可以看得出放行ICMP需要开一进一出两条规则,这里作了限制。

我也照猫画虎开了两条规则,具体如下:





具体配置:



























这两条的【高级设置】一样,我只贴一个图:
















保存/应用以后通过蜂窝网络就可以访问了,如果你也是可以ping通IPv6但连接不上可以试试。

如果你有类似第一张图的配置都ping不通,那就先按网上的其他教程改改看。




2020年11月29日星期日

Debian安装docker及常用操作

 1、安装准备:

删除以前版本,如果有:

sudo apt-get remove docker docker-engine docker.io

udo timedatectl set-timezone Asia/Shanghai #时区设置,非必须

安装准备插件:

sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent lsb-release software-properties-common

安装腾讯源:

curl -fsSL https://mirrors.cloud.tencent.com/docker-ce/linux/debian/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://mirrors.cloud.tencent.com/docker-ce/linux/debian/ $(lsb_release -cs) stable"

2、安装docker:

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

使用脚本自动安装:

curl -fsSL get.docker.com -o get-docker.sh

sudo sh get-docker.sh --mirror Aliyun

启动docker:

sudo systemctl enable docker

sudo systemctl start docker

3、建立用户和用户组

sudo useradd -m docker -g docker -d /home/docker -s /bin/bash

sudo passwd docker #设置密码

回到root,赋予docker账户管理权限

(1)为sudoers增加写入权限

sudo chmod +w /etc/sudoers

sudo vim /etc/sudoers

(2)为用户docker添加读写权限

root ALL=(ALL:ALL) ALL

docker ALL=(ALL:ALL) ALL    // 这一行为新添加的代码

(3)将sudoers文件的操作权限改为只读模式

 sudo chmod -w /etc/sudoers

 回到docker,将用户docker归到docker组,docker组系统已经默认建立

su docker

sudo usermod -aG docker $USER

4、测试:

docker run hello-world 

5、创建网络:

sudo ip link set eth0 promisc on #打开网卡混杂模式

docker network create -d bridge openwrt_lede #创建名为openwrt_lede的桥连网络

docker network create -d macvlan --subnet=192.168.2.0/24 --gateway=192.168.2.1 -o parent=eth0 macnet #创建有配置的网络

网络相关:https://www.yiibai.com/docker/network_connect.html

6、镜像文件导入容器:

cd /mnt/openwrt #进入镜像文件

tar zcf /home/docker/openwrt.tgz *  #将该所有文件打包

cd /home/docker

docker import openwrt.tgz openwrt_lede  #到达该目录,导入镜像命名为openwrt_lede

docker image ls #查看已有镜像

7、启动容器:

docker run --restart always --name openwrt_cup -d --network my-bridge-network --privileged openwrt_lede /sbin/init #openwrt_cup为运行中的容器名称


 

编译Openwrt lede路由器固件

 1、Ubuntu新建用户,不使用root

sudo useradd -m vibit -d /home/vibit -s /bin/bash #新建账户指定文件夹

sudo passwd vibit #创建密码

2、回到root,赋予vibit账户管理权限

(1)为sudoers增加写入权限

sudo chmod +w /etc/sudoers

sudo vim /etc/sudoers

(2)为用户XXX添加读写权限

root ALL=(ALL:ALL) ALL

vibit ALL=(ALL:ALL) ALL    // 这一行为新添加的代码

(3)将sudoers文件的操作权限改为只读模式

 sudo chmod -w /etc/sudoers

 3、系统更新,安装组件,配置固件

sudo apt-get update

sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync #安装必要组件

su vibit #更换用户名

cd /home/vibit

git clone https://github.com/coolsnowwolf/lede.git

cd lede

./scripts/feeds update -a 

./scripts/feeds install -a

make menuconfig 

 4、下载dll库,开始编译

make -j8 download V=s 下载dl库(国内请尽量全局科学上网)

make -j1 V=s (-j1 后面是线程数。第一次编译推荐用单线程)

5、查找固件和插件

 lede/bin/targets/路由器架构/64/目录下查看固件

bin/packages/路由器架构/base/目录下查看插件

参考:

https://github.com/coolsnowwolf/lede

https://imgki.com/archives/openwrt-lean.html


2020年11月27日星期五

Debian建立共享文件夹并挂载

 服务端安装:

apt install samba

客户端安装:

apt install samba-client cifs-utils


服务端配置文件:

/etc/samba/smb.conf (无密码指定IP访问)

[global]

        workgroup = MYGROUP

        unix charset = UTF-8

        interfaces = 172.0.0.0/24 eth0

        hosts allow = 172.0.0.3

        bind interfaces only = yes

        netbios name = mini

        log file = /home/samba/%m.log

        max log size = 1000

[box]

        comment = share all

        path = /home/box

        writable = yes

        guest ok = yes

        guest only = yes

        create mode = 0777

        directory mode = 0777

客户端运行:

 mount -t cifs -o guest,vers=2.0 //172.0.0.2/box /home/box

sudo apt install nfs-common cifs-utils #如提示格式出错需安装这两个组件

两个box文件夹赋予777权限

2020年11月10日星期二

借Frp实现IPLC逆向访问

一、在外网服务器搭建Frps。

二、在内网服务器搭建SSR客户端。

apt install git

wget https://raw.githubusercontent.com/the0demiurge/CharlesScripts/master/charles/bin/ssr

chmod +x ssr
cp ssr /usr/local/bin/ssr
apt install jq

按照说明,执行 ssr install ,无法执行可以运行如下命令代替。 

git clone https://github.com/shadowsocksrr/shadowsocksr.git /root/.local/share/shadowsocksr

/root/.local/share/shadowsocksr配置文件
ssr start
ssr config #查询配置,开启服务

*三、在内网服务器安装privoxy。
apt install privoxy
echo 'forward-socks5 / 127.0.0.1:1080 .' >> /etc/privoxy/config
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export ALL_PROXY=http://127.0.0.1:8118(全端口走代理,上两条可以没有)

使系统保持export代理的方法:

编辑root下的.bashrc添加export ALL_PROXY=http://127.0.0.1:8118

然后运行source ~/.bashrc

*不安装Privoxy,直接运行export all_proxy=socks5://127.0.0.1:1080 也可达到效果。

四、内网服务器搭建SSR服务端和Frpc。

五、在内网搭建Frps还可以实现双SSR二级(前置)代理。

2020年11月3日星期二

笔记:WireGuard 隧道组建大内网和UDP转TCP

 

一、安装 WireGuard

最近我在使用 Ubuntu 18.04 LTS (Bionic),所以这边也是给出两种安装教程。

1、直接从软件仓库安装

执行下面的命令,从软件仓库安装 WireGuard:

sudo add-apt-repository ppa:wireguard/wireguard
sudo apt-get update
sudo apt-get install wireguard

二、生成公钥密钥对

在 Server 和 Client 上进入 /etc/wireguard/ 目录,然后执行下面的命令生成自己机器的公私钥对:

wg genkey | tee privateKey | wg pubkey > publicKey

这样在每台主机上都会有两个文件:privateKey 和 publicKey。


三、网络规划介绍

WireGuard 是通过创建一个虚拟接口的方式来转发流量的,这里我们暂停一下,明确一下我们的网络规划。
Host
wg0 Address
Wireguard 
内部使用
eth0 Address
服务商给的公网 IP
Server
10.0.0.1/24
1.1.1.1
Client
10.0.0.2/24
2.2.2.2

四、文件配置(基于上面的网络规划)

Server 上开放 51820 端口(或其他端口,可在Server配置文件中修改,但切记是 UDP)用于 Client 连接,在每台机器上 /etc/wireguard/ 目录下创建一个名为 wg0.conf 的文件,内容分别如下:

在 Server 上的 wg0.conf:

[Interface]
Address = 10.0.0.1/24
SaveConfig = true
ListenPort = 51820
PrivateKey = < 这里填写 Server 上 privatekey 的内容 >

PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

SaveConfig = true

 


# Client
[Peer]
PublicKey = < 这里填写 Client 上 publickey 的内容 >
AllowedIPs = 10.0.0.1/24

在 Client 上的 wg0.conf:

[Interface]
PrivateKey = < 这里填写 Client 上 privatekey 的内容 >
Address = 10.0.0.2/24

# Server
[Peer]
PublicKey = < 这里填写 Server 上 publickey 的内容 >
Endpoint = 1.1.1.1:51820
AllowedIPs = 10.0.0.1/24

然后在双方主机上各自 wg-quick up wg0 即可。

五、配置检验

通过 wg 指令即可查看目前接口使用情况。下面给出一个参考输出:

interface: wg0
  public key: < Client 上的 publicKey >
  private key: (hidden)
  listening port: 12345

peer: < Server 上的 publickey >
  preshared key: (hidden)
  endpoint: 1.1.1.1:51820
  allowed ips: 10.88.88.0/24
  latest handshake: 1 minute, 43 seconds ago
  transfer: 120.32 MiB received, 608.10 MiB sent

       此时隧道已经建立,双方主机已经可以通过内网 IP (这里的例子中是 10.0.0.1 和 10.0.0.2 )进行加密地通讯了。特别是当TCP在特定情况下受阻的情况下,可以使用 WireGuard UDP 方式在 Internet 上工作,有效的提升网络效率和稳定性。对于UDP QoS过分的地方,也可以试着加一个 udp2raw,整体上看效果会有不错的提升。

六、UDP受干扰转TCP

源码下载地址:https://github.com/wangyu-/udp2raw-tunnel/releases

工具运行

假设你的UDP已被屏蔽,假设你的服务器IP为44.55.66.77,你有一个服务在监听udp端口7777。

# Run at server side:
./udp2raw_amd64 -s -l0.0.0.0:4096 -r 127.0.0.1:7777    -k "passwd" --raw-mode faketcp -a

# Run at client side
./udp2raw_amd64 -c -l0.0.0.0:3333  -r44.55.66.77:4096  -k "passwd" --raw-mode faketcp -a
       此时,已成功通过TCP端口4096在客户端和服务器端之间建立了一条经过加密的通信隧道。在客户端通过UDP端口3333连接,等同于在服务器端连接端口7777

转载自:
https://www.xiaox.link/2019/12/wireguard-vps.html
https://nova.moe/deploy-wireguard-on-ubuntu-bionic/
https://www.freebuf.com/sectool/187069.html