MPNC: Multipath single-Player NetCat

Overview

MPNC: Multipath single-Player NetCat

TL;DR: A PoC to make your link aggregation works.

Background

We all know NC is useful in real world:

# on server A
cat /dev/disk1s1 | nc newServer 31337
# on server B
nc -l 31337 | pv >/dev/disk1s1

However, for poor guys like me, we only have some gigabit network cards. Due to nc is only using one TCP connection, the maximum speed is 1Gbps.

Luckily, in 2000, Linux Ethernet Bonding is introduced. This allows us using multiple low speed NIC cards to get a high speed connection bond0. This feature is pretty useful if what you want is a router, firewall, or some other devices that mainly perform network jobs.

But ethernet bonding has its own limitations: it's still a bonding, not some "smart" load balancing. Bonding works for router because it allows you to use different interface to communicate with different peers (another server, or router), or have an active-backup mechanism. But when only one TCP connections wants to get speed more than one physical interface, bonding is not helpful.

Problem

So the problem is simple: how to make the speed of single TCP connection can go beyond the speed of the physical devices?

Possible solutions

There do have some possible solutions. One of the most useful option is Multipath TCP, which I had some experience in production environment. But this time MPTCP is not useful for me, because according to its introduction:

... enabling the simultaneous use of several IP-addresses/interfaces ...

And we only have one bonding interface, and one IP address for the both peer. It's, surely, possible to setup additional address, or just deactivate the bonding, but I do not want to touch living network devices during Spring Festival to increase risks of being accused by users. Also, besides the kernel support for MPTCP might not be available for my server, I still need to use some "hack" methods like systemtap or LD_PRELOAD. Neither of them should be used unless no other options is available.

This solution

This is a brute solution. If one TCP connection speed is limited, add more.

The bonding hash policy, or xmit_hash_policy, decides which interfaces should be used to send a packet in 802.3ad mode (which is used in our system). If we use layer3+4, then we can let the traffic goes to different physical interface, by setting the traffic's source and destination port, leaving IP/MAC addresses untouched.

So bad news is: this solution is bruteforce but quick, and it works like netcat - but only in one way (client -> server).

Good news is: it works! In our datacenter where two servers are connected via 4 Gigabit ethernet card through a switch, the transmit speed is around 400MiB/s! This is enough to run migration scripts!

Should I use it in production?

Not now. This is just a PoC.

Tell me if you really need more features, like setting ports/threads automatically based on bonding configuration, or using only one port at server side to minimize firewall settings, or make it looks like a real NetCat by adding additional properties and add duplex abilities.

But I would recommend you just go out and by a 10Gbps NIC. It's not that cheap and more stable.

License

GPLv2

Sponsor?

Thanks! But do you really want to pay something for this?

Ethereum address: 0xa55cF178190d1Ba7C18Fa942e18F2230076Fe1E8

You might also like...
2-player game made with Rust and
2-player game made with Rust and "ggez" engine, based on "Conway's Game of Life"

fight-for-your-life A 2-player game based on the "Conway's Game of Life", made with Rust and the game engine "ggez". Create shapes on the grid that wi

A next-generation music player and manager

ouverture A next-generation music player and manager Very much at Work-In-Planning stage now Planned features GUI (localizable) Backend (something lik

Rust-based video player for astrophotography
Rust-based video player for astrophotography

Astro Video Player Rust-based video player for astrophotography videos in SER and AVI format. Supports debayering of RAW color images. Status: Works w

MRVN is a Discord music player bot.

MRVN is a Discord music player bot. It has a few neat features: Supports a wide array of sites, including Youtube, Soundcloud, Twitch and many mo

A command driven spotify player
A command driven spotify player

spotify-player Table of Contents Introduction Examples Demo Installation Requirements Spotify Connect Streaming Commands Actions Search Page Mouse sup

A simple CLI audio player with strange features.

legacylisten legacylisten is a simple CLI audio player I wrote because no existing one fulfilled my needs. The main feature is that you can change how

 Terminal Music Player written in Rust
Terminal Music Player written in Rust

Terminal Music Player written in Rust Listen to music freely as both in freedom and free of charge! Freedom: As time goes by, online service providers

A simple GUI audio player written in Rust with egui. Inspired by foobar2000.

Music Player A simple GUI music player inspired by foobar2000 written in Rust using egui. The goal of this project is to learn about making gui/ nativ

A video player for your terminal that generates a standalone executable that plays your video.

Szmelc Player Szmelc Player is a program that converts any video you give it to a standalone executable that plays the video in the terminal. It uses

A terminal music player written in the Rust language.
A terminal music player written in the Rust language.

A terminal music player written in the Rust language. (Windows) Requirements Configuration file path: C:\Users\xxx\.config\music_player\config.yml # P

Rust Audio Player Daemon

Rust Audio Player Daemon Cause mpd was annoying What rapd trys to do Rapd is not a spotify client, or an advanced music player. Its an audio/music dae

VR media player for linux
VR media player for linux

VR media player for linux Very early development access version. I'll drop more notes here once it's ready for more publicity. Some details: Uses wgpu

Arexibo is an Rust Linux Xibo player
Arexibo is an Rust Linux Xibo player

Arexibo is an alternate Digital Signage Player for Xibo, implemented in Rust with the GTK GUI components, for Linux platforms.

Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv
Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv

Lumiere is a proof-of-concept/example video player built with the Slint UI framework and libmpv. This was built quickly to try out Slint and it's new OpenGL underlay feature.

The definitive e-book reader music player (Kobo, Kindle)
The definitive e-book reader music player (Kobo, Kindle)

Introduction E-ink devices have traditionally been only for reading... well no more! Buck is a fully-fledged music player for e-ink devices (tested fu

Using information theory, this is the optimal wordle player

enwordle Using information theory, this is the optimal wordle player. It is written in Rust and runs on the command-line. Theory When you pick a word

A Discord Rich Presence for cmus player using rust 🦀💙
A Discord Rich Presence for cmus player using rust 🦀💙

A Discord Rich Presence for cmus player with 🦀 Require cmus Install from crates.io crago install cmus-rpc-rs Options: Option Description Values -h or

Calculate a player's skill level using Elo, DWZ, Ingo, TrueSkill, Glicko and Glicko-2 algorithms known from their usage in chess and online games.

skillratings Skillratings allows you to calculate the player's skill instantly in 1v1 matches or after tournaments/rating periods with a list of resul

Template project for the The Bombercrab Challenge game, a stub Rust WASM player

The Bombercrab Challenge (Player Template) Welcome to the 2022 Tokyo Game Hack bombercrab challenge! If you're based in Tokyo and planning to attend i

Owner
Silver Bullet
A member of @XDSEC and previous member of MSCinXDU. Reverse engineer.
Silver Bullet
Multiplex server for rust-analyzer, allows multiple LSP clients (editor windows) to share a single rust-analyzer instance per cargo workspace

ra-multiplex   Multiplex server for rust-analyzer, allows multiple LSP clients (editor windows) to share a single rust-analyzer instance per cargo wor

max 95 Dec 29, 2022
An asynchronous dumb exporter proxy for prometheus. This aggregates all the metrics and exposes as a single scrape endpoint.

A dumb light weight asynchronous exporter proxy This is a dumb lightweight asynchronous exporter proxy that will help to expose multiple application m

Dark streams 3 Dec 4, 2022
Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions

websocat Netcat, curl and socat for WebSockets. Examples Connect to public echo server $ websocat ws://echo.websocket.org 123 123 ABC ABC Serve and c

Vitaly Shukela 5k Jan 4, 2023
A simple 2-player game player over a standard 8x8 board.

Boombots A simple 2-player game player over a standard 8x8 board. Projects Game Server (v0.0.1) A parallel and asynchronous game server written in Rus

Ben Mitchell 4 Aug 1, 2022
Single-reader, multi-writer & single-reader, multi-verifier; broadcasts reads to multiple writeable destinations in parallel

Bus Writer This Rust crate provides a generic single-reader, multi-writer, with support for callbacks for monitoring progress. It also provides a gene

Pop!_OS 26 Feb 7, 2022
A single-producer single-consumer Rust queue with smart batching

Batching Queue A library that implements smart batching between a producer and a consumer. In other words, a single-producer single-consumer queue tha

Roland Kuhn 2 Dec 21, 2021
Handoff is an unbuffered, single-producer / single-consumer, async channel

handoff handoff is a single-producer / single-consumer, unbuffered, asynchronous channel. It's intended for cases where you want blocking communicatio

Nathan West 7 Feb 7, 2023
A Flash Player emulator written in Rust

website | demo | nightly builds | wiki Ruffle Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both t

Ruffle 11.2k Jan 8, 2023
Angolmois BMS player, Rust edition

Angolmois Rust Edition This is a direct, one-to-one translation of Angolmois to Rust programming language. Angolmois is a BM98-like minimalistic music

Kang Seonghoon 95 Oct 20, 2022
A work-in-progress, open-source, multi-player city simulation game.

Citybound is a city building game with a focus on realism, collaborative planning and simulation of microscopic details. It is independently developed

Citybound 7.2k Jan 3, 2023