Handling looping topology in POX Controller

If you have fat or looping topology in mininet or SDN based network, you can follow this step for handling stp with Pox Controller.

(more…)

AIO Tungsten Fabric & OpenStack Queens

Tungsten Fabric adalah controller Software Defined Networking

(more…)

Install ONOS 2.0.0 in Centos 7

ONOS (Open Networking Operating System) are software defined networking controller. This tutorial is try to install ONOS in Centos based

Disable Firewall & Selinux

sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo setenforce 0
nano /etc/selinux/config  # replace "SELINUX=enforcing" to "SELINUX=disabled"

Install Java 8

sudo yum install java-1.8.0-openjdk wget nano

Add user of ONOS

sudo adduser sdn --system --user-group

Download & Extract ONOS

cd /opt/
sudo wget http://repo1.maven.org/maven2/org/onosproject/onos-releases/2.0.0/onos-2.0.0.tar.gz
sudo tar xzf onos-2.0.0.tar.gz
sudo mv onos-2.0.0 onos
sudo chown -R sdn:sdn onos

Setting Startup Options

sudo -u sdn nano /opt/onos/options

# running onos with user sdn
export ONOS_USER=sdn

# default active drivers and openflow
export ONOS_APPS=drivers,openflow

Install ONOS service

sudo cp /opt/onos/init/onos.initd /etc/init.d/onos
sudo cp /opt/onos/init/onos.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable onos

Start ONOS

sudo systemctl start onos
sudo systemctl status onos

delete default user dari onos

/opt/onos/bin/onos-user-password onos --remove

tambahkan sendiri username dan password yang diinginkan

/opt/onos/bin/onos-user-password zufar zufar

lalu bagaimana access CLInya? untuk setiap user yang ingin akses ke CLI, generate ssh-keygen dan tambahkan public keynya

ssh-keygen -t rsa
/opt/onos/bin/onos-user-key $USER ~/.ssh/id_rsa.pub

login ke CLI

/opt/onos/bin/onos

Change ONOS GUI Port

ONOS GUI by default use port 8181. This configuration can be change if you need to secure or use port 8181 for another function.

(more…)

Building P4 lab environment on Ubuntu 16.04

P4 adalah bahasa pemrograman yang memprogram langsung kedalam chip untuk melakukan forwarding pada device. Unduh dua file ini di folder ~ dengan nama p4-environment-bootstrap.sh dan install-p4-tools.sh.

(more…)

Building ONOS 1.15

Untuk melakukan build ONOS secara manual, membutuhkan beberapa software, install semua software tersebut :

(more…)

Creating ONOS 1.14 Cluster

mulai versi owl, ONOS merubah desain cluster dimana memisahkan  cluster management, service discovery, dan persistent data storage dari node onos itu sendiri. Fungsi-fungsi itu dipisah kedalam sebuah atomix cluster.

Berikut adalah spesifikasi untuk Atomix Cluster yang akan dibangun :

  • Atomix 1 ( 192.168.123.66)
  • Atomix 2 (192.168.123.127)
  • Atomix 3 (192.168.123.72)

Dan berikut adalah spesifikasi untuk ONOS Cluster :

  • ONOS 1 (192.168.123.105)
  • ONOS 2 (192.168.123.69)
  • ONOS 3 (192.168.123.112)

Pembentukan Atomix Cluster

Install Java

sudo apt-get update
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer oracle-java8-set-default curl -y

pada semua node, unduh terlebih dahulu atomix packagenya

curl -o atomix-dist-3.0.7.tar.gz -XGET https://oss.sonatype.org/content/repositories/releases/io/atomix/atomix-dist/3.0.7/atomix-dist-3.0.7.tar.gz
tar -xvf atomix-dist-3.0.7.tar.gz

edit atomix cluster configuration (conf/atomix.conf) :

  • Atomix 1
cluster {
  cluster-id: onos
  node {
    id: atomix-1
    address: "192.168.123.66:5679"
  }
  discovery {
    type: bootstrap
    nodes.1 {
      id: atomix-1
      address: "192.168.123.66:5679"
    }
    nodes.2 {
      id: atomix-2
      address: "192.168.123.127:5679"
    }
    nodes.3 {
      id: atomix-3
      address: "192.168.123.72:5679"
    }
  }
}
 
management-group {
  type: raft
  partitions: 1
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}
 
partition-groups.raft {
  type: raft
  partitions: 3
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}
  • Atomix 2
cluster {
  cluster-id: onos
  node {
    id: atomix-2
    address: "192.168.123.127:5679"
  }
  discovery {
    type: bootstrap
    nodes.1 {
      id: atomix-1
      address: "192.168.123.66:5679"
    }
    nodes.2 {
      id: atomix-2
      address: "192.168.123.127:5679"
    }
    nodes.3 {
      id: atomix-3
      address: "192.168.123.72:5679"
    }
  }
}
 
management-group {
  type: raft
  partitions: 1
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}
 
partition-groups.raft {
  type: raft
  partitions: 3
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}
  • Atomix 3
cluster {
  cluster-id: onos
  node {
    id: atomix-3
    address: "192.168.123.72:5679"
  }
  discovery {
    type: bootstrap
    nodes.1 {
      id: atomix-1
      address: "192.168.123.66:5679"
    }
    nodes.2 {
      id: atomix-2
      address: "192.168.123.127:5679"
    }
    nodes.3 {
      id: atomix-3
      address: "192.168.123.72:5679"
    }
  }
}
 
management-group {
  type: raft
  partitions: 1
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}
 
partition-groups.raft {
  type: raft
  partitions: 3
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}

Jalankan Atomix Cluster

./bin/atomix-agent

Pembentukan ONOS Cluster

untuk menginstall onos, lihat artikel sebelumnya. Pembentukan cluster cukup mudah, tambahkan konfigurasi ini di /opt/onos/config/cluster.json dan restart ONOS (sesuaikan ip pada ONOS dan IDnya).

sudo -u sdn nano /opt/onos/config/cluster.json

{
  "name": "onos",
  "node": {
    "id": "onos-1",
    "ip": "192.168.123.105",
    "port": 9876
  },
  "storage": [
    {
      "id": "atomix-1",
      "ip": "192.168.123.66",
      "port": 5679
    },
    {
      "id": "atomix-2",
      "ip": "192.168.123.127",
      "port": 5679
    },
    {
      "id": "atomix-3",
      "ip": "192.168.123.72",
      "port": 5679
    }
  ]
}

restart ONOS

systemctl restart onos

 

Installing ONOS, the right way!

ONOS telah mempackage programnya secara otomatis dan dapat diunduh di website resminya.  Pada website resminya, ONOS telah mengatakan bahwa package ini adalah package resmi yang dapat digunakan langsung untuk real deployment.

Sebelum mengunduh, setup terlebih dahulu user pada node yang akan dideploy

sudo adduser sdn --system --group

Install java 8 atau java 11

  • ONOS versi diatas 2.0.0 menggunakan java 11
  • ONOS versi 2.0.0 kebawah menggunakan java 8
apt install git zip curl unzip python-minimal -y
apt install openjdk-8-jdk -y
apt install openjdk-11-jdk -y

buat folder opt jika belum ada

sudo mkdir -p /opt && cd /opt

Untuk package resmi ONOS, disini saya menggunakan versi 1.14.0

sudo wget http://repo1.maven.org/maven2/org/onosproject/onos-releases/1.14.0/onos-1.14.0.tar.gz
sudo tar xzf onos-1.14.0.tar.gz
sudo mv onos-1.14.0 onos
sudo chown -R sdn:sdn onos

setting startup options

sudo -u sdn nano /opt/onos/options

# running onos with user sdn
export ONOS_USER=sdn

# default active drivers and openflow
export ONOS_APPS=drivers,openflow

install service file

sudo cp /opt/onos/init/onos.initd /etc/init.d/onos
sudo cp /opt/onos/init/onos.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable onos

start onos

sudo systemctl start onos

delete default user dari onos

/opt/onos/bin/onos-user-password onos --remove

tambahkan sendiri username dan password yang diinginkan

/opt/onos/bin/onos-user-password zufar zufar

lalu bagaimana access CLInya? untuk setiap user yang ingin akses ke CLI, generate ssh-keygen dan tambahkan public keynya

ssh-keygen -t rsa
/opt/onos/bin/onos-user-key $USER ~/.ssh/id_rsa.pub

login ke CLI

/opt/onos/bin/onos

Building ONOS 1.14

Untuk melakukan build ONOS secara manual, membutuhkan beberapa software, install semua software tersebut :

apt install git zip curl unzip python-minimal openjdk-8-jdk -y

Install bazel sebagai tools buildingnya :

echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install bazel
sudo apt-get install --only-upgrade bazel

jalankan perintah berikut untuk melakukan building pada onos, jangan lakukan pada user root :

git clone https://gerrit.onosproject.org/onos -b onos-1.14
cd onos
export ONOS_ROOT=$(pwd)
source $ONOS_ROOT/tools/dev/bash_profile
bazel build onos

copy hasil build

cd bazel-bin
sudo cp onos.tar.gz /opt

extract dan jalankan

sudo su
cd /opt
tar xvzf onos.tar.gz
mv onos-1.14.2-SNAPSHOT onos
cd onos/apache-karaf-3.0.8/bin
./start clean debug

untuk memasuki client

./client

 

Use Docker containers as hosts in Mininet emulations

Untuk mensimulasikan docker containers sebagai host pada mininet, gunakan containernet.

Containernet is a fork of the famous Mininet network emulator and allows to use Docker containers as hosts in emulated network topologies. This enables interesting functionalities to build networking/cloud emulators and testbeds.

Instalasi

Containernet membutuhkan ubuntu 16.04, jika sudah menginstall mininet, uninstall terlebih dahulu mininetnya

sudo apt-get install ansible git aptitude
git clone https://github.com/containernet/containernet.git
cd containernet/ansible
sudo ansible-playbook -i "localhost," -c local install.yml

Penggunaan

untuk menambahkan docker container sebagai host, perlu menggunakan files python untuk menginisialisasi topology. Berikut adalah contoh file pythonnya :

from mininet.net import Containernet
from mininet.node import RemoteController
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log import info, setLogLevel
setLogLevel('info')

net = Containernet(controller=RemoteController)

info('*** Adding controller\n')
net.addController('c0', controller=RemoteController, ip="127.0.0.1", port=6633)

info( '*** Adding Docker Container\n')
d1 = net.addDocker('d1', ip='1.1.1.1', dimage="ubuntu:trusty")
d2 = net.addDocker('d2', ip='1.1.1.2', dimage="ubuntu:trusty")

info( '*** Adding Hosts\n' )
h1 = net.addHost( 'h1', ip='1.1.1.3', mac='00:00:00:11:00:01' )
h2 = net.addHost( 'h2', ip='1.1.1.4', mac='00:00:00:22:00:02' )

info( '*** Adding switches\n' )
s1 = net.addSwitch('s1')

info( '*** Creating links\n' )
net.addLink(d1, s1)
net.addLink(d2, s1)
net.addLink(h1, s1)
net.addLink(h2, s1)

info('*** Starting network\n')
net.start()

info('*** Running CLI\n')
CLI(net)

info('*** Stopping network')
net.stop()

tidak ada yang berbeda dengan files python untuk mininet biasanya, hanya ada tambahan line berikut untuk menginisialisasi docker container sebagai node/host di mininet:

d1 = net.addDocker('d1', ip='1.1.1.1', dimage="ubuntu:trusty")
d2 = net.addDocker('d2', ip='1.1.1.2', dimage="ubuntu:trusty")

pada script tersebut, saya menggunakan remote controller dengan ip 127.0.0.1, disini saya menggunakan ONOS sebagai controllernya. Setelah controller onos berjalan, eksekusi script python diatas :

root@ubuntu:/home/ubuntu# python script.py 
*** Adding controller
*** Adding Docker Container
d1: kwargs {'ip': '1.1.1.1'}
d1: update resources {'cpu_quota': -1}
d2: kwargs {'ip': '1.1.1.2'}
d2: update resources {'cpu_quota': -1}
*** Adding Hosts
*** Adding switches
*** Creating links
*** Starting network
*** Configuring hosts
d1 d2 h1 h2 
*** Starting controller
c0 
*** Starting 1 switches
s1 ...
*** Running CLI
*** Starting CLI:
containernet> 

Lalu coba testing ping

containernet> pingall
*** Ping: testing ping reachability
d1 -> d2 h1 h2 
d2 -> d1 h1 h2 
h1 -> d1 d2 h2 
h2 -> d1 d2 h1 
*** Results: 0% dropped (12/12 received)

node yang terlihat di ONOS :

 

1 2 3