Monday, April 30, 2018

Substratum Node on Linux (Ubuntu Server 16.x)


sudo apt-get install ssh openssh-server gcc make pkg-config git

Docker
https://docs.docker.com/install/linux/docker-ce/ubuntu

systemctl start docker

Thursday, April 12, 2018

EVE-NG Troubleshooting


Router doesn't boot

*First try to simply "wipe" the router*

*If the wipe doesn't help do the following*
When the icon goes immediately from blue to grey, you can 

1)
check if the router is not already running by doing 
ps -ef | grep "D <ID of the router>" (you can find the ID of the router by right-clicking on the icon in the GUI

If there are running processes first try to kill it nicely via
kill -15 <ID>
If still running
kill <ID>
If still running
kill -9 <ID>



2) 

Read the file /opt/unetlab/data/Logs/unl_wrapper.txt
Go to the directory of the router
Execute the command manually (without the redirect)
This will start a child process
Execute the child command manually and look for errors

Example:

cat /opt/unetlab/data/Logs/unl_wrapper.txt 

check the last entries and do the same manually

cd /opt/unetlab/tmp/0/c1c2b011-55e4-4279-b489-0cb8684710bb/5

/opt/unetlab/wrappers/qemu_wrapper -C 49787 -T 0 -D 5 -t "CSR2" -F /opt/qemu-2.2.0/bin/qemu-system-x86_64 -d 0 --  -nographic -device e1000,netdev=net0,mac=50:00:00:05:00:00 -netdev tap,id=net0,ifname=vunl1_0_5_0,script=no -device e1000,netdev=net1,mac=50:00:00:05:00:01 -netdev tap,id=net1,ifname=vunl1_0_5_1,script=no -device e1000,netdev=net2,mac=50:00:00:05:00:02 -netdev tap,id=net2,ifname=vunl1_0_5_2,script=no -device e1000,netdev=net3,mac=50:00:00:05:00:03 -netdev tap,id=net3,ifname=vunl1_0_5_3,script=no -smp 1 -m 3072 -name CSR2 -uuid a2c2cd71-1673-48d0-8907-a135ad73af83 -hda hda.qcow2 -machine type=pc-1.0,accel=kvm -serial mon:stdio -nographic -nodefconfig -nodefaults -rtc base=utc

TAG=T0D5- /opt/qemu-2.2.0/bin/qemu-system-x86_64 -nographic -device e1000,netdev=net0,mac=50:00:00:05:00:00 -netdev tap,id=net0,ifname=vunl1_0_5_0,script=no -device e1000,netdev=net1,mac=50:00:00:05:00:01 -netdev tap,id=net1,ifname=vunl1_0_5_1,script=no -device e1000,netdev=net2,mac=50:00:00:05:00:02 -netdev tap,id=net2,ifname=vunl1_0_5_2,script=no -device e1000,netdev=net3,mac=50:00:00:05:00:03 -netdev tap,id=net3,ifname=vunl1_0_5_3,script=no -smp 1 -m 3072 -name CSR2 -uuid a2c2cd71-1673-48d0-8907-a135ad73af83 -hda hda.qcow2 -machine type=pc-1.0,accel=kvm -serial mon:stdio -nographic -nodefconfig -nodefaults -rtc base=utc

Try to see what error message you get.

EVE-NG Troubleshooting

Packets don't show up on the other side of the link
To check the underlying bridge (each link between routers is a hidden bridge), connect to the console of eve (ssh, ...)


*new format as of 4.x*

root@eve-ng:~# brctl show

bridge name     bridge id               STP enabled     interfaces
docker0         8000.0242133159f4       no              screen_46667
                                                        screen_47937
nat0            8000.3e0e9e87189a       no              vun001000004205
                                                        vun001000004700
pnet0           8000.0050568e69e1       no              eth0
                                                        vun001000000700
                                                        vun003000b00101
pnet1           8000.0050568eb031       no              eth1
pnet2           8000.000000000000       no
pnet3           8000.000000000000       no
pnet4           8000.000000000000       no
pnet5           8000.000000000000       no
pnet6           8000.000000000000       no
pnet7           8000.000000000000       no
pnet8           8000.000000000000       no
pnet9           8000.000000000000       no
vnet00100000004         8000.eac8a9fa3c1a       no              vun001000004301
vnet00100000008         8000.ba8ea28f5616       no              vun001000000a00
                                                                                                vun001000002103
vnet00100000009         8000.76a0d8456b74       no              vun001000002400
                                                                                               vun001000002c30
vnet0010000000a         8000.8e69eca20eb5       no              vun001000001e00
                                                                                                vun001000004201
vnet0010000000b         8000.8aa0b055cd94       no              vun001000004402

vnet00x000000xx are the bridges. 

vun00x00000yyzz are the interfaces in your lab. 
x = user POD-ID
yy = Router ID in hex-> can be found by right-clicking on the router (shown between brackets) and converting it to hex.
interfaceID is logical (gi0/0 is 0, gi0/1 is 1, etc).

For example, bridge vnet00100000009 connects

vun001000002400 =  pod1-router36(hex24)-interface0 
with 
vun001000002c30  = pod1-router44(hex2c)-interface3

More details

root@eve-ng:~# brctl showstp vnet00100000009

vnet00100000009
 bridge id              8000.76a0d8456b74
 designated root        8000.76a0d8456b74
 root port                 0                    path cost                  0
 max age                  20.00                 bridge max age            20.00
 hello time                2.00                 bridge hello time          2.00
 forward delay            15.00                 bridge forward delay      15.00
 ageing time               0.00
 hello timer               0.00                 tcn timer                  0.00
 topology change timer     0.00                 gc timer                   0.00
 flags


vun001000002400 (2)
 port id                8002                    state                forwarding
 designated root        8000.76a0d8456b74       path cost                100
 designated bridge      8000.76a0d8456b74       message age timer          0.00
 designated port        8002                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags

vun001000002c30 (1)
 port id                8001                    state                forwarding
 designated root        8000.76a0d8456b74       path cost                100
 designated bridge      8000.76a0d8456b74       message age timer          0.00
 designated port        8001                    forward delay timer        0.00
 designated cost           0                    hold timer                 0.00
 flags


If they are not in forwarding then communication will not work. This bridge should disappear when the link is down (neither side has a running router) in the GUI of eve-ng. If it remains try to delete it manually:

brctl delif vnet00100000009  vun001000002400
brctl delif vnet00100000009  vun001000002c30
brctl delbr 
vnet00100000009


If the last command doesn't work.Then delete it on a linux level:

root@eve-ng:~# brctl delbr vnet00100000009
bridge vnet00100000009 is still up; can't delete it
root@eve-ng:~# ip link del 
vnet00100000009

To check on a linux level the status of the bridges &interfaces:

ip link
ip link show vun001000002c30
or 
dmesg

If the link is down you can do: 
 

ip link set vun001000002c30 up


*old format before 4.x*
root@eve-ng:~# brctl show
bridge name    bridge id        STP enabled    interfaces
docker0        8000.02426b37243d    no        screen_0
                            veth9385b06
nat0        8000.000000000000    no       
pnet1        8000.000000000000    no       
pnet2        8000.000000000000    no       
pnet3        8000.000000000000    no       
pnet4        8000.000000000000    no       
pnet5        8000.000000000000    no       
pnet6        8000.000000000000    no       
pnet7        8000.000000000000    no       
pnet8        8000.000000000000    no       
pnet9        8000.000000000000    no       
vnet1_0_18        8000.1e2c061e0be3    no        vunl1_0_13_1
vnet1_0_20        8000.ca655da5c77f    no        vunl1_0_13_0
vnet2_0_1        8000.2227c4356e60    no        vunl2_0_1_0
                                                vunl2_0_4_0
vnet2_0_2        8000.1e7262aa3853    no        vunl2_0_1_1
                                                 vunl2_0_3_0
vnet2_0_3        8000.62a793b91f19    no        vunl2_0_1_2
                                                vunl2_0_2_2
vnet2_0_4        8000.76c00a9115ff    no        vunl2_0_1_3
vnet2_0_5        8000.bac02a706e2c    no        vunl2_0_1_4
vnetx_x_x are the bridges. vunlx_x_x_x are the interfaces in your lab. Second last number is the routerID, last number is the interfaceID.
RouterID can be found by right-clicking on the router (shown between brackets), interfaceID is logical (gi0/0 is 0, gi0/1 is 1, etc).
For example, bridge vnet2_0_1 connects router1-interface0 with router4-interface0

More details

root@eve-ng:~# brctl showstp vnet2_0_1
vnet2_0_1
 bridge id        8000.2227c4356e60
 designated root    8000.2227c4356e60
 root port           0            path cost           0
 max age          20.00            bridge max age          20.00
 hello time           2.00            bridge hello time       2.00
 forward delay          15.00            bridge forward delay      15.00
 ageing time           0.00
 hello timer           0.00            tcn timer           0.00
 topology change timer       0.00            gc timer           0.12
 flags           


vunl2_0_1_0 (1)
 port id        8001            state             forwarding
 designated root    8000.2227c4356e60    path cost         100
 designated bridge    8000.2227c4356e60    message age timer       0.00
 designated port    8001            forward delay timer       0.00
 designated cost       0            hold timer           0.00
 flags           

vunl2_0_4_0 (2)
 port id        8002            state             forwarding
 designated root    8000.2227c4356e60    path cost         100
 designated bridge    8000.2227c4356e60    message age timer       0.00
 designated port    8002            forward delay timer       0.00
 designated cost       0            hold timer           0.00
 flags           


If they are not in forwarding then communication will not work. This bridge should disappear when the link is down (neither side has a running router) in the GUI of eve-ng. If it remains try to delete it manually:

brctl delif vnet2_0_1  vunl2_0_1_0
brctl delif vnet2_0_1  vunl2_0_4_0
brctl delbr vnet2_0_1


If the last command doesn't work.Then delete it on a linux level:

root@eve-ng:~# brctl delbr vnet2_0_1
bridge vnet2_0_4 is still up; can't delete it
root@eve-ng:~# ip link del vnet2_0_1


To check on a linux level the status of the interfaces:

ip link | grep vnet
ip link show vunl2_0_4_0
or 
dmesg

If the link is down you can do: 
 

ip link set vunl2_0_4_0 up



EVE-NG Copy&paste


To copy between host and eve-ng native client, while in the client, click CTRL-ALT-SHIFT which will bring up the HTML5_Desktop_Admin side panel.

Copy what you want to that window, select it again and do CTRL-C and then you can paste it. Works bidirectional.

test

import os import argparse import json def load_json_file(filepath):     with open(filepath, 'r') as f:         return json.load(f) d...