自制 docker 版本 ocserv

2015-02-12 15:01:54 +08:00
 TommyLau
最近为了解决 iPhone 科学上网问题,研究了一下 ocserv,顺便做了一个 Docker 镜像,给有需要的同学使用。

docker pull tommylau/ocserv
docker run --name ocserv --privileged -p 443:443 -d tommylau/ocserv

这种方式是最简单的,会自动创建用户名和密码均为 test 的用户,客户端直接使用 Cisco AnyConnect 连接服务器就可以了。

更多的信息请参考:
Docker Hub: https://registry.hub.docker.com/u/tommylau/ocserv/
GitHub: https://github.com/TommyLau/docker-ocserv
中文 Blog: http://tommy.net.cn/2015/02/12/deploy-openconnect-server-with-docker/
4041 次点击
所在节点    分享创造
11 条回复
luo362722353
2015-02-12 15:17:16 +08:00
Good
xiaojay
2015-02-12 15:49:02 +08:00
谢谢分享

blog rss订阅挂了?
kacong
2015-02-12 16:28:24 +08:00
mark, this is a good guide for newbies..
i8s301a
2015-02-12 16:50:24 +08:00
谢谢,研究学习一下
zjgood
2015-02-12 16:57:25 +08:00
为毛iptables都不用配置呢?现在docker已经这么牛了啊
TommyLau
2015-02-12 19:29:41 +08:00
在官网说明 (http://www.infradead.org/ocserv/manual.html) 中,看到了如下一行:

> The server maintains two connections/channels with the client. The main VPN channel is established over TCP and TLS. This is the control channel as well as the backup data channel. After its establishment a UDP channel using DTLS is initiated which serves as the main data channel. If the UDP channel fails to establish or is temporarily unavailable the backup channel over TCP/TLS is being used.

所以,服务器开启的时候,最好再加上 -p 443:443/udp,比如:

docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d tommylau/ocserv
Eleutherios
2015-02-13 09:19:06 +08:00
@TommyLau 我觉得国内使用的话, 不加UDP没准会更好
TommyLau
2015-02-13 09:24:47 +08:00
@Eleutherios 按照官方的介绍的话,如果 UDP 连接失败的话,会自动跳回 TCP 的,不过考虑到国内到海外线路 UDP 丢包的严重性的话,也许不加 UDP 可能会更好。
hezhile
2015-02-14 17:47:15 +08:00
请问 ocserv的端口可以改为443以外的吗?我想把ocserv跟shadowsocks放在同一台VPS上面 现在用的shadowsocks已经用了443端口。
TommyLau
2015-02-14 22:52:22 +08:00
@hezhile 可以参考 ocserv 官方的文档: http://www.infradead.org/ocserv/multihost.html

比如,你可以把 shadowsocks 设置在 4443,然后 ocserv 设置在 4444,然后 sniproxy 跑在 443 上监听。然后用2个不同的域名来访问,比如 ss.yourhost.comoc.yourhost.com

table TableName {
# Match exact request hostnames
ss.yourhost.com 127.0.0.1:4443
oc.yourhost.com 127.0.0.1:4444
}

不过流量大的话,不建议这样使用。另外,建议使用 tommylau/ocserv-0.8.9 这个镜像,0.9.0 因为加入了 FreeRadius 会有断开后无法重连的问题,要把 ocserv 映射到主机的 4444 端口,可以这样操作:

docker run --name ocserv --privileged -p 4444:443 -p 4444:443/udp -d tommylau/ocserv-0.8.9
1etters
2015-09-03 08:44:53 +08:00
这个要怎么修改路由表呢?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/170472

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX