Skip to main content

Tool to convert ethernet interface to bridge for emulation

Project description

brnet

These is a networking tool to make running emulated systems under Linux a little easier and more secure.

I have been using simh and klh10 a lot recently to emulate old computers and operating systems. Networking has been a particular pain because most of these systems require raw access to the network devices, and that typically means running the as root.

I didn't want to do that. So I wrote brnet.

What this script does is to take the interface you specify (defaulting to eth0) and turn it into a bridge device. The using a user and group you specify (it defaults to pi/adm, which is correct for a PiDP-11), it creates a number of tap interfaces (defaulting to 4), and connects them to the bridge too.

The point of doing that is so that you can run brnet with root privileges to create network devices that another user can own and have full control of without requiring escalated privileges.

After running brnet, you can therefore use, say, the tap0 interface in a guest system as your emulated ethernet device, and run as your normal emulator user without sudo, and still have the network interface work.

Installing

pip install brnet, or check out the repository and do a pip install -e . You probably want to do this in a virtualenv, and if you do that, you probably want to install a wrapper script as /usr/local/bin/brnet to activate the appropriate virtualenv and then run the brnet command (virtualenv activation will put the new stuff at the head of your $PATH).

Then you want to drop the following into /etc/network/interfaces.d to start the network after the physical interface comes up. I called my file 01-eth0-and-bridge and it contains:

auto eth0
iface eth0 inet dhcp

post-up  /usr/local/bin/brnet start
pre-down /usr/local/bin/brnet stop

Examples

To run using the defaults, which should work for a Raspberry Pi running the PiDP-11 software: brnet start.

To run with a different user and group and more tap devices:

brnet -u adam -g wheel -n 8 start

To shut down the bridge and put things back the way they were:

brnet stop

brnet -h will give you a help message explaining all the parameters.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brnet-0.0.2.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

brnet-0.0.2-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file brnet-0.0.2.tar.gz.

File metadata

  • Download URL: brnet-0.0.2.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for brnet-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0ef27e0ba9bc02bb3397c9bf8d3961727384912fa737f5c4c5c9d6e07c460924
MD5 d8569ac9305311fffa22812fafad5551
BLAKE2b-256 e6316539cfe331b612cac4b40f6e277ffd6c0da20289d0ce0d2e417a9e61e024

See more details on using hashes here.

File details

Details for the file brnet-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: brnet-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for brnet-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 855cb3635b78fa07f5f9851f6ae514db750b4c81761367efc5205c143eba2af8
MD5 c109c0470c0ddf9529af0f839d902400
BLAKE2b-256 6d4f0a0e6eef3e45e2939c5889c48963f3c81403e2d4264aa8f77e2b57e1766f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page