当前位置: 代码网 > 服务器>服务器>云虚拟主机 > ubuntu如何在docker容器中安装strongswan

ubuntu如何在docker容器中安装strongswan

2024年05月26日 云虚拟主机 我要评论
1.起动一个ubuntu容器,我是用的docker compose启动的,compose的配置文件为ipsec-strongswan.ymlservices: ipsec-strongswan:

1.起动一个ubuntu容器,我是用的docker compose启动的,compose的配置文件为ipsec-strongswan.yml

services:
  ipsec-strongswan:
    image: ubuntu:22.04
    container_name: ipsec-strongswan
    cap_add:
      - net_admin
      - sys_admin
      - sys_module
    command: "tail -f /dev/null" # 示例:保持容器运行,但不会做任何实际工作
    volumes:
      - /opt/services/ipsec-strongswan/ipsec.conf:/etc/ipsec.conf
      - /opt/services/ipsec-strongswan/ipsec.secrets:/etc/ipsec.secrets
      - /opt/services/ipsec-strongswan/usertrust_rsa_certification_authority.pem:/etc/ipsec.d/cacerts/usertrust_rsa_certification_authority.pem
      - /opt/services/ipsec-strongswan/charon-logging.conf:/etc/strongswan.d/charon-logging.conf
      - /opt/services/ipsec-strongswan/log:/var/log/strongswan
    #端口是给3proxy用的
    ports:
      - 1180:1080
networks:
  default:
    name: sill
sudo docker compose -f ipsec-strongswan.yml up -d

2.进入容器内

sudo docker exec -it ipsec-strongswan /bin/bash

3.开始安装

apt-get update
apt-get install strongswan libcharon-extra-plugins

再安装一些常用的软件

apt-get install vim iputils-ping curl mtr

我的配置已经在compose文件里加载了,所以不配了。直接启动

# 启动ipsec
ipsec restart
# 连接connection uk2
ipsec up uk2

连接成功的话显示connection ‘uk2’ established successfully
查看状态

ipsec statusall

停止连接

ipsec down uk2

停止ipsec

ipsec stop

以下是一些其他命令:
查看网络

ip addr show   简写为 ip a s

查看docker服务的网络

sudo docker inspect -f '{{.name}}: {{range.networksettings.networks}}{{.ipaddress}}{{end}}' nginx jenkins rmqnamesrv mysql rmqbroker rocketmq-console redis6379 redis6380 redis6381 sentinel26379 sentinel26380 sentinel26381 ipsec-strongswan

查看主机路由

ip route show

附 安装3proxy

sudo docker cp /home/ubuntu/downloads/3proxy-0.9.4.x86_64.deb ipsec-strongswan:/usr/local

参考资料

ubuntu安装缷载3proxy

到此这篇关于ubuntu在docker容器中安装strongswan的文章就介绍到这了,更多相关docker容器安装strongswan内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com