共有 54 篇文章
EasyTier 组网
2025-04-18 - 2025-04-18

之前使用WireGuard组网, 有时会遇到UDP被限制的情况

如果要udp2raw将UDP转为TCP发送, 那么多了一层势必要增加损耗, 并且会降低稳定性, 于是选了则EasyTier作为新的组网方案

Linux UFW端口转发
2025-03-17 - 2025-03-20

编辑 /etc/default/ufw

找到 18行左右的 DEFAULT_FORWARD_POLICY,将值改为true

1vim /etc/default/ufw

编辑 /etc/sysctl.conf

net.ipv4.ip_forward=1 注释去掉,并确保值为1

1vim /etc/sysctl.conf
2sysctl -p

编辑 /etc/ufw/before.rules

*filter 上方,一般在最顶部,添加如下命令

SSHFS
2025-03-16 - 2025-03-16

远程挂载目录

安装

1apt install sshfs

挂载

1sshfs root@10.0.0.4:/storage /mnt/storage -o _netdev,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/root/.ssh/id_ed25519

开机自动挂载

1# vim /etc/fstab
210.0.0.4:/storage /mnt/storage fuse.sshfs _netdev,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/root/.ssh/id_ed25519 0 0
NFS 挂载文件系统
2025-03-16 - 2025-03-16

NFS是一种没有加密的高性能的远程挂载工具, 如果在局域网中可以直接使用, 如果在公网环境下, 可以搭配Wireguard使用

安装

NFS服务器

假设IP: 10.0.0.4

1apt install -y nfs-kernel-server

客户端

假设IP: 10.0.0.2

1apt install -y nfs-common

创建共享

编辑配置文件

Wireguard Mesh 组网
2025-03-14 - 2025-03-21

有时候服务器之间需要加密传输数据(例如NFS挂载),为了平衡延迟和速度,可以采用Wireguard来组建一个内网,这样业务数据可以通过内网IP高速和安全的传输

注意

  • Wireguard有加密但无混淆,特征较为明显,谨慎用于其他用途
  • Wireguard使用UDP传输,部分云服务商限制了UDP会导致性能较差
  • 由于海外和国内网络互联较差, 使用了一个带优化线路的中转节点来中转国内和海外服务器, 降低连接延迟, 提高传输速度

特性

ListenPort 监听和发送端口的问题

当给Interface配置ListenPort之后,这个端口既承担了监听端口的功能,又承担了对外发送端口的功能,这会导致一些问题

Linux服务器开启GPU/Emby启用硬件解码
2025-03-03 - 2025-03-04

Emby的硬件解码需要订阅才能使用

安装驱动

1# 安装显卡驱动
2apt install intel-media-va-driver-non-free
3# 或开源
4apt install intel-media-va-driver
5
6# 如果上述没有生效, 安装这个(不确定这个起作用没有)
7apt install i965-va-driver

配置grub

1vim /etc/default/grub

查看 GRUB_CMDLINE_LINUX 中是否有 nomodeset 项, 如果有需要去掉. 去掉之后使grub生效

Linux虚拟串口 Serial port
2024-09-22 - 2024-09-23

首先安装socat

1sudo apt-get install socat

启动虚拟串口

1socat -d -d pty,raw,echo=0 pty,raw,echo=0

成功后返回以下信息

12024/09/22 21:32:10 socat[1997612] N PTY is /dev/pts/13
22024/09/22 21:32:10 socat[1997612] N PTY is /dev/pts/14
32024/09/22 21:32:10 socat[1997612] N starting data transfer loop with FDs [5,5] and [7,7]
  • (终端1)监听其中一个串口 cat < /dev/pts/2
  • (终端2)另一个串口写入数据 echo "Hello World!" > /dev/pts/3

现在,从终端1可以看到“”Hello World!“”打印信息,证明串口创建并连接成功。

VPS Init
2024-08-29 - 2025-04-01

修改时区

1ln -sf /usr/share/zoneinfo/Etc/GMT-8 /etc/localtime

配置bash命令

1alias l='ls -Al --color=auto'
2alias ll='ls -Alh --color=auto'

配置apt源

删除普通用户

1userdel -r admin

安装工具

1apt update
2apt install -y systemd-timesyncd vim curl wget gcc g++ git make screen telnet jq bc tcptrack

修改主机名

1vim /etc/hosts
2vim /etc/hostname

配置ssh key

1mkdir .ssh
2chmod 600 .ssh
3
4vim .ssh/authorized_keys
5chmod 600 .ssh/authorized_keys

配置sshd

1vim /etc/ssh/sshd_config
2
3PermitRootLogin prohibit-password
4PubkeyAuthentication yes
5PasswordAuthentication no
6ClientAliveInterval 15
7ClientAliveCountMax 3

更改密码

1passwd

配置git

1git config --global user.name "Akvicor"
2git config --global user.email akvicor@akvicor.com
3git config --global core.editor vim

motd脚本

1vim /etc/motd
2vim /etc/update-motd.d/99-custom
3chmod +x /etc/update-motd.d/99-custom

内容

SSH 密钥
2024-08-17 - 2024-09-18

Ed25519算法

1ssh-keygen -t ed25519 -C "your_email@example.com"

旧算法

1ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

设置文件权限

1chmod 700 ~/.ssh
2chmod 600 ~/.ssh/authorized_keys
Disable IPV6
2024-08-03 - 2024-09-18

永久关闭IPV6

编辑grub配置文件/etc/default/grub

修改增加ipv6.disable=1属性

1GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"
2GRUB_CMDLINE_LINUX="ipv6.disable=1"

使设置生效

1update-grub
获取 Debian Version
2024-05-19 - 2024-09-18

lsb_release

1apt-get install lsb-release
2lsb_release -a

issue

1cat /etc/issue

os-release

1cat /etc/os-release

hostnamectl

1hostnamectl

uname

1uname

debian_version

1cat /etc/debian_version