n2n搭建手记-1-V1

搭建环境

supernode :阿里云主机一台 aly1(Centos 6.5)

edg2node:美团云机器两台 mty1,mty2(Centos 7.0)

 Step-1 各机器安装subviersion 并编译安装n2n_v1

#很重要,确保gcc和ssl版本一致,

yum install subversion gcc-c++ openssl-devel

svn co https://svn.ntop.org/svn/ntop/trunk/n2n
cd n2n/n2n_v1/

make && make install
cp supernode /usr/sbin/
cp edge /usr/sbin/

Step-2 中心节点super aly1 开启服务和端口

远程登录至aly1

vim /etc/sysconfig/iptables
*filter下配置

-A INPUT -p tcp -m tcp --dport 1000 -j ACCEPT

 

iptables save

#启动supernode (注:此处开放端口在配置边缘节点机器时用)

supernode -l 1000 -v >/dev/null &

 

Step-3配置边缘节点机器

 分别登录两台美团云机器,设置边缘节点(xxx.xxx.xxx.xxx:1000 即为阿里云super机器ip)

边缘节点1

edge -d n2n0 -c mynetwork -k encryptme -a 10.0.0.1 -l xxx.xxx.xxx.xxx:1000 >/dev/null &

边缘节点2

edge -d n2n0 -c mynetwork -k encryptme -a 10.0.0.2 -l xxx.xxx.xxx.xxx:1000 >/dev/null &

Step-4 验证n2n网络通讯

在节点1 ping 10.0.0.2 ,在节点2 ping 10.0.0.1 网络正常。

ssh 10.0.0.x可互联。

 

n2n网络搭建完成。

------------ -------------- --------------- ----------------- ------------------ -----------

n2n的命令详解

 1 edge -d <tun device> -a <tun IP address> -c <community> -k <encrypt key> -s <netmask> [-u <uid> -g <gid>][-f][-m <MAC address>]  
 2 -l <supernode host:port> [-p <local port>] [-M <mtu>] [-t] [-r] [-v] [-b] [-h]  
 3   
 4 -d <tun device>          | tun device name  
 5 -a <tun IP address>      | n2n IP address  
 6 -c <community>           | n2n community name  
 7 -k <encrypt key>         | Encryption key (ASCII) - also N2N_KEY=<encrypt key>  
 8 -s <netmask>             | Edge interface netmask in dotted decimal notation (255.255.255.0)  
 9 -l <supernode host:port> | Supernode IP:port  
10 -b                       | Periodically resolve supernode IP  
11                          | (when supernodes are running on dynamic IPs)  
12 -p <local port>          | Local port used for connecting to supernode  
13 -u <UID>                 | User ID (numeric) to use when privileges are dropped  
14 -g <GID>                 | Group ID (numeric) to use when privileges are dropped  
15 -f                       | Fork and run as a daemon. Use syslog.  
16 -m <MAC address>         | Choose a MAC address for the TAP interface  
17                          | eg. -m 01:02:03:04:05:06  
18 -M <mtu>                 | Specify n2n MTU (default 1400)  
19 -t                       | Use http tunneling (experimental)  
20 -r                       | Enable packet forwarding through n2n community  
21 -v                       | Verbose  

 

posted @ 2016-10-28 09:59  快乐无限  阅读(2692)  评论(0编辑  收藏  举报