Git Product home page Git Product logo

znail's Introduction

Znail

Znail Logo

Znail is a network emulator inteded to run on a computer with two network interfaces. Equipped with two network interfaces, Znail acts as a network bridge. Znail can then control network traffic passing through the bridge.

With a system under test connected to the network through this bridge, Znail can help you answer question about how that system behaves under various network conditions.

Features

  • Emulate packet delay
  • Emulate packet loss
  • Emulate packet duplication
  • Emulate packet reordering
  • Emulate packet corruption
  • Control packet rate
  • Capture network packets
  • Emulate a disconnect (by powering down one of its network interfaces)
  • Override answers to DNS queries (by redirecting DNS traffic to its internal DNS server)
  • Redirect IP traffic from one host to another
  • Not apply any of the above for certain hosts using a whitelist

Znail can be managed in one of two ways, using its web interface or its REST API.

Getting Started

The easiest way to get started with Znail is to download an image with Znail pre-installed.

The image can then be installed on a suitable target system, for example a Raspberry Pi or a NanoPi R2S.

Raspberry Pi

The default SSH username for the pre-built image is pi and the password is raspberry.

NanoPi R2S

The default SSH username for the pre-built image is root and the password is 1234.

Generating Custom Images

To set up the environment on an Ubuntu 20.04 system, run the following commands:

sudo apt update
sudo apt install -y coreutils quilt parted qemu-user-static debootstrap zerofree zip dosfstools bsdtar libcap2-bin grep rsync xz-utils file git curl

To generate an image:

make image

The resulting images can be found in the dist/image directory.

Generating the different images can take quite some time. If you are looking to only build one specific kind of image more narrow make targets are available. See make help for more information.

Development

The Python environment requires that the pip tool is installed.

To set up the development environment on an Ubuntu 20.04 system, run the following commands:

sudo apt update
sudo apt install -y python3-pip python3-venv

To build and activate the virtual Python environment:

source ./activate

To automatically format the code:

make format

To run tests and static code analysis:

make check

More information about what targets the build system provides:

make help

Special Thanks

Special thanks to Alice Persson for contributing the Znail logotype.

License

Distributed under the terms of the Apache License 2.0.

znail's People

Contributors

andni233 avatar risca avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

znail's Issues

Demonstration of Znail

I would like to see a demonstration video of how to setup Znail and interact with it.

Disable wifi and bluetooth by default

For Raspberry Pi builds, wifi and bluetooth should be disabled at build time to minimize possible external data interference.

They can be disabled by adding the following to config.txt:

dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt

Question about Impairment direction

Hi. I've been tested a nanoPi R2S. eth0 was connected WAN, eth1 was connected LAN port of R2S. All impairments were adopted on downlink(eth0 > eth1). Can I adopt the impairment on an uplink(eth1 > eth0) direction?

Port to NanoPi R2S

I think the NanoPi R2S could potentially be a good hardware platform for the znail:

https://www.friendlyarm.com/index.php?route=product/product&product_id=282

It has 2 GBit interfaces, TF-card slot for OS and a USB port that potentially could be used for a USB-storage device.
The USB-storage could be used for saving TCP-dump, user settings that should be "portable" between devices and a text file with current IP-addresses of the interfaces written on boot to make it simpler to find on the network.
It also supports a USB2LCD that can be used to display the IP-address.

Ubuntu core and FriendlyWRT are among the many OSes available.

DevConSoft is willing to sponsor this feature by paying for 1 set of the hardware (NanoPi R2S, case, MicroSD card, USB2LCD, shipping, VAT) up to 1000 SEK. Sponsorship require prior agreement between DevConSoft and the implementor and valid receipt of the purchase.

Original maintainers has first dibs on the sponsoring.

Network Disconnect cannot be reversed on Raspbian

Clicking on "Network Disconnect" button indeed shuts down the device-facing network adapter (eth1). However, clicking on the "Network Reconnect" button does not bring it back up despite the message that the changes were applied successfully. ifconfig does not show eth1 anymore, packets are not going through, and it cannot be fixed by anything other than reboot.

Have not checked that feature on Armbian, maybe it works there.

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.