All Projects → lvsgate → Lvs Dpdk

lvsgate / Lvs Dpdk

Licence: apache-2.0
LVS on dpdk

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to Lvs Dpdk

Natasha
Natasha is a fast and scalable, DPDK powered, stateless NAT44 packet processor
Stars: ✭ 111 (-11.2%)
Mutual labels:  nat, dpdk
The router
TheRouter is a software packet router based on DPDK an NPF libraries.
Stars: ✭ 123 (-1.6%)
Mutual labels:  nat, dpdk
Npf
NPF: packet filter with stateful inspection, NAT, IP sets, etc.
Stars: ✭ 160 (+28%)
Mutual labels:  nat, dpdk
Nff Go
NFF-Go -Network Function Framework for GO (former YANFF)
Stars: ✭ 1,036 (+728.8%)
Mutual labels:  dpdk
Mr2
Mr.2 can help you expose local server to external network. Support both TCP/UDP, of course support HTTP. Zero-Configuration.
Stars: ✭ 1,102 (+781.6%)
Mutual labels:  nat
Vycontrol
vyos frontend
Stars: ✭ 92 (-26.4%)
Mutual labels:  nat
Esp Idf Nat Example
ESP-IDF example project with NAT setup.
Stars: ✭ 41 (-67.2%)
Mutual labels:  nat
Sslsplit
Transparent SSL/TLS interception
Stars: ✭ 1,371 (+996.8%)
Mutual labels:  nat
Turn Client
STUN & TURN client demo and api with python and C
Stars: ✭ 82 (-34.4%)
Mutual labels:  nat
Coil
CNI plugin for Kubernetes designed for scalability and extensibility
Stars: ✭ 81 (-35.2%)
Mutual labels:  nat
Fastclick
FastClick - A faster version the Click Modular Router featuring batching, advanced multi-processing and improved Netmap and DPDK support (ANCS'15). Check the metron branch for Metron specificities (NSDI'18).
Stars: ✭ 100 (-20%)
Mutual labels:  dpdk
Tcptunnel
将本地内网服务器映射到公网。
Stars: ✭ 72 (-42.4%)
Mutual labels:  nat
Nat
nat - the 'ls' replacement you never knew you needed
Stars: ✭ 1,129 (+803.2%)
Mutual labels:  nat
Pcapplusplus
PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use. It provides C++ wrappers for the most popular packet processing engines such as libpcap, WinPcap, DPDK and PF_RING.
Stars: ✭ 1,322 (+957.6%)
Mutual labels:  dpdk
Nat Explorer
An example project using Nat & Weex.
Stars: ✭ 55 (-56%)
Mutual labels:  nat
Smargate
内网穿透,c++实现,无需公网IP,小巧,易用,快速,安全,最好的多链路聚合(p2p+proxy)模式,不做之一...这才是你真正想要的内网穿透工具!
Stars: ✭ 1,378 (+1002.4%)
Mutual labels:  nat
Frps Onekey
Frps 一键安装脚本&管理脚本 A tool to auto-compile & install frps on Linux
Stars: ✭ 1,014 (+711.2%)
Mutual labels:  nat
Aws Lambda Vpc Nat Examples
Example of setting up AWS lambda function with VPC and NAT
Stars: ✭ 92 (-26.4%)
Mutual labels:  nat
Wenat Client Java
Wenat内网穿透,java版客户端
Stars: ✭ 70 (-44%)
Mutual labels:  nat
Frp
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Stars: ✭ 51,746 (+41296.8%)
Mutual labels:  nat

lvs-dpdk

This project has ported LVS FULLNAT/DR/NAT and SNAT-GATEWAY to OpenFastPath(base on odp-dpdk).

NAT is only available on single core while FULLNAT,DR and SNAT-GATEWAY support multi-cores, because in lvs-dpdk each core has one local session table and depend on flow director.

LVS-FULLNAT origin source code is at https://github.com/alibaba/LVS

LVS-SNAT gateway origin source code is at https://github.com/jlijian3/lvs-snat

I had forked OpenFastPath project and added support for flow director and ofp_vs example, see https://github.com/lvsgate/ofp/tree/master/example/ofp_vs

I had forked odp-dpdk project and added support for flow director, see https://github.com/lvsgate/odp-dpdk.git

Please note that this project is experimental, it only had limited testing and never runned in production environment.

Prerequisites

  • Intel x86 CPU
  • NIC which support flow director, if you want to run on multi-cores
  • lvs-dpdk has been compiled and tested on Centos 7.2 with 3.10 kernel
  • 5G memory at least

Performance

  • CPU E5-2682 v4 @ 2.50GHz
  • NIC intel 82599 10G
  • fullnat 800w pps if use 5 cores (in 400w pps and out 400w pps)

Build all in one step

git clone https://github.com/lvsgate/lvs-dpdk.git
cd lvs-dpdk
./build_all.sh
cd ofp_vs

If build all successfully Goto step 5, otherwise build one by one.

Build steps one by one

1. Fetch and compile DPDK

git clone git://dpdk.org/dpdk ./<dpdk-dir>
cd <dpdk-dir>
git checkout -b 17.02 tags/v17.02
make config T=x86_64-native-linuxapp-gcc O=x86_64-native-linuxapp-gcc
cd <dpdk-dir>/x86_64-native-linuxapp-gcc
sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
cd ..
make install T=x86_64-native-linuxapp-gcc EXTRA_CFLAGS="-fPIC"

#Add env value
export RTE_SDK=<dpdk-dir>
	export RTE_TARGET=x86_64-native-linuxapp-gcc

2. Fetch and compile odp-dpdk

git clone  https://github.com/lvsgate/odp-dpdk.git <odp-dir>
cd <odp-dir>
./bootstrap
#SHARED library
./configure --enable-shared --with-platform=linux-dpdk --enable-helper-linux --with-sdk-install-path=<dpdk-dir>/x86_64-native-linuxapp-gcc --prefix=<INSTALL ODP-DPDK TO THIS DIR>
#If build only static library, dpdk driver register function defined with __attribute__(construction) won't be called.

make
make install

3. Fetch and compile ofp

yum install libnl3 libnl3-cli libnl3-devel #or download rpm from https://www.infradead.org/~tgr/libnl/
git clone https://github.com/lvsgate/ofp.git <ofp-dir>
cd <ofp-dir>
./bootstrap
./configure --disable-libconfig --with-odp-lib=odp-dpdk --with-odp=<ODP-DPDK INSTALLATION DIR> --enable-shared=no --enable-sp=yes --disable-mtrie CPPFLAGS=-I<ODP-DPDK INSTALLATION DIR>/include/odp/arch/x86_64-linux/
make

4. Fetch and compiled lvs-dpdk tools

git clone https://github.com/lvsgate/lvs-dpdk.git
cd lvs-dpdk/tools/keepalived
sh configure --prefix=/usr --sysconfdir=/etc/ CPPFLAGS=-I/usr/include/libnl3/ LDFLAGS=-L/usr/lib64/
make
make install
cd lvs-dpdk/tools/ipvsadm
make
make install

5. Prepare DPDK for running lvs-dpdk

echo 8192 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 8192 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
modprobe uio
insmod <dpdk-dir>/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
cd <dpdk-dir>
./usertools/dpdk-devbind.py --status
./usertools/dpdk-devbind.py --bind=igb_uio <pci-id-1>
./usertools/dpdk-devbind.py --bind=igb_uio <pci-id-2>

6. Run ofp_vs

modprobe ip_vs  #add this line to /etc/rc.local, because ipvsadm and keepalived depend on it.
cd <ofp-dir>/examples/ofp_vs
./ofp_vs -i 0,1 -c 0x00f0 -p 1 -f ofp.conf # -i <port1>,<port2>  
                                 # -c <worker core mask> 
                                 # -o <required for snat-gw, outer port to wan, snat-gw fdir rule will be add to this port>
                                 # -p <required for fullnat, inner port to lan, fullnat fdir rule  will be add to this port>
                                 # -f <config file include default command which you can change in ofp cli>
#If worker core count > 0, -o is required for snat-gw, -p is required for fullnat.

7. Connect to ofp cli or edit ofp.conf to configure network

telnet localhost 2345
type in "?" or "help"
>>> ?
# fp0 equal to port number 0 in dpdk
>>> ifconfig fp0 <ip_addr>/<net_mask> 
>>> ifconfig fp1 <ip_addr>/<net_mask> 
#default gw don't work if enable mtries routing, may be ofp's bug.
>>> route add 0.0.0.0/0 gw <next hop> dev fp0
>>> route add <ip_addr>/<net_mask> gw <next hop> dev fp1
#Add vs ip to lo if you want to ping it
>>> ifconfig lo0 <vip1/32>
>>> ifconfig lo1 <vip2/32>

8. Configure network on your switch/router

#The ip on the port is used as nexthop of vs/snat ip or local address.
#H3C switch example.
#add route for virutal server address or SNAT source address
>>> ip route-static <vs.ip.x.0> 255.255.255.0 <nexthop ip on the interface fp0> 
#add route for local address of FULLNAT
>>> ip route-static <local.addr.x.0> 255.255.255.0 <nexthop ip on the interface fp1> 

9. Start and configure SNAT-GATEWAY

./ofp_vs -i 0,1 -c 0x00f0 -o 0 -f ofp.conf  #-o specify the port to wan
telnet localhost 2345
>>> snat enable
>>> snat add from 10.1.0.0/16 to 0.0.0.0/0 out_dev fp0 source 192.168.50.253 - 192.168.50.253 algo sd
>>> snat add from 10.1.0.10/32 to 0.0.0.0/0 out_dev fp0 source 192.168.50.100 - 192.168.50.103 algo sdfn
>>> snat del from 10.1.0.10/32 to 0.0.0.0/0 out_dev fp0
>>> snat show

10. Start and configure FULLNAT virtual server

./ofp_vs -i 0,1 -c 0x00f0 -p 1 -f ofp.conf  #-p specify the port to lan

#ipvsadm and keepalived will comunicate with ofp_vs process but not the kernel module.
#Create FULLNAT virtual server, local address count must be greater than worker count
ipvsadm  -A  -t <vip:vport> -s rr
ipvsadm  -a  -t <vip:vport> -r <rsip1:rsport> -b
ipvsadm  -a  -t <vip:vport> -r <rsip2:rsport> -b
ipvsadm  -P  -t <vip:vport> -z <local_addr1>
ipvsadm  -P  -t <vip:vport> -z <local_addr2>
ipvsadm  -P  -t <vip:vport> -z <local_addr3>
ipvsadm  -P  -t <vip:vport> -z <local_addr4>
...
...
ipvsadm  -P  -t <vip:vport> -z <local_addr254>
ipvsadm -ln
ipvadm -G

11. Try to visit vs now

curl <vip:vport>

12. More details about ofp and odp-dpdk

http://www.openfastpath.org/
http://opendataplane.org/
https://github.com/OpenFastPath/ofp
https://github.com/lvsgate/ofp
https://github.com/lvsgate/odp-dpdk
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].