GithubHelp home page GithubHelp logo

m4ttr / skmark Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 8 KB

netfilter skmark

Makefile 14.44% C 85.56%
iptables-extension netfilter networking iptables socket-programming socket linux qos qos-aware tos

skmark's Introduction

Description

skmark is a netfilter target module and iptables extension. The module sets the corresponding sock->sk_mark from the matching skb.

The intention of this module is to allow QoS / ToS / DSCP bit reflection or interface tracking without conntrack overhead.

Installation

skmark module uses dkms to build the ipt_SKMARK module.

Prerequisites:

Debian:

apt-get install linux-headers-$(uname -r)
apt-get install dkms 
apt-get install iptables-dev

Redhat:

yum install kernel-devel
yum install iptables-devel
yum install dkms

Build

dkms build .
dkms install skmark/1.0

Iptable extension

cd ./extension
sudo make
sudo make install

Usage

DSCP or ToS bit reflection

# Create a new change to manage setting egress TOS
iptables -N MARK-EGRESS-TOS -t mangle

# Match (0x08)  8 Maximize-Throughput and set sk_mark 8 on the connections socket
iptables -I INPUT -m tos --tos 8 -j SKMARK --set-mark 8

# Restore the socket mark and reset ToS bit.
iptables -t filter −A OUTPUT −m socket −−restore-skmark −j MARK-EGRESS-TOS
iptables -t mangle -I MARK-EGRESS-TOS -m mark --mark 8 -j TOS --set-tos 8

Multi-nic Routing

iptables -I INPUT -i eth1 -j SKMARK --set-mark 100
iptables −A PREROUTING −m socket −−restore-skmark −j ACCEPT

ip rule add fwmark 100 table TO_ETH1
ip route add default <DEFAULT_GATEWAY> dev eth1 table TO_ETH1

# You may need to turn off rp_filter

skmark's People

Contributors

m4ttr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

skyformat99

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.