Skip to content

bt-sync/pynetsandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About linux namespaces

http://man7.org/linux/man-pages/man7/namespaces.7.html

Unittests

sudo python3 test.py

Install

pip3 install git+https://github.com/bt-sync/pynetsandbox

How to use

For first enable ip_forwarding in the kernel. echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

Then:

main.py

from netsandbox import NetworkSandbox

with NetworkSandbox('10.1.0.0/16') as ns:
    p = ns.spawn('ping 10.1.0.1 -c 3')
    p.wait(timeout=10)

try:
    ns = NetworkSandbox('10.2.0.0/16')
    p = ns.spawn('ping 10.2.0.1 -c 3')
    p.wait(timeout=10)
finally:
    ns.release()

sudo python3 main.py

Before contributing

pylint --rcfile .pylintrc *.py netsandbox

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages