其实这个错误就是路由指向了wireguard接口但是AllowedIPs中并没有配置对应的网段,AllowedIPs配置正确就好了
Views: 89
其实这个错误就是路由指向了wireguard接口但是AllowedIPs中并没有配置对应的网段,AllowedIPs配置正确就好了
Views: 89
用我自己的仓库
pip config set global.index-url https://mirrors.hetao.me/pypi/simple
pip config set global.trusted-host mirrors.hetao.me
环境变量
export PIP_INDEX_URL=https://mirrors.hetao.me/pypi/simple
export PIP_TRUSTED_HOST=mirrors.hetao.me
pip环境变量参考:
https://pip.pypa.io/en/stable/topics/configuration/#environment-variables
Views: 14
#/bin/sh
export HTTPS_PROXY=172.29.0.24:3128
data_dir=/jffs/configs
python3 -m genpac --format=dnsmasq --user-rule-from={data_dir}/user-rule.txt -o{data_dir}/gfwlist.conf --dnsmasq-dns="172.29.0.1#5354"
export HTTPS_PROXY=
需要在172.29.0.1(镜外主机)上部署一个dns服务器,并且禁用ipv6解析(因为vpn设备ipv6比较麻烦)
– 部署dns服务器
编写/etc/coredns/Corefile文件
.:5354 {
errors
log
template IN AAAA .
forward . 127.0.0.1
}
启动dns
/usr/local/bin/coredns -conf=/etc/coredns/Corefile
– 配置dnsmasq
/jfss/configs/dnsmasq.conf.add中添加一行
“`conf-file=/jffs/configs/gfwlist.conf“`
service restart_dnsmasq
– 配置iptables
ipset create GFWLIST hash:ip
iptables -t mangle -A PREROUTING -m set –match-set GFWLIST dst -j MARK –set-mark 100
iptables -t mangle -A OUTPUT -m set –match-set GFWLIST dst -j MARK –set-mark 100
– 配置wireguard路由
在/jffs/scripts/wgclient-start中添加以下内容
#!/bin/sh
dev_name=wgc{1}
ip route add default devdev_name table 1
ip route add 10.12.0.1/32 dev dev_name
ip route add 172.29.0.0/24 devdev_name
ip rule add fwmark 100 table 1
if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ] ; then
for i in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo 0 > $i
done
fi
以上完。
关于wireguard部分后面有空再说
Views: 148
使用vlanctl命令可以添加tag和untag形式的VLAN,一般untag只添加一个就够了,其它都是tag vlan。要注意的是划分vlan以后原来的iface就转换为二层接口不能配置网络协议了,所有配置都放在vlan上面。
我这里有一个脚本可以参考
#!/bin/sh
function create_vlan_untagged {
local if={1}
local vlanid={2}
vlanctl --mcast --if-create-name {if}{if}.{vlanid}
vlanctl --if{if} --rx --tags 0 --set-rxif {if}.{vlanid} --rule-append
ifconfig {if}.{vlanid} up
}
function create_vlan_tagged {
local if={1}
local vlanid={2}
vlanctl --mcast --if-create-name {if}{if}.{vlanid}
vlanctl --if{if} --rx --tags 1 --filter-vid {vlanid} 0 --pop-tag --set-rxif{if}.{vlanid} --rule-append
vlanctl --if{if} --tx --tags 0 --filter-txif {if}.{vlanid} --push-tag --set-vid {vlanid} 0 --rule-append
ifconfig{if}.${vlanid} up
}
create_vlan_untagged eth1 1
create_vlan_untagged eth3 1
ip link set eth1.1 up
ip link set eth3.1 up
brctl delif br0 eth1 eth3
brctl addif br0 eth1.1 eth3.1
create_vlan_tagged eth1 5
create_vlan_tagged eth3 5
ip link set eth1.5 up
ip link set eth3.5 up
brctl addbr br1
brctl stp br1 on
brctl addif br1 eth1.5
brctl addif br1 eth3.5
ip link set br1 up
ip addr add 192.168.5.1/24 dev br1
nvram set lan_ifnames="eth1.1 eth2 eth3.1 eth4 eth5 eth6"
nvram set br0_ifnames="eth1.1 eth2 eth3.1 eth4 eth5 eth6"
nvram set br1_ifname=br1
nvram set br1_ifnames="eth1.5 eth3.5"
nvram set lan1_ifname=br1
nvram set lan1_ifnames="eth1.5 eth3.5"
nvram commit
此脚本可以放在/jffs/scripts/services-start中
然后在/jffs/scripts/firewall-start中添加
“`iptables -I FORWARD -i br1 -j ACCEPT“`
这样就实现了在一根网线上划分多个vlan并配置多个网段
可以用vlanctl –rule-dump-all列了所有规则,然后用dmesg查看
Views: 48
用OpenVPN的时候自带的有mssfix功能,但是Wireguard是没有的,这就导致访问某些网站(github.com)的时候超时无响应
– iptables用法
iptables -A FORWARD -p tcp –tcp-flags SYN,RST SYN -j TCPMSS –clamp-mss-to-pmtu
– nftables用法
nft add rule ip filter FORWARD tcp flags syn tcp option maxseg size set rt mtu
– Openwrt的话可以直接在防火墙中配置MSS钳制
其它的系统可以放到wireguard的PostUp脚本里面,asus merlin可以放到/jffs/scripts/wgclient-start里面。后来发现如果是从界面配置的wireguard则会自动添加TCPMSS规则,如果是自己用wg-quick手动配置的则需要用上述方法自己添加TCPMSS规则。
这个问题是由于某些网站ICMP或者PMTU不能正常工作导致的,我用ping测试github.com的MTU就测试不出来
参考:
https://www.procustodibus.com/blog/2022/02/wireguard-over-tcp/
https://www.vinoca.org/wireguardzhi-mtu-mss/
Views: 64
Views: 151
参考:
https://gist.github.com/scyto/e4e3de35ee23fdb4ae5d5a3b85c16ed3
https://www.derekseaman.com/2023/11/proxmox-ve-8-1-windows-11-vgpu-vt-d-passthrough-with-intel-alder-lake.html
配置要点:
– vGPU要设为主GPU
– Windows系统直接下载Intel官方显卡驱动
驱动名称为Intel Arc & Iris Xe Graphic,下载地址:https://www.intel.com/content/www/us/en/download/785597/intel-arc-iris-xe-graphics-windows.html
– 更新固件到最新
# 这个是12代CPU用的固件
wget -r -nd -e robots=no -A '*.bin' --accept-regex '/plain/' https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915/adlp_dmc.bin
cp adlp_dmc.bin /lib/firmware/i915/
Views: 39
system
ipsec invalid-spi-recovery enable# ipsec sa单端断联后恢复,否者只能等dpd超时
ipsec df clear #ipsec分片
ike nat-keepalive-timer interval 25 #nat会话保持
ike peer peer1
dpd type periodic #在没有数据要发送时也发送dpd消息,总部设为on-demand分部设为periodic
dpd idle-time 30 #dpd消息间隔,一般nat会话不少于30s
ikev2 fragmentation #ike报文分片
但是有时候发现连接时间长了上级路由器的nat会卡断,只有更换IP或端口号才能继续连接,对于这种情况可以考虑每天重启路由器或把nat-keepalive-timer及dpd idle-time设长一些
Views: 81
aaa
local-user admin service-type terminal ssh ftp http
quit
ssh user admin authentication-type all
rsa peer-public-key tao encoding-type openssh
public-key-code begin
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAA6mw8q1ok9ElbkNRvalOnECxRXaz8oO3sDlL+F8c5dTm09nuK4z1leQlsO
2qMX49foxoCg/sXcVg351dooKkrjZt4IzikGN/hm49lrH4uJGffm9CGmuhF5Xyj1QyvwnA9iERusSS4yf3NvmSR6w5fyCxzKd/09GG8SJ1mXVWw0U9Cd+jk7fEq/6eVsvQNdr23wEXppdkpV9URCvygDR4dk7FBnnmpLD9gOIshpgFPO6452YzaPqpGU/US/YjmbsDNROPHBVvAC/xaCDy6IJCqR8jkKQUya+uPLC29Xfhly+taHV8KHNJ41leN6L/09Lh7uFuN5jGHGHgCJyXPOnP haohetao@gmail.com
public-key-code end
peer-public-key end
dis rsa peer-public-key
ssh user admin assign rsa-key tao
ssh-keygen -e -m pem -f ~/.ssh/id_rsa.pub | sed '1d;$d' | tr -d '\n' | base64 -d | od -t x1 -An | tr -d ' \n' | tr 'a-f' 'A-F' | sed 's/\(.\{8\}\)/\1 /g' | fold -w 54
把本地openssh格式的公钥转换为华为格式ssh user admin authentication-type all
rsa peer-public-key tao
public-key-code begin
3082010A 02820101 00C003A9 B0F2AD68 93D1256E 4351BDA9
4E9C40B1 4576B3F2 83B7B039 4BF85F1C E5D4E6D3 D9EE2B8C
F595E425 B0EDAA31 7E3D7E8C 680A0FEC 5DC560DF 9D5DA282
A4AE366D E08CE290 637F866E 3D96B1F8 B8919F7E 6F421A6B
A11795F2 8F5432BF 09C0F621 11BAC492 E327F736 F99247AC
397F20B1 CCA77FD3 D186F122 75997556 C3453D09 DFA393B7
C4ABFE9E 56CBD035 DAF6DF01 17A69764 A55F5444 2BF28034
78764EC5 0679E6A4 B0FD80E2 2C869805 3CEEB8E7 663368FA
A9194FD4 4BF62399 BB033513 8F1C156F 002FF168 20F2E882
42A91F23 90A414C9 AFAE3CB0 B6F577E1 972FAD68 757C2873
49E3595E 37A2FFD3 D2E1EEE1 6E3798C6 1C61E008 9C973CE9
CF020301 0001
public-key-code end
peer-public-key end
dis rsa peer-public-key
ssh user admin assign rsa-key tao
注意:
复制密钥的时候不要漏掉后面的尾巴,尤其是复制华为16进制密钥格式时,因为末尾没有换行容易忽略
Views: 123
GRUB_CMDLINE_LINUX=”console=tty0 console=ttyS0,115200n8″
GRUB_TERMINAL_INPUT=”console serial”
GRUB_TERMINAL_OUTPUT=”console serial”
GRUB_SERIAL_COMMAND=”serial –unit=0 –speed=115200 –word=8 –parity=no –stop=1 –dumb xterm”
GRUB_TERMINAL=’console serial’
mkdir -p /etc/systemd/system/serial-getty@ttyS0.service.d/
vi /etc/systemd/system/serial-getty@ttyS0.service.d/override.conf
添加以下内容
[Service]
ExecStart=
ExecStart=-/sbin/agetty -o ‘-p — \u’ 115200 %I xterm
systemctl daemon-reload
systemctl restart serial-getty@ttyS0.service
systemctl enable serial-getty@ttyS0.service
用客户端连接的时候终端类型选择xterm,xterm没有屏幕大小的限制,而且支持颜色。
grub默认的终端类型是vt100且不支持xterm,不过基本的功能与xterm也是兼容的。
Views: 41