NoBrand DUAL VPS HDD 玩法之:私有 Openlist

zcp1997 2026-08-20 15:52 1


nobrand dual 内网 openlist 分享


Dual 有两张网卡,eth0 是日本公网 IP(87.86.x.x),eth1 是沪日专线的内网口(172.16.x.x)。默认路由走 eth0,但 eth1 提供了一条从国内直接进入的专线通道。


整体思路是:本机 HDD 用 OpenList 做成网盘,OpenList 本身只监听 127.0.0.1:5244。公网访问通过 Nginx HTTPS 入口,沪日专线则通过 eth1 的内网 IP 进入 Nginx,再转给本机 OpenList。


安装 OpenList


直接使用官方二进制:


mkdir -p /opt/openlist && cd /opt/openlist
wget -O openlist-linux-amd64.tar.gz https://github.com/OpenListTeam/OpenList/releases/latest/download/openlist-linux-amd64.tar.gz
tar -zxvf openlist-linux-amd64.tar.gz
chmod +x openlist
./openlist version

配置 systemd 服务:


cat >/etc/systemd/system/openlist.service <<'EOF'
[Unit]
Description=OpenList
After=network.target

[Service]
Type=simple
WorkingDirectory=/opt/openlist
ExecStart=/opt/openlist/openlist server
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable --now openlist

OpenList 默认监听 0.0.0.0:5244。初始化阶段可以先通过 http://87.86.x.x:5244 登录后台,把管理员账号和存储配置完成。


配置 HDD 存储


后台进入「存储 → 添加 → 本机存储」。例如 HDD 实际目录为 /data/hdd,可以设置根路径 /data/hdd、挂载路径 /hdd


建议先通过公网把目录浏览、上传、下载和删除都测试一遍,确认本机存储读写正常,再修改监听方式。


OpenList 改为只监听本机


确认存储没问题后,把 OpenList 从 0.0.0.0 收回到 localhost:


cp /opt/openlist/data/config.json /opt/openlist/data/config.json.bak
sed -i 's/"address": "0.0.0.0"/"address": "127.0.0.1"/' /opt/openlist/data/config.json
systemctl restart openlist

这样 OpenList 本体不再直接暴露在任何网卡上,公网和专线都统一由 Nginx 接入。


配置 Nginx 双入口


公网准备一个域名,例如:


dual.example.com → 87.86.x.x

证书申请过程略。


沪日专线入口直接使用内网 IP 172.16.x.x:5244,公网入口则使用 dual.example.com:443


cat >/etc/nginx/conf.d/openlist.conf <<'EOF'
server {
listen 87.86.x.x:80;
server_name dual.example.com;
return 301 https://$host$request_uri;
}

# OpenList - 沪日专线入口
server {
listen 172.16.x.x:5244;
server_name _;

allow 172.16.x.x;
deny all;

client_max_body_size 0;

location / {
proxy_pass http://127.0.0.1:5244;
proxy_http_version 1.1;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto http;

proxy_request_buffering off;
proxy_buffering off;

proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
}
}

# OpenList - 日本公网入口
server {
listen 87.86.x.x:443 ssl;
server_name dual.example.com;

ssl_certificate /path/to/fullchain.cer;
ssl_certificate_key /path/to/example.com.key;

client_max_body_size 0;

location / {
proxy_pass http://127.0.0.1:5244;
proxy_http_version 1.1;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;

proxy_request_buffering off;
proxy_buffering off;

proxy_connect_timeout 60s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
}
}
EOF

nginx -t && systemctl restart nginx

这里沪日入口加了:


allow 172.16.x.x;
deny all;

原因是实际代理连接由本机代理程序发起,Nginx 看到的来源同样是 172.16.x.x。这样即使上海公网入口能够把流量送到这张网卡,也不会直接开放这个 HTTP 入口给其他来源。


最终检查:


ss -lntp | grep -E ':443|:5244'

正常状态应该是:


87.86.x.x:443      → Nginx 公网 HTTPS
172.16.x.x:5244 → Nginx 沪日专线入口
127.0.0.1:5244 → OpenList

专线访问规则


国内客户端给 172.16.x.x/32 单独配置一条走沪日专线的规则,并且放在类似 172.16.0.0/12,DIRECT 这种大范围私网直连规则之前,否则会先被 DIRECT 命中。


这样访问:


http://172.16.x.x:5244/dav/

时,客户端会把连接交给沪日专线代理,由代理在 Dual 本机连接 Nginx,再转给 OpenList。


公网则直接使用:


https://dual.example.com/dav/

不需要额外的专线路由规则。


WebDAV 最终入口


沪日专线:


http://172.16.x.x:5244/dav/

日本公网:


https://dual.example.com/dav/

最终数据路径分别是:


沪日:客户端 → 沪日专线代理 → eth1 → Nginx :5244 → OpenList 127.0.0.1:5244

公网:客户端 → Internet → eth0 → Nginx :443 → OpenList 127.0.0.1:5244

小结


这套方案的重点就是把 Dual 的双网卡真正利用起来。OpenList 本体只监听 localhost,不直接暴露;公网走 eth0 + HTTPS,国内有沪日专线时则直接走 eth1 的内网入口。


同一份 HDD 数据,两条访问路径可以按场景自由选择。人在国内时直接挂沪日专线 WebDAV,可以绕开日本公网回程;需要普通公网访问时,则使用 HTTPS 域名即可。

最新回复 (8)
  • armchannel 08-20 15:54
    1

    两张网卡,这看起来好像利群啊,一个CN的一个CU的

  • zcp1997 楼主 08-20 15:56
    2

    @armchannel #1 对的,我两个机器都有,折腾一下学习配置双网卡机器

  • jiangwl 08-20 15:57
    3

    ^-^

  • armchannel 08-20 15:57
    4

    @zcp1997 #2 挺好的,这个也是自带CM入口的么,感觉跟KFC 套餐一样啊,带一个IX的入口;再带一个日本方向的IP

  • zcp1997 楼主 08-20 15:58
    5

    @armchannel #4 自带CM和IX入口,再加一个独立Skyline VPS 再加个HDD

  • armchannel 08-20 15:59
    6

    @zcp1997 #5 骚操作越来越多了,本质上是把IX和线路VPS合二为一的机器,哈哈哈,新玩法

  • xiaogang-119 08-20 16:13
    7

    要是IX可以直接通内网,就能管理本家的很多机器,更爽了

  • zcp1997 楼主 08-20 17:20
    8

    方案优化了下

* 帖子来源NodeSeek
返回