云服务器 对外访问25端口被封 ? 利用iptables 绕过 被封的 output 25 port。

用 iptables 将 25出去的流量,转发到其他端口出去。

iptables -t nat -A OUTPUT -p tcp --dport 25 -j DNAT --to 10.0.0.10:10025

这里 将 25 端口出去的流量转发到了1025端口。

这里 10.0.0.10 为 代理服务器 的ip地址。

找一台正常发送25端口的服务器,配置成代理服务器。

  1. 安装postfix
sudo apt-get install postfix

sudo tee /etc/postfix/main.cf<<EOF
inet_interfaces = all
#inet_interfaces = localhost
mynetworks = 0.0.0.0/0
EOF

sudo systemctl restart postfix
  1. 配置被允许代理的服务器的ip。
sudo tee smtp-proxy.sh<<EOF
#!/bin/bash
# 被允许的ip
IPS=(
129.1.1.1
132.2.2.2
132.3.3.3
)
for IP in {IPS[@]}
do
iptables -t nat -A PREROUTING -p tcp -s{IP} --dport 10025 -j REDIRECT --to-ports 25
iptables -A INPUT -p tcp -s ${IP} --dport 25 -j ACCEPT
done
EOF

sudo chmod +x smtp-proxy.sh
./smtp-proxy.sh
  1. 配好防火墙:
sudo ufw default  deny
sudo ufw allow 10025
sudo ufw allow  from 129.1.1.1
sudo ufw allow  from 132.2.2.2
sudo ufw allow  from 132.3.3.3

AMD GPU device plugin for Kubernetes on ubuntu 22.04 安装使用

AMD GPU device plugin for Kubernetes 是一个amd的k8s显卡插件。

环境说明:
+ ubuntu 22.04
+ k8s 1.23.9

安装amd的内核驱动

wget https://repo.radeon.com/amdgpu-install/22.20.3/ubuntu/jammy/amdgpu-install_22.20.50203-1_all.deb
sudo apt install ./amdgpu-install_22.20.50203-1_all.deb
sudo apt-get update
sudo amdgpu-install --usecase=dkms
# 安装完成后,必须重启一下
sudo reboot

浏览全部

ubuntu下 podman 转发端口 ufw 防火墙 不能放过( 不兼容) 的临时处理方案

podman的网络使用的是 iptables 的转发。不支持ufw开放/禁用 端口。
开了ufw防火墙后,podman 转发的端口基本上就只能本地访问了。这是个大坑

方法1

ifconfig

执行后,可以找到一些 cni-popdman0 这种的interface。
使用iptables对所有的相关cni都转发一下 例如:

iptables -I FORWARD -p tcp ! -i cni-podman0 -o cni-podman0 -j ACCEPT

这样,即使开启着 ufw。你的podman的端口也能通过外部访问了。
不过不安全。这是全部转发的端口都允许了。所以只是临时方案。否则只能关闭ufw(不能接受)

方法2

  • 编辑 /etc/default/ufw 修改 DEFAULT_FORWARD_POLICY 的值为 ACCEPT
  • sudo ufw reload

homebrew 执行 brew update 报 rebase-merge 错误问题解决

错误信息

Running `brew update --auto-update`...
fatal: It seems that there is already a rebase-merge directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
    git rebase (--continue | --abort | --skip)
If that is not the case, please
    rm -fr ".git/rebase-merge"
and run me again.  I am stopping in case you still have something
valuable there.

浏览全部

向日葵 远程控制 for 树莓派 raspbian 系统 arm64安装包

背景

  1. 入了树莓派,喜欢折腾这些小玩意,在没公网的情况希望能有个远程控制程序
  2. oray官网虽然提供了arm64的linux向日葵的包,但是都不能直接用于树莓派的官网系统
  3. 树莓派官方系统raspbian _desktop arm64版本性能比armhf版本好多了。
  4. 该安装包适用 于 基于debian bullseye(debian 11) 的 raspbian 系统。也就是2022年的最新系统。

使用说明

  1. 下载我重新制作的deb包
wget https://wx.scjtqs.com/downloads/raspberry/sunloginclient_11.0.1.44968_raspbian_arm64.deb
  1. 执行安装
sudo apt install ./sunloginclient_11.0.1.44968_raspbian_arm64.deb
  1. 在桌面的开始菜单互联网 下 找到 向日葵 ,点开它
  2. 在gui界面下自行配置即可。

zerotier 组网简要使用说明

组网前置要求

  1. A、B、C 3个区域,分别有路由器A、路由器B、路由器C。
  2. 每个路由器都安装了zerotier插件,并启动运行。
  3. 每个路由器上的zerotier 都加入到了同一个 networkid
  4. 每个路由器的私网不在同一个网段。

简单描述环境

  • A地区:zerorier ip : 192.168.88.22 , lan ip 192.168.1.0/24
  • B地区:zerorier ip : 192.168.55.33, lan ip 10.0.0.0/24
  • C地区:zerotier ip : 192;168.44.66,lan ip 172.192.1.0/24

zerotier 后台的路由表配置 (Managed Routes)

  • 192.168.1.0/24 via 192.168.88.22
  • 10.0.0.0/24 via 192.168.55.33
  • 172.192.1.0/24 via 192;168.44.66

达到的效果

没错,这样就基本上配置完成了。

可以在 192.168.1.123(A),下直接访问 10.0.0.223(B)这台设备了。