GithubHelp home page GithubHelp logo

gamemann / tc-ipip-mapper Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 5.0 41 KB

TC programs aimed to add support for multiple remote hosts in IPIP tunnels.

Home Page: https://deaconn.net/

License: MIT License

Makefile 14.07% C 85.93%
tc ipip traffic control bpf ebpf traffic-control

tc-ipip-mapper's Introduction

TC IPIP Mapper (WIP)

Description

A project aimed to add support for multiple remotes on an IPIP tunnel. This project consist of two TC programs (one for ingress and the other for egress).

The main goal of the TC ingress program is to map the client IP (inner IP header's source IP address) to the remote IP (the outer IP header's source address).

When outgoing IPIP packets are sent back out, it will replace the outer IP header's destination IP address with the mapped remote IP if it exist. If it doesn't, the packet will go out unchanged.

An example where this is useful is if you're utilizing IPIP tunnels with an Anycast network and want the traffic to go back the same POP server it came in with.

Command Line Usage

The only command line option is -i --dev which determines which interface to attach to. An example of using the ipipmapper loader may be found below.

./ipipmapper --dev ens18

Requirements

The make, clang, llvm, libelf-dev, and gcc-multilib packages are required.

On Debian/Ubuntu-based systems, these may be installed using the following command.

sudo apt install -y make clang llvm libelf-dev gcc-multilib

Installing

You may use git and make to install this project onto your server. I'd suggest the following commands for downloading and installing.

git clone --recursive https://github.com/gamemann/TC-IPIP-Mapper.git # Recursive will download LibBPF.
cd TC-IPIP-Mapper/
make && make install

If you want to enable this via systemd, I'd suggest modifying the /etc/systemd/system/IPIPMapper.service file after install and ensure it is set to use the correct interface via the -i flag. Afterwards, you may execute the following commands.

systemctl enable IPIPMapper # Enables the program on startup.
systemctl start IPIPMapper  # Starts the program via systemd.

Credits

tc-ipip-mapper's People

Contributors

gamemann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tc-ipip-mapper's Issues

Compile error

lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

apt install build-essential clang llvm libconfig-dev libhiredis-dev libelf-dev libevent-dev git make gcc

git clone --recursive https://github.com/lbgcomm/TC-IPIP-Mapper.git
cd TC-IPIP-Mapper/
make && make install

swe-tets:~/TC-IPIP-Mapper# make && make install
clang -Ilibbpf/src src/cmdline.o -lelf -lz src/ipipmapper.c libbpf/src/staticobjs/bpf.o libbpf/src/staticobjs/btf.o libbpf/src/staticobjs/libbpf.o libbpf/src/staticobjs/libbpf_errno.o libbpf/src/staticobjs/netlink.o libbpf/src/staticobjs/nlattr.o libbpf/src/staticobjs/str_error.o libbpf/src/staticobjs/libbpf_probes.o libbpf/src/staticobjs/xsk.o libbpf/src/staticobjs/btf_dump.o libbpf/src/staticobjs/hashmap.o libbpf/src/staticobjs/ringbuf.o libbpf/src/staticobjs/strset.o libbpf/src/staticobjs/gen_loader.o libbpf/src/staticobjs/relo_core.o -o ipipmapper
clang: error: no such file or directory: 'libbpf/src/staticobjs/bpf.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/btf.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/libbpf.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/libbpf_errno.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/netlink.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/nlattr.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/str_error.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/libbpf_probes.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/xsk.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/btf_dump.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/hashmap.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/ringbuf.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/strset.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/gen_loader.o'
clang: error: no such file or directory: 'libbpf/src/staticobjs/relo_core.o'
make: *** [Makefile:25: ipipmapper] Error 1

Can you help please?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.