禁用笔记本内置键盘的方法
以管理员身份运行命令提示符,输入:
sc config i8042prt start=disabled
重启生效,恢复时输入:
sc config i8042prt start=auto
以管理员身份运行命令提示符,输入:
sc config i8042prt start=disabled
重启生效,恢复时输入:
sc config i8042prt start=auto
安装npd6
apk add npd6
配置npd6,记得替换为你的实际子网和接口:
cat > /etc/npd6.conf <<EOF
interface=eth0
prefix=2001:db8:1234:64::/64
ralogging=off
listtype=none
listlogging=off
collectTargets=100
linkOption=false
ignoreLocal=true
routerNA=true
maxHops=255
pollErrorLimit=20
EOF
rc-update add npd6
service npd6 start
在 Alpine Linux 中,ndppd 需要从源代码编译,因为官方存储库不包含预编译的 ndppd 包。以下是安装步骤:
1.安装编译工具和依赖:
apk add build-base git musl-dev linux-headers
2.克隆 ndppd 源代码:
git clone https://github.com/hugangba/alpine-ndppd.git
cd ndppd
3.编译并安装:
make all && make install
验证安装:
which ndppd
应该返回类似 /usr/sbin/ndppd 的路径。
创建配置文件:
创建 /etc/ndppd.conf 文件并添加以下内容,替换为你的实际子网和接口:
route-ttl 30000
address-ttl 30000
proxy eth0 {
router yes
timeout 500
autowire no
keepalive yes
retries 3
promiscuous no
ttl 30000
rule 2001:db8:1234:64:ff9b::/96 {
static
autovia no
}
}
启动 ndppd 服务:
ndppd -d -c /etc/ndppd.conf
如果返回以下代码说明ndppd启动成功
(notice) ndppd (NDP Proxy Daemon) version 0.2.5
(notice) Using configuration file '/etc/ndppd.conf'
(warning) Low prefix length (64 <= 120) when using 'static' method
将 ndppd 添加到系统启动,创建服务文件以确保开机启动:
cat <<EOF > /etc/init.d/ndppd
#!/sbin/openrc-run
description="NDP Proxy Daemon"
command="/usr/local/sbin/ndppd"
command_args="-d -c /etc/ndppd.conf"
pidfile="/var/run/ndppd.pid"
depend() {
need net
after firewall
}
EOF
赋予执行权限并启用服务:
chmod +x /etc/init.d/ndppd
rc-update add ndppd default
rc-service ndppd start
以下是彻底卸载 ndppd 的步骤
rc-service ndppd stop
rc-update del ndppd default
rm /etc/init.d/ndppd
rm /usr/local/sbin/ndppd
rm /etc/ndppd.conf
deb http://archive.debian.org/debian buster main contrib non-free
deb http://archive.debian.org/debian buster-updates main contrib non-free
deb http://archive.debian.org/debian-security buster/updates main contrib non-free
官方的反代规则
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:5212;
# 如果您要使用本地存储策略,请将下一行注释符删除,并更改大小为理论最大文件尺寸
# client_max_body_size 20000m;
}
虽然能够访问到转发后的地址,但是所有静态资源文件的请求都报404错误,导致反向代理并没有完全成功。
解决方法则是修改路由路径的匹配规则,加上往下匹配的通配符‘^~’即可
修改后的反代规则:
location ^~ / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:5212;
# 如果您要使用本地存储策略,请将下一行注释符删除,并更改大小为理论最大文件尺寸
# client_max_body_size 20000m;
}