[Ninux-Calabria] simulazioni su routing a terra
Vincenzo Pirrone
linuspax a gmail.com
Mar 26 Nov 2013 01:15:31 CET
--- INTRODUZIONE ---
Siccome non avevo ancora chiaro il discorso del routing a terra mi sono
installato CORE[1] e ho messo su una simulazione. Vi allego il file e
uno screenshot, se avete tempo e voglia vi consiglio di darci
un'occhiata e di leggere il resto dell'email
[1] http://www.nrl.navy.mil/itd/ncs/products/core
--- PREPARAZIONE AMBIENTE ---
1. Installate CORE (istruzioni sul sito)
2. Installate il software da far girare sulle macchine simulate:
# apt-get install bridge-utils vlan ebtables olsrd
3. Avviate core-daemon:
# /etc/init.d/core-daemon start
4. Avviate core-gui e aprire il file allegato
--- TOPOLOGIA ---
La topologia è composta da 4 nodi di cui 3 supernodi in loop e 1 nodo
foglia.
Ogni nodo ha un router (r0, r1, r2, r3) che sarebbe "il router a terra"
e uno o più antenne
--- RETE ---
Come di consueto ogni nodo ha una sua LAN a 24 bit nella classe
10.0.0.0/8, gli indirizzi sono stati impostati automaticamente da CORE
quindi non mi biasimate! Il traffico delle LAN è untagged.
Sui router invece ci gira olsr quindi questi oltre ad avere un indirizzo
nella LAN hanno tante vlan per quante sono le antenne collegate e
altrettanti indirizzi nella classe 172.17.0.0/16.
In pratica su ogni link il traffico olsr viene incapsulato in frame con
un determinato vlan id, ho cercato di rendere più chiaro questo concetto
usando colori diversi per i link.
Le antenne sono configurate come semplici bridge, non hanno indirizzo
nella classe 172.17.0.0/16, ma solo indirizzo LAN.
--- SIMULAZIONE ---
Premendo il pulsante start the session parte la simulazione. Con doppio
click su una macchina si apre il suo terminale e la shell vi posiziona
sulla cartella di configurazione della stessa.
--- CONFIGURAZIONE MACCHINE ---
Router e antenne si autoconfigurano eseguendo lo script start.sh,
posizionato sulla cartella di configurazione delle macchine.
Nei router lo script configura le vlan, sulle antenne invece bridgia le
due interfacce di rete e, siccome gli switch simulati da CORE non
permettono di taggare le porte, c'ho dovuto inserire due regole di
ebtables come workaround:
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id X -j ACCEPT
In pratica le antenne fanno passare solo traffico untagged e traffico
della vlan X, il traffico delle altre vlan deve essere bloccato
altrimenti, siccome le vlan condividono la stessa sottorete, il traffico
broadcast (in particolare le arp request) inizierebbe a looppare per la
rete.
Nella cartella di configurazione dei router ci sta anche l'olsrd.conf
(olsr parte in automatico).
--- LET'S PLAY ---
Potete divertirvi generando un po' di traffico tra i pc simulati:
hping3 -i u1 <IP>
CORE colorerà di rosso i link in cui passa il traffico.
Se poi fate doppio click su un link potete impostarne latenza e perdita,
ed è molto interessante notare come il percorso dei pacchetti cambia di
conseguenza grazie a olsr.
--
Vincenzo Pirrone
Twitter: @spax_arm
PGP Key ID: 5CF5047D
-------------- parte successiva --------------
Un allegato non testuale è stato rimosso....
Nome: core.png
Tipo: image/png
Dimensione: 108493 bytes
Descrizione: non disponibile
URL: <http://ml.ninux.org/pipermail/calabria/attachments/20131126/9b82ac82/attachment-0003.png>
-------------- parte successiva --------------
node n2 {
type router
model router
network-config {
hostname antenna0
!
interface eth1
!
interface eth0
ip address 10.0.0.2/24
ipv6 address 2001:0::2/64
!
}
canvas c1
iconcoords {314.0 180.0}
labelcoords {314.0 212.0}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 2 -j ACCEPT
}
}
services {IPForward UserDefined}
interface-peer {eth0 n8}
interface-peer {eth1 n12}
}
node n3 {
type router
model router
network-config {
hostname antenna1-2
!
interface eth1
!
interface eth0
ip address 10.0.1.2/24
ipv6 address 2001:1::2/64
!
}
canvas c1
iconcoords {120.0 426.0}
labelcoords {120.0 458.0}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 3 -j ACCEPT
}
}
services {IPForward UserDefined}
interface-peer {eth0 n5}
interface-peer {eth1 n13}
}
node n4 {
type router
model router
network-config {
hostname r1
!
interface eth0
ip address 10.0.1.1/24
ipv6 address 2001:1::1/64
!
}
canvas c1
iconcoords {314.0 593.0}
labelcoords {314.0 625.0}
interface-peer {eth0 n5}
services {IPForward UserDefined}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', 'olsrd.conf', )
cmdup=('sh start.sh', 'olsrd -f olsrd.conf -d 0', )
cmddown=('killall olsrd', )
}
}
custom-config {
custom-config-id service:UserDefined:olsrd.conf
custom-command olsrd.conf
config {
IpVersion 4
Interfaces "eth0.2" "eth0.3" {
}
Hna4 {
10.0.1.0 255.255.255.0
}
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
vconfig add eth0 2
ip addr add 172.17.1.2/16 broadcast 172.17.255.255 dev eth0.2
ip link set dev eth0.2 up
vconfig add eth0 3
ip addr add 172.17.1.3/16 broadcast 172.17.255.255 dev eth0.3
ip link set dev eth0.3 up
}
}
}
node n5 {
type lanswitch
network-config {
hostname switch1
!
}
canvas c1
iconcoords {317.0 466.0}
labelcoords {317.0 490.0}
interface-peer {e0 n6}
interface-peer {e1 n4}
interface-peer {e2 n3}
interface-peer {e3 n19}
}
node n6 {
type router
model PC
network-config {
hostname pc1
!
interface eth0
ip address 10.0.1.20/24
ipv6 address 2001:1::20/64
!
}
canvas c1
iconcoords {90.0 590.0}
labelcoords {90.0 622.0}
interface-peer {eth0 n5}
}
node n7 {
type router
model PC
network-config {
hostname pc0
!
interface eth0
ip address 10.0.0.20/24
ipv6 address 2001:0::20/64
!
}
canvas c1
iconcoords {64.0 299.0}
labelcoords {64.0 331.0}
interface-peer {eth0 n8}
}
node n8 {
type lanswitch
network-config {
hostname switch0
!
}
canvas c1
iconcoords {174.0 233.0}
labelcoords {174.0 257.0}
interface-peer {e1 n7}
interface-peer {e0 n9}
interface-peer {e2 n2}
}
node n9 {
type router
model router
network-config {
hostname r0
!
interface eth0
ip address 10.0.0.1/24
ipv6 address 2001:0::1/64
!
}
canvas c1
iconcoords {77.0 127.0}
labelcoords {77.0 159.0}
interface-peer {eth0 n8}
services {IPForward UserDefined}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', 'olsrd.conf', )
cmdup=('sh start.sh', 'olsrd -f olsrd.conf -d 0', )
cmddown=('killall olsrd', )
}
}
custom-config {
custom-config-id service:UserDefined:olsrd.conf
custom-command olsrd.conf
config {
IpVersion 4
Interfaces "eth0.2" {
}
Hna4 {
10.0.0.0 255.255.255.0
}
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
vconfig add eth0 2
ip addr add 172.17.0.2/16 broadcast 172.17.255.255 dev eth0.2
ip link set dev eth0.2 up
}
}
}
node n1 {
type lanswitch
network-config {
hostname switch2
!
}
canvas c1
iconcoords {550.0 118.0}
labelcoords {550.0 142.0}
interface-peer {e1 n11}
interface-peer {e0 n12}
interface-peer {e2 n13}
interface-peer {e3 n14}
interface-peer {e4 n18}
}
node n11 {
type router
model router
network-config {
hostname r2
!
interface eth0
ip address 10.0.2.1/24
ipv6 address 2001:2::1/64
!
}
canvas c1
iconcoords {749.0 102.0}
labelcoords {749.0 134.0}
interface-peer {eth0 n1}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', 'olsrd.conf', )
cmdup=('sh start.sh', 'olsrd -f olsrd.conf -d 0', )
cmddown=('killall olsrd', )
}
}
custom-config {
custom-config-id service:UserDefined:olsrd.conf
custom-command olsrd.conf
config {
IpVersion 4
Interfaces "eth0.2" "eth0.3" "eth0.4" {
}
Hna4 {
10.0.2.0 255.255.255.0
}
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
vconfig add eth0 2
ip addr add 172.17.2.2/16 broadcast 172.17.255.255 dev eth0.2
ip link set dev eth0.2 up
vconfig add eth0 3
ip addr add 172.17.2.3/16 broadcast 172.17.255.255 dev eth0.3
ip link set dev eth0.3 up
vconfig add eth0 4
ip addr add 172.17.2.4/16 broadcast 172.17.255.255 dev eth0.4
ip link set dev eth0.4 up
}
}
services {IPForward UserDefined}
}
node n12 {
type router
model router
network-config {
hostname antenna2-0
!
interface eth0
ip address 10.0.2.2/24
ipv6 address 2001:2::2/64
!
interface eth1
!
}
canvas c1
iconcoords {432.0 73.0}
labelcoords {432.0 105.0}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 2 -j ACCEPT
}
}
services {IPForward UserDefined}
interface-peer {eth0 n1}
interface-peer {eth1 n2}
}
node n13 {
type router
model router
network-config {
hostname antenna2-1
!
interface eth0
ip address 10.0.2.3/24
ipv6 address 2001:2::3/64
!
interface eth1
!
}
canvas c1
iconcoords {532.0 213.0}
labelcoords {532.0 245.0}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 3 -j ACCEPT
}
}
services {IPForward UserDefined}
interface-peer {eth0 n1}
interface-peer {eth1 n3}
}
node n10 {
type router
model router
network-config {
hostname antenna3-2
!
interface eth1
!
interface eth0
ip address 10.0.3.2/24
ipv6 address 2001:3::2/64
!
}
canvas c1
iconcoords {947.0 425.0}
labelcoords {947.0 457.0}
interface-peer {eth0 n15}
interface-peer {eth1 n14}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 4 -j ACCEPT
}
}
services {zebra OSPFv2 OSPFv3 vtysh IPForward UserDefined}
}
node n14 {
type router
model router
network-config {
hostname antenna2-3
!
interface eth1
!
interface eth0
ip address 10.0.2.4/24
ipv6 address 2001:2::4/64
!
}
canvas c1
iconcoords {734.0 223.0}
labelcoords {734.0 255.0}
interface-peer {eth0 n1}
interface-peer {eth1 n10}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 4 -j ACCEPT
}
}
services {zebra OSPFv2 OSPFv3 vtysh IPForward UserDefined}
}
node n15 {
type hub
network-config {
hostname switch3
!
}
canvas c1
iconcoords {746.0 491.0}
labelcoords {746.0 515.0}
interface-peer {e0 n16}
interface-peer {e1 n10}
interface-peer {e2 n17}
interface-peer {e3 n20}
}
node n16 {
type router
model router
network-config {
hostname r3
!
interface eth0
ip address 10.0.3.1/24
ipv6 address 2001:3::1/64
!
}
canvas c1
iconcoords {660.0 589.0}
labelcoords {660.0 621.0}
interface-peer {eth0 n15}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', 'olsrd.conf', )
cmdup=('sh start.sh', 'olsrd -f olsrd.conf -d 2', )
cmddown=('killall olsrd', )
}
}
custom-config {
custom-config-id service:UserDefined:olsrd.conf
custom-command olsrd.conf
config {
IpVersion 4
Interfaces "eth0.2" "eth0.4" {
}
Hna4 {
10.0.3.0 255.255.255.0
}
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
vconfig add eth0 2
ip addr add 172.17.3.2/16 broadcast 172.17.255.255 dev eth0.2
ip link set dev eth0.2 up
vconfig add eth0 4
ip addr add 172.17.3.4/16 broadcast 172.17.255.255 dev eth0.4
ip link set dev eth0.4 up
}
}
services {zebra OSPFv2 OSPFv3 vtysh IPForward UserDefined}
}
node n17 {
type router
model PC
network-config {
hostname pc3
!
interface eth0
ip address 10.0.3.20/24
ipv6 address 2001:3::20/64
!
}
canvas c1
iconcoords {862.0 575.0}
labelcoords {862.0 607.0}
interface-peer {eth0 n15}
}
node n18 {
type router
model PC
network-config {
hostname pc2
!
interface eth0
ip address 10.0.2.20/24
ipv6 address 2001:2::20/64
!
}
canvas c1
iconcoords {601.0 35.0}
labelcoords {601.0 67.0}
interface-peer {eth0 n1}
}
node n19 {
type router
model router
network-config {
hostname antenna1-3
!
interface eth1
!
interface eth0
ip address 10.0.1.3/24
ipv6 address 2001:1::3/64
!
}
canvas c1
iconcoords {457.0 396.0}
labelcoords {457.0 428.0}
interface-peer {eth0 n5}
interface-peer {eth1 n20}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 2 -j ACCEPT
}
}
services {zebra OSPFv2 OSPFv3 vtysh IPForward UserDefined}
}
node n20 {
type router
model router
network-config {
hostname antenna3-1
!
interface eth1
!
interface eth0
ip address 10.0.3.3/24
ipv6 address 2001:3::3/64
!
}
canvas c1
iconcoords {572.0 478.0}
labelcoords {572.0 510.0}
interface-peer {eth0 n15}
interface-peer {eth1 n19}
custom-config {
custom-config-id service:UserDefined
custom-command UserDefined
config {
files=('start.sh', )
cmdup=('sh start.sh', )
}
}
custom-config {
custom-config-id service:UserDefined:start.sh
custom-command start.sh
config {
#!/bin/bash
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ip link set dev br0 up
ebtables -t broute -P BROUTING DROP
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 0 -j ACCEPT
ebtables -t broute -A BROUTING -p 802_1Q --vlan-id 2 -j ACCEPT
}
}
services {zebra OSPFv2 OSPFv3 vtysh IPForward UserDefined}
}
link l2 {
color Black
nodes {n8 n7}
bandwidth 0
}
link l3 {
color Black
nodes {n5 n6}
bandwidth 0
}
link l4 {
color Cyan
nodes {n5 n4}
bandwidth 0
}
link l1 {
color Green
nodes {n9 n8}
bandwidth 0
}
link l10 {
color Magenta
nodes {n11 n1}
bandwidth 0
}
link l5 {
color Green
nodes {n8 n2}
bandwidth 0
}
link l6 {
color Green
nodes {n12 n1}
bandwidth 0
}
link l9 {
delay 3000
color Green
nodes {n2 n12}
bandwidth 0
}
link l7 {
color Blue
nodes {n1 n13}
bandwidth 0
}
link l8 {
color Blue
nodes {n5 n3}
bandwidth 0
}
link l11 {
delay 100000
color Blue
nodes {n13 n3}
bandwidth 0
}
link l12 {
nodes {n1 n14}
bandwidth 0
}
link l13 {
color Yellow
nodes {n16 n15}
bandwidth 0
}
link l14 {
nodes {n15 n10}
bandwidth 0
}
link l15 {
color Black
nodes {n15 n17}
bandwidth 0
}
link l16 {
delay 4000
nodes {n14 n10}
bandwidth 0
}
link l17 {
color Black
nodes {n18 n1}
bandwidth 0
}
link l18 {
color Green
nodes {n19 n5}
bandwidth 0
}
link l19 {
color Green
nodes {n20 n15}
bandwidth 0
}
link l20 {
delay 2000
color Green
nodes {n19 n20}
bandwidth 0
}
annotation a1 {
iconcoords {92.0 99.0}
type text
label {+vlan2}
labelcolor #00ff00
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a2 {
type text
iconcoords {185.0 102.0}
label {}
canvas c1
}
annotation a3 {
iconcoords {781.0 63.0}
type text
label {+vlan2}
labelcolor #00ff00
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a4 {
iconcoords {781.0 89.0}
type text
label {+vlan3}
labelcolor #0000ff
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a5 {
type text
iconcoords {808.0 90.0}
label {}
canvas c1
}
annotation a6 {
iconcoords {359.0 599.0}
type text
label {+vlan3}
labelcolor #0000ff
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a7 {
type text
iconcoords {788.0 296.0}
label {}
canvas c1
}
annotation a8 {
type text
iconcoords {606.0 117.0}
label {}
canvas c1
}
annotation a9 {
type text
iconcoords {597.0 117.0}
label {}
canvas c1
}
annotation a10 {
type text
iconcoords {75.0 121.0}
label {}
canvas c1
}
annotation a11 {
iconcoords {783.0 112.0}
type text
label {+vlan4}
labelcolor #ff0000
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a12 {
type text
iconcoords {825.0 115.0}
label {}
canvas c1
}
annotation a13 {
iconcoords {577.0 599.0}
type text
label {+vlan4}
labelcolor #ff0000
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a14 {
type text
iconcoords {344.0 314.0}
label {}
canvas c1
}
annotation a15 {
type text
iconcoords {306.0 367.0}
label {}
canvas c1
}
annotation a16 {
type text
iconcoords {295.0 350.0}
label {}
canvas c1
}
annotation a17 {
type text
iconcoords {113.0 421.0}
label {}
canvas c1
}
annotation a18 {
iconcoords {360.0 575.0}
type text
label {+vlan2}
labelcolor #00ff00
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a19 {
type text
iconcoords {394.0 566.0}
label {}
canvas c1
}
annotation a20 {
iconcoords {577.0 575.0}
type text
label {+vlan2}
labelcolor #00ff00
fontfamily {Arial}
fontsize {12}
canvas c1
}
annotation a21 {
type text
iconcoords {602.0 572.0}
label {}
canvas c1
}
canvas c1 {
name {Canvas1}
}
traffic {
{flow 1 from n7 to n6} 1 0.0 {} n7 n6 10.0.0.20 5000 {} 10.0.1.20 5000 /var/log/mgen1.log UDP {} {BURST [RANDOM 5.0 PERIODIC [25.0 1280] FIXED 3.0]} {}
}
option global {
interface_names no
ip_addresses yes
ipv6_addresses yes
node_labels yes
link_labels yes
show_api no
background_images no
annotations yes
grid yes
traffic_start 0
}
option session {
}
-------------- parte successiva --------------
Un allegato non testuale è stato rimosso....
Nome: signature.asc
Tipo: application/pgp-signature
Dimensione: 901 bytes
Descrizione: OpenPGP digital signature
URL: <http://ml.ninux.org/pipermail/calabria/attachments/20131126/9b82ac82/attachment-0001.sig>
Maggiori informazioni sulla lista
Calabria