http://www.tuicool.com/articles/FjuyQj  注:文中有些内容做了修改,特别是那个配置文件,不能直接抄着用。

Most people use TunnelBrick to setup OpenVPN client connections on Mac OSX, i prefer using the command line.

To get OpenVPN up and running off the command line is a simple process. The commands below need to be run as a privileged user if your root account is not enabled use sudo to run the commands.

Install OpenVPN

To install OpenVPN 2 from macports run:

sudo port install openvpn2

Install TunTap

To install TunTap from macports run:

sudo port install tuntaposx

Configure it to startup at boot:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.tuntaposx.plist

You need TunTap as it allows you to create virtual interfaces using the supplied kernel extensions. If you don't install TunTap you will get the error Cannot allocate TUN/TAP dev dynamically when you try and make a OpenVPN connection.

Configuration

Create a directory to hold your configuration and keys.

mkdir /opt/local/etc/openvpn

Place your keys and configuration files in /opt/local/etc/openvpn/

A sample client configuration is provided below.

client
dev tun
proto tcp
remote vpn.home.topdog-software.com 1194
nobind
resolv-retry infinite
tls-client
ca /opt/local/etc/openvpn/ca.crt
cert /opt/local/etc/openvpn/client.crt
key /opt/local/etc/openvpn/client.key
ns-cert-type server
cipher BF-CBC
tls-cipher DHE-RSA-AES256-SHA
tls-remote vpn.home.topdog-software.com
tls-auth /opt/local/etc/openvpn/tls-auth.key 1
remote-cert-tls server
comp-lzo
persist-key
persist-tun
mute-replay-warnings
verb 3
mlock

Connecting

To connect simply run:

sudo openvpn --config /opt/local/etc/openvpn/openvpn.conf

Commandline OpenVPN client on Mac OSX with macports的更多相关文章

  1. Mac OSX下Sublime Text配置使用Ctags实现代码跳转

    1. 先用brew工具安装ctags,安装路径在/user/local/bin The default ctags executable in OSX does not support recursi ...

  2. 在Mac osx使用ADT Bundle踩过的坑

    前言 本篇博客整理一下笔者在Mac下使用ADT Bundle踩过的坑,Google现在也不支持Eclipse了,开发者也到了抛弃Eclipse的时候,但考虑到大部分Java的开发者还是比较习惯与Ecl ...

  3. 在Mac OSX系统的Docker机上启用Docker远程API功能

    在Mac OSX系统的Docker机上启用Docker远程API功能 作者:chszs,未经博主同意不得转载.经许可的转载需注明作者和博客主页:http://blog.csdn.net/chszs D ...

  4. mac osx下django-admin.py出现的问题

    mac osx 下面用django-admin.py创建项目的时候,没创建成功出现django-admin.py编辑文件,这主要的原因是mac osx下面django-admin.py被重命名为dja ...

  5. mac osx 上面部署Django项目 apache+mysql+mod_wsgi

    1.安装Xcode command line tools 首先,编译mysql和Homebrew需要用到Xcode command line tools,所以首先安装command line tool ...

  6. Webstorm 10 for mac osx 注册机,序列号,kegen

    小菜最近get到mac体验机会,早就耳闻mac非常适合做开发,于是迫不及待的安装各种开发工具,不知不觉,轮到前端开发神器webstorm了,看了一下官网的价格,心拔凉拔凉的. 果断搜索注册机,搜到的结 ...

  7. Mac OSX网络诊断命令

    作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 下面是一些Mac OSX下常用的网络诊断命令.它们能帮助我们发现网络问题.文中提到 ...

  8. Mac OSX上的软件包管理工具,brew 即 Homebrew

    brew 即 Homebrew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件, 只需要一个命令, 非常方便. brew类似ubuntu系统下的apt-get的功能. 安装 ...

  9. Install Ansible on Mac OSX

    from: https://devopsu.com/guides/ansible-mac-osx.html and : https://devopsu.com/guides/ansible-post- ...

随机推荐

  1. Fragment详解-android学习之旅(四十八)

    Fragment的设计哲学 Fragment的继承体系 Fragment的开发 大部分都会继承如下的三个方法 Fragment与Activity的通信 Fragment与Activity交互信息 Fr ...

  2. Mac下关于->您不能拷贝项目“”,因为它的名称太长或包括的字符在目的宗卷上无效。<-的删除

    打开 Terminal 应用程序. 键入: sudo rm -rf注意:在"-rf"后键入一个空格.没有空格该命令将不能执行.在步骤 6 之前请不要按下 Return 键. 打开您 ...

  3. 有关Spring注解@xxx的零碎知识

     在Java的Spring开发中经常使用一些注解,例如 @XXX 等等,在网上看到收集整理碎片知识,便于懒人计划^=^... 过去,Spring使用的Java Bean对象必须在配置文件[一般为a ...

  4. Android studio中的一次编译报错’Error:Execution failed for task ':app:transformClassesWithDexForDebug‘,困扰了两天

    先说下背景:随着各种第三方框架的使用,studio在编译打包成apk时,在dex如果发现有相同的jar包,不能创建dalvik虚拟机.一个apk,就是一个运行在linux上的一个虚拟机. 上图就是一直 ...

  5. React Native之AppRegistry模块

    我们在写react native的js的时候,在最后总会加上一段代码: AppRegistry.registerComponent('ReactDemo', () => ReactDemo); ...

  6. unity 实现流光效果

    1.通过一些简单效果可以让我们更好的去理解shader,具体都在代码注释中: Shader "Unlit/MoveLightImage" { Properties { //主纹理 ...

  7. Uva - 177 - Paper Folding

    If a large sheet of paper is folded in half, then in half again, etc, with all the folds parallel, t ...

  8. Dynamics CRM OData方式进行增删改查时报错的问题

    今天在通过OData终结点update记录的时候报"Error processing request stream. The request should be a valid top-le ...

  9. 【翻译】Ext JS最新技巧

    原文:Top Support Tips Mitchell Simoens:控制滚动指示器的自动隐藏 Sencha Touch有一个跨平台的,在所有平台看起来和工作效果都一样的滚动条.两条轴(x和y,水 ...

  10. 《java入门第一季》之面向对象(多态向下转型)

    上一篇博客(http://blog.csdn.net/qq_32059827/article/details/51328638)最后对多态的弊端做了显示,这里解决这个弊端.如下: /* 多态的弊端: ...