• Stars
    star
    229
  • Rank 174,228 (Top 4 %)
  • Language
    Python
  • Created over 10 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Libvirt hook for setting up iptables port-forwarding rules when using NAT-ed networking.
https://travis-ci.org/saschpe/libvirt-hook-qemu.svg?branch=master

Libvirt port-forwarding hook

Libvirt hook for setting up iptables port-forwarding rules when using NAT-ed networking.

Installation

To install the hook script and it's configuration files, simply use the Makefile:

$ sudo make install

Afterwards customize /etc/libvirt/hooks/qemu.json to your needs. This Makefile target can be invoked multiple times, already installed configuration files won't be touched. The files can be removed again with:

$ sudo make uninstall

Testing

To run unit tests use the test target of the Makefile:

$ make test

Or use the Python unittest module to discover tests directly:

python -m unittest discover

Networking

This section describes the theory behind the generated iptables statements.

Packets arriving on the public interface are DNATed to the virtual machine. This implements the actual port-forwarding. Due to the way iptables is implemented, the DNAT must occur in two chains: nat:PREROUTING for packets arriving on the public interface, and nat:OUTPUT for packets originating on the host.

We also add rules to the FORWARD chain to ensure the responses return.

Finally, packets originating on the guest and sent to the host's public IP address need special handling. They are DNATed back to the guest like all other packets but, because the destination is now the same as the source, the reply never leaves the guest. Therefore, the host SNATs these packets to ensure the reply returns over the bridge.

To see a real-world example, the test_setup function in test_qemu.py demonstrates a simple JSON configuration and the iptables rules that it produces.

Authors

  • Sascha Peilicke
  • Scott Bronson

More Repositories

1

android-customtabs

Chrome CustomTabs for Android demystified. Simplifies development and provides higher level classes including fallback in case Chrome isn't available on device.
Kotlin
378
star
2

godaddy-dyndns

DynDNS-like public IP auto-updater script for GoDaddy
Python
80
star
3

BirthdayCalendar

Get a birthday calendar for all your social networks right inside your calendar app (such as Google Calendar). Supports all apps which sync contacts with your Android device, that includes many social network and messaging apps. Enable reminder alarms and decide which contacts you want to see. You'll get notifications for all of them.
HTML
72
star
4

PlanningPoker

Fast and simple Planning Poker Android app. Designed for phones, tablets and Android Wear devices.
Kotlin
68
star
5

docker-android-ndk

Android NDK Docker container including CMake based on Alpine Linux
Shell
33
star
6

Kase64

Base64 encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.
Kotlin
27
star
7

android-exoplayer2-ext-icy

ExoPlayer2 Shoutcast Metadata Protocol (ICY) extension
Java
27
star
8

android-textoverlay

Provides a simple service that allows to display arbitrary text as a system-window overlay.
Java
21
star
9

android-versioninfo

A version info widget for Android. Material style.
Java
21
star
10

android-pls-parser

A playlist file (*.pls) parser library for Android
Java
18
star
11

Log4K

Lightweight logging library for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.
Kotlin
15
star
12

docker-android-sdk

Android SDK OCI container image with pre-installed build-tools based on latest command-line tools and JDK 11 (or later).
Shell
13
star
13

android-social-fragment

A reusable fragment to display links to social networks, the Play Store as well as recommendation and support email links
Java
13
star
14

rapport

Work report generator for the lazyâ„¢
Python
8
star
15

Kex

Hex string encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.
Kotlin
7
star
16

dotfiles

Sascha's shell environment
Shell
6
star
17

docker-android-emulator

Android SDK with Emulator OCI / Docker image
Shell
4
star
18

amarok2clementine

Shell script to import Amarok's rating, score and playcount into Clementine
Shell
3
star
19

go-json

Go
3
star
20

masonry

Mason-graph visualisation and computation utility
C++
3
star
21

docker-clang-format

Clang-Format Docker container based on Alpine Linux
Shell
3
star
22

android-utils

My often used Android classes
Java
3
star
23

docker-clang

Clang Docker container based on Alpine Linux
Shell
2
star
24

android-somascrobblerapi

SomaScrobblerApi for Android
Java
2
star
25

android-discogs

Discogs API client for Android
Kotlin
2
star
26

qtopia-filemanager

A file manager for the Qtopia mobile platform
C++
2
star
27

mozilla-plugins

Mozilla Firefox / Thunderbird plugins
2
star
28

kidcat

KidCat - the simple chat. Command-line threaded chat server and client written in ANSI C.
C
2
star
29

docker-kotlin

Kotlin Docker container based on Alpine Linux.
Shell
1
star
30

vscode-nc-hops

NC-HOPS® support for Visual Studio Code
TypeScript
1
star
31

tribool

Ternary (tree-valued) logic package for the Go programming language.
Go
1
star
32

gnome_picross

This is a simple paint by numbers game for Gnome written in Python.
Python
1
star
33

particle_fountain

Simple particle fountain effect written in x86-Assembler (NASM style).
Assembly
1
star
34

pascal-fire-demo

Fire effect demo written in Pascal
Pascal
1
star
35

GoHeader

Tool for translating C type declarations into its Go equivalent
Go
1
star
36

creatrepo

createrepo/rpm metadata This project defines the rpm-metadata (repodata) format and maintains one of the programs (createrepo) which create this format from existing rpms and other sources.
Python
1
star
37

satf

Runtime performance measurement tool for generic algorithms that uses gnuplot to generate nice plots
C++
1
star
38

self_healing

This is a cross-platform C++ library for self-healing and thus fault-rolerant data structures with a STL-compatible interface and released under the Boost Software License.
C++
1
star