如题

先准备两个ss,参数都是可以自己改的,推荐使用不同的加密方法

extra_hosts是用来自定义解析的,可以删掉。

cat docker-compose.yaml
version: '3'
services:
  shadowsocks-:
    image: shadowsocks/shadowsocks-libev:edge
    ports:
      - "57348:8388/udp"
      - "57348:8388/tcp"
    restart: unless-stopped
    environment:
      TZ: Asia/Shanghai
      PASSWORD: LKSJDFHd2321jhdfjds1203
      METHOD: aes-256-gcm
      TIMEOUT: 300
      DNS_ADDRS: '8.8.8.8,8.8.4.4'
      ARGS: "-v --no-delay"
    logging:
      driver: "json-file"
      options:
        max-size: "1M"
        max-file: "10"
    extra_hosts:
      - "domain:ip"

  shadowsocks:
    image: shadowsocks/shadowsocks-libev:edge
    ports:
      - "57349:8388/udp"
      - "57349:8388/tcp"
    restart: unless-stopped
    environment:
      TZ: Asia/Shanghai
      PASSWORD: LKSJDFHd2321jhdfjds1203
      METHOD: aes-256-gcm
      TIMEOUT: 300
      DNS_ADDRS: '8.8.8.8,8.8.4.4'
      ARGS: "-v --no-delay"
    logging:
      driver: "json-file"
      options:
        max-size: "1M"
        max-file: "10"
    extra_hosts:
      - "domain:ip"

然后划分一下端口,把10000-20000的端口都分给第一个ss实例,40000-50000分给第二个。

iptables -t nat -A PREROUTING -p tcp --dport 10000:20000 -j REDIRECT --to-port 57348
iptables -t nat -A PREROUTING -p udp --dport 10000:20000 -j REDIRECT --to-port 57348
iptables -t nat -A PREROUTING -p tcp --dport 40000:50000 -j REDIRECT --to-port 57349
iptables -t nat -A PREROUTING -p udp --dport 40000:50000 -j REDIRECT --to-port 57349

以上就完成了,在客户端登记的时候就可以随意填一个端口了

标签: shadowsocks

添加新评论