2014/01/22

core_lab1 ssh

verifica del corretto funzionamento del emulatore core su debian:

files :

# ls /etc/core/ -l
total 12
-rw-r--r-- 1 root root 1419 Aug 23 18:30 core.conf
-rw-r--r-- 1 root root 1094 Oct 30 12:03 perflogserver.conf
-rw-r--r-- 1 root root 1569 Nov 30  2012 xen.conf


# ls /etc/quagga/ -l
total 8
lrwxrwxrwx 1 root root  33 Jan 17 11:15 babeld.conf -> /usr/local/etc/quagga/babeld.conf
lrwxrwxrwx 1 root root  31 Jan 17 11:15 bgpd.conf -> /usr/local/etc/quagga/bgpd.conf
-rw-r--r-- 1 root root 998 Jan 17 10:59 daemons
-rw-r--r-- 1 root root 945 Nov 26 01:32 debian.conf
lrwxrwxrwx 1 root root  32 Jan 17 11:15 isisd.conf -> /usr/local/etc/quagga/isisd.conf
lrwxrwxrwx 1 root root  33 Jan 17 11:15 ospf6d.conf -> /usr/local/etc/quagga/ospf6d.conf
lrwxrwxrwx 1 root root  32 Jan 17 11:15 ospfd.conf -> /usr/local/etc/quagga/ospfd.conf
lrwxrwxrwx 1 root root  33 Jan 16 21:23 Quagga.conf -> /usr/local/etc/quagga/Quagga.conf
lrwxrwxrwx 1 root root  31 Jan 17 11:15 ripd.conf -> /usr/local/etc/quagga/ripd.conf
lrwxrwxrwx 1 root root  33 Jan 17 11:15 ripngd.conf -> /usr/local/etc/quagga/ripngd.conf
lrwxrwxrwx 1 root root  32 Jan 16 21:23 vtysh.conf -> /usr/local/etc/quagga/vtysh.conf
lrwxrwxrwx 1 root root  32 Jan 17 11:15 zebra.conf -> /usr/local/etc/quagga/zebra.conf

# ls -l /usr/local/etc/quagga/
total 40
-rw-r--r-- 1 root staff  655 Jan 17 11:12 babeld.conf
-rw-r--r-- 1 root staff 2801 Jan 17 11:12 bgpd.conf
-rw-r--r-- 1 root staff  805 Jan 17 11:12 isisd.conf
-rw-r--r-- 1 root staff 1110 Jan 17 11:12 ospf6d.conf
-rw-r--r-- 1 root staff  182 Jan 17 11:12 ospfd.conf
-rw-r--r-- 1 root staff   39 Jan 17 11:19 Quagga.conf
-rw-r--r-- 1 root staff  422 Jan 17 11:12 ripd.conf
-rw-r--r-- 1 root staff  390 Jan 17 11:12 ripngd.conf
-rw-r--r-- 1 root staff  126 Jan 17 11:12 vtysh.conf
-rw-r--r-- 1 root staff  385 Jan 17 11:18 zebra.conf

qui trovate gli esempi e file di configurazione
se non fossero installati

# ls /usr/share/core/icons/
normal    svg  tiny

 # ls /usr/share/doc/core-network
core-network/        core-network-daemon/ core-network-gui/  

# ls /usr/share/doc/core-network-gui/examples/configs/sample*
/usr/share/doc/core-network-gui/examples/configs/sample10-kitchen-sink.imn
/usr/share/doc/core-network-gui/examples/configs/sample1-bg.gif
/usr/share/doc/core-network-gui/examples/configs/sample1.imn
/usr/share/doc/core-network-gui/examples/configs/sample1.scen
/usr/share/doc/core-network-gui/examples/configs/sample2-ssh.imn
/usr/share/doc/core-network-gui/examples/configs/sample3-bgp.imn
/usr/share/doc/core-network-gui/examples/configs/sample4-bg.jpg
/usr/share/doc/core-network-gui/examples/configs/sample4-nrlsmf.imn
/usr/share/doc/core-network-gui/examples/configs/sample4.scen
/usr/share/doc/core-network-gui/examples/configs/sample5-mgen.imn
/usr/share/doc/core-network-gui/examples/configs/sample6-emane-rfpipe.imn
/usr/share/doc/core-network-gui/examples/configs/sample7-emane-ieee80211abg.imn
/usr/share/doc/core-network-gui/examples/configs/sample8-ipsec-service.imn
/usr/share/doc/core-network-gui/examples/configs/sample9-vpn.imn

ls /usr/share/doc/quagga/examples/
babeld.conf.sample  bgpd.conf.sample2  ospf6d.conf.sample  ripd.conf.sample    vtysh.conf.sample
bgpd.conf.sample    isisd.conf.sample  ospfd.conf.sample   ripngd.conf.sample  zebra.conf.sample

servizi da avviare:

/etc/init.d/core-daemon start
/etc/init.d/quagga    start

processi:

 4937 ?        Sl     0:00 /usr/bin/python /usr/sbin/core-daemon -d
 4959 ?        Ss     0:00 /usr/lib/quagga/zebra --daemon -A 127.0.0.1
 4963 ?        Ss     0:00 /usr/lib/quagga/bgpd --daemon -A 127.0.0.1
 4967 ?        Ss     0:00 /usr/lib/quagga/ripd --daemon -A 127.0.0.1
 4971 ?        Ss     0:00 /usr/lib/quagga/ripngd --daemon -A ::1
 4975 ?        Ss     0:00 /usr/lib/quagga/ospfd --daemon -A 127.0.0.1
 4979 ?        Ss     0:00 /usr/lib/quagga/ospf6d --daemon -A ::1
 4983 ?        Ss     0:00 /usr/lib/quagga/isisd --daemon -A 127.0.0.1
 4987 ?        Ss     0:00 /usr/lib/quagga/babeld --daemon -A 127.0.0.1

porte :

tcp        0      0 127.0.0.1:2601          0.0.0.0:*               LISTEN      120        18033       4959/zebra    
tcp        0      0 127.0.0.1:2602          0.0.0.0:*               LISTEN      120        18045       4967/ripd     
tcp        0      0 127.0.0.1:2604          0.0.0.0:*               LISTEN      120        18057       4975/ospfd    
tcp        0      0 127.0.0.1:2605          0.0.0.0:*               LISTEN      120        18038       4963/bgpd     
tcp        0      0 127.0.0.1:2608          0.0.0.0:*               LISTEN      120        16744       4983/isisd    
tcp        0      0 127.0.0.1:2609          0.0.0.0:*               LISTEN      120        18069       4987/babeld   
udp        0      0 127.0.0.1:4038          0.0.0.0:*                           0          50773       4937/python   
tcp        0      0 127.0.0.1:4038          0.0.0.0:*               LISTEN      0          50768       4937/python

logs:

ls -l /var/log/core-daemon.log
-rw-r--r-- 1 root root 68435 Jan 22 10:37 /var/log/core-daemon.log

ls -l /var/log/quagga/
-rw-r----- 1 quagga quaggavty  0 Jan 22 09:31 zebra.log

/var/log/syslog

nei seguenti file nella home del utente si posssono modificare i parametri di default:

> ls .core/ -l
total 28
drwxr-xr-x 2 leopoldo leopoldo 4096 Jan 20 13:47 configs
drwxr-xr-x 2 leopoldo leopoldo 4096 Jan  9 14:23 myservices
-rw-r--r-- 1 leopoldo leopoldo  754 Jan 16 22:03 nodes.conf
-rw-r--r-- 1 leopoldo leopoldo  362 Jan 20 11:29 plugins.conf
-rw-r--r-- 1 leopoldo leopoldo  887 Jan 20 15:35 prefs.conf
-rw-r--r-- 1 leopoldo leopoldo   46 Jan  9 14:23 servers.conf
-rw-r--r-- 1 leopoldo leopoldo  578 Jan  9 14:23 widgets.conf

Avviamo core network emulator e aggiungiamo un nodo router dalla barra sulla sinistra, click sinistro sulla griglia per aggiungere un nodo


poi click destro sul nodo,menù a tendina, configure, tasto services, click ip_forward e facciamo la modifica sotto, abilitiamo pure ssh


torniamo alla griglia di lavoro, tasto destro sul nodo, menù a tendina, copy,

paste sulla griglia e abbiamo un nodo route con le modifiche salvate.

Aggiugiamo una connessione, e verranno generate in automatico gli ip:


avvio in modalità running, click destro su uno dei nodi, menù a tendina, shell window, vtysh, premere q per la linea di comando

n1# ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=0.060 ms
64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=0.042 ms
64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=0.063 ms
64 bytes from 10.0.0.2: icmp_req=4 ttl=64 time=0.069 ms


cosa viene virtualizzato?
vengono virtualizzati sia il nostro processo host che quagga

 6191 ?        S      0:00 /usr/sbin/vnoded -v -c /tmp/pycore.10017/n1 -l /tmp/pycore.10017/n1.log -p /tmp/pycore.10017/n1.pid -C /tm
 6317 ?        Ss     0:00  \_ /usr/lib/quagga/zebra -u root -g root -d
 6370 ?        Ss     0:00  \_ /usr/lib/quagga/ospf6d -u root -g root -d
 6371 ?        Ss     0:00  \_ /usr/lib/quagga/ospfd -u root -g root -d
 6381 ?        Ss     0:00  \_ /usr/sbin/sshd -f /etc/ssh/sshd_config
 6394 pts/4    Ss+    0:00  \_ vtysh
 6201 ?        S      0:00 /usr/sbin/vnoded -v -c /tmp/pycore.10017/n2 -l /tmp/pycore.10017/n2.log -p /tmp/pycore.10017/n2.pid -C /tm
 6360 ?        Ss     0:00  \_ /usr/lib/quagga/zebra -u root -g root -d
 6375 ?        Ss     0:00  \_ /usr/lib/quagga/ospf6d -u root -g root -d
 6376 ?        Ss     0:00  \_ /usr/lib/quagga/ospfd -u root -g root -d
 6380 ?        Ss     0:00  \_ /usr/sbin/sshd -f /etc/ssh/sshd_config


e vengono creati una serie di file di configurazione sotto /tmp

root@debian8:~# 
# ls -l /tmp/pycore.10017/
total 80
srw-rw-rw- 1 root     root         0 Jan 22 11:43 n1
drwxrwxrwx 8 root     root      4096 Jan 22 11:43 n1.conf
-rw-r--r-- 1 root     root     17358 Jan 22 11:48 n1.log
-rw-rw-rw- 1 root     root         5 Jan 22 11:43 n1.pid
-rw-r--r-- 1 leopoldo leopoldo    11 Jan 22 11:43 n1.xy
srw-rw-rw- 1 root     root         0 Jan 22 11:43 n2
drwxrwxrwx 8 root     root      4096 Jan 22 11:43 n2.conf
-rw-r--r-- 1 root     root     17546 Jan 22 11:49 n2.log
-rw-rw-rw- 1 root     root         5 Jan 22 11:43 n2.pid
-rw-r--r-- 1 leopoldo leopoldo    11 Jan 22 11:43 n2.xy
-rw-rw-rw- 1 root     root       137 Jan 22 11:43 nodes
-rw-rw-rw- 1 root     root        13 Jan 22 11:43 servers
-rw-rw-rw- 1 root     root        10 Jan 22 11:43 state
-rw-r--r-- 1 leopoldo leopoldo  2005 Jan 22 11:43 thumb.jpg

e questo è un singolo nodo:

# file /tmp/pycore.10017/n2*
/tmp/pycore.10017/n2:      socket
/tmp/pycore.10017/n2.conf: directory
/tmp/pycore.10017/n2.log:  ASCII text
/tmp/pycore.10017/n2.pid:  ASCII text
/tmp/pycore.10017/n2.xy:   ASCII text

# ls -l /tmp/pycore.10017/n2.conf
total 36
drwxrwxrwx 2 root root 4096 Jan 22 11:43 etc.ssh
-rw-r--r-- 1 root root  290 Jan 22 11:43 ipforward.sh
-rw-r--r-- 1 root root 2507 Jan 22 11:43 quaggaboot.sh
-rw-r--r-- 1 root root  234 Jan 22 11:43 startsshd.sh
drwxrwxrwx 2 root root 4096 Jan 22 11:43 usr.local.etc.quagga
drwxrwxrwx 2 root root 4096 Jan 22 11:43 var.log
drwxrwxrwx 5 root root 4096 Jan 22 11:43 var.run
drwxrwxrwx 2 root root 4096 Jan 22 11:43 var.run.quagga
drw-r-xr-x 2 root root 4096 Jan 22 11:43 var.run.sshd


nel menù widgets, obserbe widgets, process vediamo i processi attivi



dalla shell bash:
 root@n1:/tmp/pycore.10017/n1.conf# 
# ps fax
  PID TTY      STAT   TIME COMMAND
    1 ?        S      0:00 /usr/sbin/vnoded -v -c /tmp/pycore.10017/n1 -l /tmp/p
   52 ?        Ss     0:00 /usr/lib/quagga/zebra -u root -g root -d
   60 ?        Ss     0:00 /usr/lib/quagga/ospf6d -u root -g root -d
   61 ?        Ss     0:00 /usr/lib/quagga/ospfd -u root -g root -d
   65 ?        Ss     0:00 /usr/sbin/sshd -f /etc/ssh/sshd_config
   88 pts/4    Ss     0:00 /bin/bash

aggiungiamo il resto dei nodi col copy/pasty e modifichiamo con menù a tendina, configure, tasto type, pc. avremo la seguente situazione:



dal menu widgets possiamo verificare le rotte

oppure dalla shell

Hello, this is Quagga (version 0.99.22.4).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

n2# sh ip route

O>* 10.0.0.0/24 [110/20] via 10.0.1.1, eth0, 00:06:35
O   10.0.1.0/24 [110/10] is directly connected, eth0, 00:07:30
C>* 10.0.1.0/24 is directly connected, eth0
O   10.0.2.0/24 [110/10] is directly connected, eth1, 00:07:30
C>* 10.0.2.0/24 is directly connected, eth1
O>* 10.0.3.0/24 [110/20] via 10.0.2.2, eth1, 00:06:40
C>* 127.0.0.0/8 is directly connected, lo

infine connettiamoci con ssh
# ssh 10.0.0.20

  root@10.0.0.20's password:

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.


se avete qualche errore di accesso alla sessione ssh ricreate il file

:>.ssh/known_hosts

nella home del utente, perché i parametri della home_root delle shell_window corrispono a quella del utente che segue core