Skip to content

MrWelsch/dpg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Docker Playground

License Open Source Yes PRs Welcome LOC Releases

header

Table of contents

๐Ÿ”— Whatโ€™s included? ๐Ÿ”—

DPG provides an expandable networking sanbox in which the user can practice basic routing.

Basic Routing

Packages can be routed from one client to another over a bridge.

BGP

FTP

SSH

The user is given the ability to connect to any container from inside a container via SSH.

๐Ÿ–ฅ๏ธ Monitoring

Various monitoring tools are installed on each container.

  • tshark
  • iftop
  • mtr

Project Goals

The goal of this project is to create a network environment via docker which enables students to practice basic networking.
To achieve this the network should have the following traits:

  • Scalability
  • Static Ip Adresses
  • User friendlyness

โšก Install In One Command! โšก

git clone https://github.com/MrWelsch/dpg

๐Ÿ“ฆ๏ธ Get The Latest Version Of Docker

MacOS

Use Homebrew Cask to download the app by running these commands:

brew update
brew install --cask docker

Linux

Debian Based

The Main Repository of debian provides the Docker package.

apt-get update
apt-get install docker

Arch Based

Docker is available via the community repository and can be iinstalled as instructed below:

sudo pacman -Syu
sudo pacman -S docker

Windows

Chocolatey

The app can be installed via Chocolatey by using the Docker Package.

choco upgrade
choco install docker-desktop

๐Ÿš€ Getting Started ๐Ÿš€

To use the docker Playground you need to be in the source directory.
Inside that directory execute the following command:

docker compose up --build --remove-orphans -d

This will build the configured networks and services as well as run them.
To shut down the previously built playground execute:

docker compose down

Basic Commands

Description Command
Show Containers docker compose ps
Show Networks docker network ls
Show Logs docker compose logs
Enter a Container docker exec -it container_name /bin/sh

Establish A SSH Connection

To establish a ssh connection to another container use:

ssh user_name@ip_adress

e.g.

ssh client@10.2.0.2

Check Your IP Adress

The IP Adress of each Network Interface can be inspected by executing:

ip a

โš™๏ธ Configuration โš™๏ธ

All configuration is done in the docker-compose.yml file.
Various environment variables can be set which are needed to configure the network.

IP Adress

The IP Adress of each container can be set as follows:

environment:
  IP_ADRESS: 10.1.0.2/16

โš ๏ธ This is a mandatory configuration!

Routing

To configure a route one has to define the destinated network as well as an IP Adress to be routed over. The corresponding environment variable has to be named after the convention ROUTING_routename.

environment:
  ROUTING_A: 10.1.0.3/16,10.2.0.0/16

The left side (10.1.0.3/16) indicates the Bridge via which the packages are routed to the destinated network, which is set on the right side (10.2.0.0/16) of the ,.

User Name

One can create a password protected user.
If no user name(USER_NAME) is set the default user client or bridge depending on the container type will be created with the default password (USER_PASSWORD) if not otherwise defined.

environment:
  USER_NAME: example
  USER_PASSWORD: dummy

๐Ÿ“„ Example Configuration

version: '3'
services:
    s10:
        container_name: container_a
        build:
            context: ./client
            dockerfile: Dockerfile
        environment:
            IP_CONTAINER: 10.1.0.2/16
            ROUTING_A: 10.1.0.3/16,10.2.0.0/16
            USER_NAME: client
            USER_PASSWORD: playground
        stdin_open: true
        cap_add:
            - NET_ADMIN
        networks:
            - network_a
        ports:
            - 1010:22
        restart: on-failure
    s20:
        container_name: bridge
        build:
            context: ./bridge
            dockerfile: Dockerfile
        environment:
            BRIDGE_IP_NETWORK_A: 10.1.0.3/16
            BRIDGE_IP_NETWORK_B: 10.2.0.3/16
        stdin_open: true
        cap_add:
            - NET_ADMIN
        networks:
            - network_a
            - network_b
        restart: on-failure
    s30:
        container_name: container_b
        build:
            context: ./client
            dockerfile: Dockerfile
        environment:
            IP_CONTAINER: 10.2.0.2/16
            ROUTING_A: 10.2.0.3/16,10.1.0.0/16
            USER_NAME: client
            USER_PASSWORD: playground
        stdin_open: true
        cap_add:
            - NET_ADMIN
        networks:
            - network_b
        ports:
            - 2020:22
        restart: on-failure

networks:
    network_a:
        driver: bridge

    network_b:
        driver: bridge

๐Ÿšง TODO ๐Ÿšง

  • BGP
  • FTP
  • Documentation
  • Instructions

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published