banner
NEWS LETTER

Kubernetes+IPSEC+FRP实现内网穿透

Scroll down

本文作者:丁辉

Kubernetes+IPSEC+FRP实现内网穿透

服务器名称 IP
公网服务器 192.168.1.10
内网服务器 192.168.1.20

准备:

  1. 克隆文件到本地

    1
    2
    git clone https://gitea.offends.cn/offends/Kubernetes.git
    cd Kubernetes/File/Yaml
  2. 准备 Kubernetes 环境

部署IPSEC

IPSEC官方文档

高级参数配置

  1. 配置用户密码以及密钥

    1
    mkdir -p /opt/vpn
    1
    2
    3
    4
    5
    cat > /opt/vpn/vpn.env << EOF
    VPN_IPSEC_PSK=demo
    VPN_USER=demo
    VPN_PASSWORD=demo
    EOF

    将 demo 替换成自己的 KEY、USER、PSSWORD

部署FRP

本地客户端配置 Frpc

  1. 编写配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    cat > /opt/vpn/frpc.ini << EOF
    [common]
    server_addr = 192.168.1.10 #填写frps的IP
    server_port = 7000 #填写frps的port

    [ipsec-500]
    type = udp
    local_ip = ipsec-vpn-server
    local_port = 500
    remote_port = 500

    [ipsec-4500]
    type = udp
    local_ip = ipsec-vpn-server
    local_port = 4500
    remote_port = 4500
    EOF
  2. 启动容器

    1
    kubectl apply -f https://gitee.com/offends/Kubernetes/raw/main/File/Yaml/frpc.yaml

公网服务端配置 Frps Server

  1. 编辑配置文件

    1
    mkdir /opt/vpn
    1
    2
    3
    4
    cat > /opt/vpn/frps.ini << EOF
    [common]
    bind_port = 7000
    EOF
  2. 启动容器

    1
    kubectl apply -f https://gitee.com/offends/Kubernetes/raw/main/File/Yaml/frps.yaml

卸载清理

  1. 本地客户端清理

    1
    2
    kubectl delete -f https://gitee.com/offends/Kubernetes/raw/main/File/Yaml/frpc.yaml
    rm -rf /opt/vpn
  2. 公网服务端清理

    1
    2
    kubectl delete -f https://gitee.com/offends/Kubernetes/raw/main/File/Yaml/frpc.yaml
    rm -rf /opt/vpn

电脑连接

  • MAC电脑配

    • 置打开 VPN 配置,添加使用 L2TP/IPSec 协议

    • 要记得勾选通过VPN连接发送所有流量

  • Windows电脑配置

    • 打开设置,添加 VPN 连接,使用 L2TP/IPSec 协议

I'm so cute. Please give me money.

其他文章
cover
Docker-Compose+IPSEC+FRP实现内网穿透
  • 70/01/01
  • 00:00
  • Kubernetes-网络
cover
Docker-Registry
  • 70/01/01
  • 00:00
  • Kubernetes-镜像仓库
目录导航 置顶
  1. 1. Kubernetes+IPSEC+FRP实现内网穿透
    1. 1.1. 部署IPSEC
    2. 1.2. 部署FRP
      1. 1.2.1. 本地客户端配置 Frpc
      2. 1.2.2. 公网服务端配置 Frps Server
    3. 1.3. 卸载清理
    4. 1.4. 电脑连接
请输入关键词进行搜索