N2N 对等VPN网络
n2n是一个二层的虚拟专网,允许用户开发网络中典型的P2P应用而不是在应用层开发。这就意味着用户可以透明的得到本地地址,只要新的IP地址在一个子网内,无论两台机器处于什么位置都能够ping通对方。
N2N网络的主要特点:
- n2n网络是基于P2P协议的二层加密网络
- 加密是在节点上完成的,而且使用的是用户的自定义密钥;你控制自己的安全,而不用让比如skype代表你(管理你的服务器节点)
- 每个n2n用户可以同时属于多个网络
- 能够反向的穿越NAT和防火墙,因此n2n节点即使在内网也是能够被访问到的,因此防火墙不再是IP级别直接通讯的障碍。
- n2n网络并没有设计成独立的(自包含的),但是可能能够在n2n和非n2n网络之间路由数据。
n2n构架是基于两个部分的:
终端节点:安装在用户计算机上的应用使n2n网络被创建。每个节点设备都会创建一个TUN/TAP虚拟网卡设备作为接入n2n网络的入口点。
超级节点:作用是使终端节点能够访问到对称防火墙后面的其他终端节点。这个程序是那些无法直接通讯节点的目录记录器和包路由器。

从图上可以看出,SuperNode作用是进行转发等通讯,因为其在公网,可以将两个内网的Edge节点连接起来。
- #!/bin/sh /etc/rc.common
- # Copyright (C) 2008-2012 OpenWrt.org
- START=90
- start_instance() {
- local cfg="$1"
- config_get type "$cfg" TYPE
- case "$type" in
- edge)
- config_get ipaddr "$cfg" 'ipaddr'
- [ -n "$ipaddr" ] || return 1
- config_get supernode "$cfg" 'supernode'
- config_get port "$cfg" 'port'
- config_get community "$cfg" 'community'
- config_get key "$cfg" 'key'
- config_get_bool route "$cfg" 'route' '0'
- [ "$route" = "1" ] && args='-r'
- service_start /usr/sbin/edge -f $args -a $ipaddr -c $community -k $key -l ${supernode}:${port}
- ;;
- supernode)
- config_get port "$cfg" port
- [ -n "$port" ] || return 1
- service_start /usr/sbin/supernode -l $port
- ;;
- esac
- }
- stop_instance() {
- local cfg="$1"
- config_get type "$cfg" TYPE
- case "$type" in
- edge)
- service_stop /usr/sbin/edge
- ;;
- supernode)
- service_stop /usr/sbin/supernode
- ;;
- esac
- }
- start() {
- config_load 'n2n'
- config_foreach start_instance 'edge'
- config_foreach start_instance 'supernode'
- }
- stop() {
- config_load 'n2n'
- config_foreach stop_instance 'edge'
- config_foreach stop_instance 'supernode'
- }
从对应的启动文件可以看出,使用非常的简单。
- config edge
- option ipaddr ''
- option supernode ''
- option port ''
- option community ''
- option key ''
- option route ''
下面的内容是我的两台主机和服务器之间的通讯输出Debug信息
- 10/Sep/2013 23:51:47 [ n2n.c: 49] Marshalling hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:7654
- 10/Sep/2013 23:51:47 [ n2n.c: 638] 84 bytes compressed into 87
- 10/Sep/2013 23:51:47 [ n2n.c: 681] ### Tx N2N Msg -> network
- 10/Sep/2013 23:52:17 [ n2n.c: 843] Purging old registrations
- 10/Sep/2013 23:52:17 [ n2n.c: 848] Remove 0 registrations
- 10/Sep/2013 23:52:22 [ n2n.c: 49] Unmarshalled hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:50000
- 10/Sep/2013 23:52:22 [ n2n.c: 540] +++ Received unreliable data packet [rcvd_from=60.215.250.204:50000][msg_type=MSG_TYPE_REGISTER][seq_id=0]
- 10/Sep/2013 23:52:22 [ n2n.c: 545] [src_mac=DE:AD:BE:EF:01:23][dst_mac=00:00:00:00:00:00][original_sender=0.0.0.0:0]
- 10/Sep/2013 23:52:22 [supernode.c: 312] Received message from node [60.215.250.204:-15536]
- 10/Sep/2013 23:52:22 [ n2n.c: 49] Unmarshalled hdr: public_ip=(2)60.215.250.204:50000, private_ip=(2)0.0.0.0:50000
- 10/Sep/2013 23:52:22 [ n2n.c: 49] Marshalling hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:7654
- 10/Sep/2013 23:52:22 [ n2n.c: 49] Unmarshalled hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:7654
- 10/Sep/2013 23:52:22 [ n2n.c: 736] Sent unreliable packet [msg_type=MSG_TYPE_REGISTER_ACK][seq_id=0][src_mac=00:00:00:00:00:00][dst_mac=DE:AD:BE:EF:01:23]
- 10/Sep/2013 23:52:22 [ n2n.c: 49] Marshalling hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:7654
- 10/Sep/2013 23:52:22 [ n2n.c: 638] 84 bytes compressed into 87
- 10/Sep/2013 23:52:22 [ n2n.c: 681] ### Tx N2N Msg -> network
- 10/Sep/2013 23:52:47 [ n2n.c: 49] Unmarshalled hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:50001
- 10/Sep/2013 23:52:47 [ n2n.c: 540] +++ Received unreliable data packet [rcvd_from=60.215.250.204:50001][msg_type=MSG_TYPE_REGISTER][seq_id=0]
- 10/Sep/2013 23:52:47 [ n2n.c: 545] [src_mac=DE:AD:BE:EF:01:24][dst_mac=00:00:00:00:00:00][original_sender=0.0.0.0:0]
- 10/Sep/2013 23:52:47 [supernode.c: 312] Received message from node [60.215.250.204:-15535]
- 10/Sep/2013 23:52:47 [ n2n.c: 49] Unmarshalled hdr: public_ip=(2)60.215.250.204:50001, private_ip=(2)0.0.0.0:50001
- 10/Sep/2013 23:52:47 [ n2n.c: 49] Marshalling hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:7654
- 10/Sep/2013 23:52:47 [ n2n.c: 49] Unmarshalled hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:7654
- 10/Sep/2013 23:52:47 [ n2n.c: 736] Sent unreliable packet [msg_type=MSG_TYPE_REGISTER_ACK][seq_id=0][src_mac=00:00:00:00:00:00][dst_mac=DE:AD:BE:EF:01:24]
- 10/Sep/2013 23:52:47 [ n2n.c: 49] Marshalling hdr: public_ip=(2)0.0.0.0:0, private_ip=(2)0.0.0.0:7654
- 10/Sep/2013 23:52:47 [ n2n.c: 638] 84 bytes compressed into 87
- 10/Sep/2013 23:52:47 [ n2n.c: 681] ### Tx N2N Msg -> network
N2N 对等VPN网络的更多相关文章
- Azure Virtual NetWoker(一)对等互连网络
一,引言 Virtual NetWork Peering 可以无缝连接两个 Azure Virtual NetWork,Virtual NetWork Peering 直接的网络流量是专用的.在实际项 ...
- 用DotRas来连接VPN网络
最近要用程序来不断的连接VPN(为什么要这样就不讨论了),开始用的是如下代码: public static bool ADSL() { bool flag = true; do { Console.W ...
- [网络技术]VPN设置
1.解决VPN服务器默认路由困扰 现在移动办公已经变得家常便饭,每次外出出差办公需要访问单位的内网服务器时,该怎么办呢?相信很多人都想到了VPN连接!的确,使用VPN连接, 我们可以利用现成的Inte ...
- VPN拨号后使用本地网络上网
网络环境大概是这样了:我在家里用ADSL上网,通过VPN连接到公司的服务器.但是连接VPN后,只能登录到公司的服务器,与INTERNET就断开了,QQ.网页都断开了.公司的服务器应该是连网的,可能被限 ...
- VPN的分类方式
VPN的分类方式 VPN的分类方式比较混乱.不同的生产厂家在销售它们的VPN产品时使用了不同的分类方式,它们主要是产品的角度来划分的.不同的ISP在开展VPN业务时也推出了不同的分类方式,他们主 ...
- 001.网络TCP/IP工程知识点
一 互联网概述 计算机网络定义:由自主计算机互连起来的集合体. 计算机网络两大部分:硬件:计算机.通信设备.接口设备和传输介质. 软件:通信协议和应用软件. 广域网拓扑结构通常有:网状拓扑结构和环形拓 ...
- 数据中心网络架构的问题与演进 — 云网融合与 SD-WAN
目录 文章目录 目录 前文列表 云网融合 云网融合的应用场景 SD-WAN SD-WAN 的应用场景 企业组网互联 SD-EN 数据中心互联 SD-DCI 云间互联 SD-CX 企业用户接入云 数据中 ...
- Azure Site to Site VPN 配置手册
目录 1 Azure Site to Site VPN配置前的准备 1 1.1 设备兼容 1 1.2 网络要求和注意事项 1 2 配置Azure site t ...
- Neutron 理解(10):虚拟专用网(VPN)虚拟化 [How Neutron implements VPN Virtualization]
学习 Neutron 系列文章: (1)Neutron 所实现的虚拟化网络 (2)Neutron OpenvSwitch + VLAN 虚拟网络 (3)Neutron OpenvSwitch + GR ...
随机推荐
- 数据库(学习整理)----3--Oracle创建表和设置约束
BBS论坛表设计 包含的表:BBSusers(用户表),BBSsection(版块表),BBStopic(主贴表),BBSreply(跟帖表) 表结构 1)BBSusers 字段名 字段说明 数据类型 ...
- [Introduction to programming in Java 笔记] 1.3.7 Converting to binary 十进制到二进制的转换
public class Binary { public static void main(String[] args) { // Print binary representation of N. ...
- C++学习笔记-2-构造函数和析构函数
问题2. 什么时候执行构造函数和析构函数 22:59:40 2015-07-22 做了一个实验: #include <iostream> class Object{ public: Ob ...
- [LeetCode OJ] Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same colo ...
- 读书笔记之 - javascript 设计模式 - 责任链模式
责任链模式可以用来消除请求的发送者和接收者之间的耦合.这是通过实现一个由隐式地对请求进行处理的对象组成的链而做到的.链中的每个对象可以处理请求,也可以将其传给下一个对象. 责任链的结构: 责任链由多个 ...
- WPF学习(二)布局与菜单、工具栏
布局 //表格①Grid//3列 4行的表格 <Grid> <Grid.ColumDefinitions> <ColumnDefinti ...
- [Python笔记]第十六篇:web框架之Tornado
Tornado是一个基于python的web框架,xxxxx 安装 python -m pip install tornado 第一个Tornado程序 安装完毕我们就可以新建一个app.py文件,放 ...
- python中的buildin函数详解(第一篇)
这会是很长的一个帖子,因为我打算从python最基础的东西开始,尝试去完全的掌握它,buildin中有一些常用的函数比如 abs, open, setattr, getattr, 大家都很了解他们的用 ...
- 通过CTAPI和Citect SCADA软件进行数据通讯
官方文档 Citect SCADA 7.20 Technical Reference 参考文献 基于Citect远程控制的变流量堆料控制系统 [王玉增,顾英妮,王维 济南大学,机械工程学院 ,Cite ...
- shuffle ----- mr 董西城
http://dongxicheng.org/framework-on-yarn/apache-spark-shuffle-details/