--- /dev/null
+El script makeroute levanta la interfaz y configura las rutas para un host. La
+forma de uso es ./makeroute up HOST (en esta PC host es A3). Levanta los datos
+de rutas.csv y hace backup del /etc/hosts y /etc/networks y copia los propios.
+Cuando se finaliza hay que usar ./makeroute down A3 para eliminar los cambios.
+
--- /dev/null
+127.0.0.1 localhost
+
+# Red 1
+192.168.1.193 Red1A1 R1A1 A1 Red1A1.Red1 R1A1.Red1 A1.Red1
+192.168.1.194 Red1A2 R1A2 A2 Red1A2.Red1 R1A2.Red1 A2.Red1
+192.168.1.195 Red1A3 R1A3 A3 Red1A3.Red1 R1A3.Red1 A3.Red1
+192.168.1.196 Red1A4 R1A4 A4 Red1A4.Red1 R1A4.Red1 A4.Red1
+192.168.1.197 Red1A5 R1A5 A5 Red1A5.Red1 R1A5.Red1 A5.Red1
+192.168.1.198 Red1A6 R1A6 A6 Red1A6.Red1 R1A6.Red1 A6.Red1
+192.168.1.220 Red1B1 R1B1 Red1B1.Red1 R1B1.Red1
+192.168.1.221 Red1B5 R1B5 Red1B5.Red1 R1B5.Red1
+192.168.1.222 Red1R1 R1R1 R1 Red1R1.Red1 R1R1.Red1 R1.Red1
+
+# Red 2
+192.168.1.225 Red2B1 R2B1 B1 Red2B1.Red2 R2B1.Red2 B1.Red2
+192.168.1.226 Red2B2 R2B2 B2 Red2B2.Red2 R2B2.Red2 B2.Red2
+192.168.1.227 Red2B3 R2B3 B3 Red2B3.Red2 R2B3.Red2 B3.Red2
+192.168.1.228 Red2B4 R2B4 B4 Red2B4.Red2 R2B4.Red2 B4.Red2
+192.168.1.229 Red2B5 R2B5 B5 Red2B5.Red2 R2B5.Red2 B5.Red2
+192.168.1.230 Red2B6 R2B6 B6 Red2B6.Red2 R2B6.Red2 B6.Red2
+192.168.1.238 Red2C2 R2C2 Red2C2.Red2 R2C2.Red2
+
+# Red 3
+192.168.1.241 Red3C1 R3C1 C1 Red3C1.Red3 R3C1.Red3 C1.Red3
+192.168.1.242 Red3C2 R3C2 C2 Red3C2.Red3 R3C2.Red3 C2.Red3
+192.168.1.243 Red3C3 R3C3 C3 Red3C3.Red3 R3C3.Red3 C3.Red3
--- /dev/null
+===============================
+Sistemas Distribuidos I (75.74)
+===============================
+
+----------
+Práctica 1
+----------
+
+:Author: Leandro Lucarella (77891)
+
+1.1 Tabla de redes
+==================
+
+=== ========== ================ ============= ===============
+Red Nombre red Dirección de red Broadcast Máscara
+=== ========== ================ ============= ===============
+ 1 Red1 192.168.1.192 192.168.1.223 255.255.255.224
+ 2 Red2 192.168.1.224 192.168.1.239 255.255.255.240
+ 3 Red3 192.168.1.240 192.168.1.255 255.255.255.240
+=== ========== ================ ============= ===============
+
+1.2 Tabla de hosts
+==================
+
+============= ============== =====
+Dirección IP Nombre Oficial Alias
+============= ============== =====
+192.168.1.193 R1A1.Red1 A1
+192.168.1.194 R1A2.Red1 A2
+192.168.1.195 R1A3.Red1 A3
+192.168.1.196 R1A4.Red1 A4
+192.168.1.197 R1A5.Red1 A5
+192.168.1.198 R1A6.Red1 A6
+192.168.1.220 R1B1.Red1
+192.168.1.221 R1B5.Red1
+192.168.1.222 R1R1.Red1 R1
+192.168.1.225 R2B1.Red2 B1
+192.168.1.226 R2B2.Red2 B2
+192.168.1.227 R2B3.Red2 B3
+192.168.1.228 R2B4.Red2 B4
+192.168.1.229 R2B5.Red2 B5
+192.168.1.230 R2B6.Red2 B6
+192.168.1.238 R2C2.Red2
+192.168.1.241 R3C1.Red3 C1
+192.168.1.242 R3C2.Red3 C2
+192.168.1.243 R3C3.Red3 C3
+============= ============== =====
+
+1.3 Tablas de ruteo (3 redes)
+=============================
+
+Hosts A1 a A6
+-------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red1 255.255.255.224 0 eth0
+Red2 255.255.255.240 R1B1 1 eth0
+Red2 255.255.255.240 R1B5 1 eth0
+Red3 255.255.255.240 R1B1 2 eth0
+Red3 255.255.255.240 R1B5 2 eth0
+default 0.0.0.0 R1R1 0 eth0
+================ =============== ======= ======= ========
+
+Hosts B2, B3, B4 y B6
+---------------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red2 255.255.255.240 0 eth0
+Red1 255.255.255.224 R2B1 1 eth0
+Red1 255.255.255.224 R2B5 1 eth0
+Red3 255.255.255.240 R2C2 1 eth0
+default 0.0.0.0 R2B1 1 eth0
+default 0.0.0.0 R2B5 1 eth0
+================ =============== ======= ======= ========
+
+Hosts C1 y C3
+-------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red3 255.255.255.240 0 eth0
+Red1 255.255.255.224 R3C2 2 eth0
+Red2 255.255.255.240 R3C2 1 eth0
+default 0.0.0.0 R3C3 2 eth0
+================ =============== ======= ======= ========
+
+Host B1 (router)
+----------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red1 255.255.255.224 0 eth0
+Red1 255.255.255.224 R2B5 1 eth0:0
+Red2 255.255.255.240 0 eth0:0
+Red2 255.255.255.240 R1B5 1 eth0
+Red3 255.255.255.240 R2C2 1 eth0:0
+default 0.0.0.0 R1R1 0 eth0
+default 0.0.0.0 R2B5 1 eth0:0
+================ =============== ======= ======= ========
+
+Host B5 (router)
+----------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red1 255.255.255.224 0 eth0
+Red1 255.255.255.224 R2B1 1 eth0:0
+Red2 255.255.255.240 0 eth0:0
+Red2 255.255.255.240 R1B1 1 eth0
+Red3 255.255.255.240 R2C2 1 eth0:0
+default 0.0.0.0 R1R1 0 eth0
+default 0.0.0.0 R2B1 1 eth0:0
+================ =============== ======= ======= ========
+
+Host C3 (router)
+----------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red2 255.255.255.240 0 eth0
+Red3 255.255.255.240 0 eth0:0
+Red1 255.255.255.224 R2B1 1 eth0
+Red1 255.255.255.224 R2B5 1 eth0
+default 0.0.0.0 R2B1 1 eth0
+default 0.0.0.0 R2B5 1 eth0
+================ =============== ======= ======= ========
+
+Host R1 (router)
+----------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red1 255.255.255.224 0 eth0:0
+Red2 255.255.255.240 R1B1 1 eth0:0
+Red2 255.255.255.240 R1B5 1 eth0:0
+Red3 255.255.255.240 R1B1 2 eth0:0
+Red3 255.255.255.240 R1B5 2 eth0:0
+default 0.0.0.0 (INET) 0 eth0
+================ =============== ======= ======= ========
+
+
+1.4 Tablas de ruteo (1 red)
+===========================
+
+========== ================ ============= ===============
+Nombre red Dirección de red Broadcast Máscara
+========== ================ ============= ===============
+ Red 192.168.1.192 192.168.1.255 255.255.255.192
+========== ================ ============= ===============
+
+Hosts (todos menos R1)
+----------------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red 255.255.255.192 0 eth0
+default 0.0.0.0 R1R1 0 eth0
+================ =============== ======= ======= ========
+
+Host R1 (router)
+----------------
+
+================ =============== ======= ======= ========
+Dirección de red Máscara Gateway Métrica Interfaz
+================ =============== ======= ======= ========
+Red 255.255.255.192 0 eth0:0
+default 0.0.0.0 (INET) 0 eth0
+================ =============== ======= ======= ========
--- /dev/null
+#!/usr/bin/env python
+# vim: set et sw=4 sts=4 :
+
+import sys, os
+
+def get_campos(line):
+ r = []
+ for c in line.split('\t'):
+ r.append(c.strip('"\n'))
+ return r
+
+def parse(f):
+ hosts = {}
+ line = f.readline()
+ while line:
+ if line.startswith('"tabla de ruteo de '):
+ host = line[19:-7]
+ hosts[host] = {}
+ line = f.readline()
+ hosts[host]['ifaces'] = []
+ while line and line.strip() <> '"red"\t"ip"\t"mascara"\t"gateway"\t"interfaz"\t"metrica"':
+ if line.startswith('"'):
+ (iface, ip, mascara, broadcast, peer) = get_campos(line)[:5]
+ hosts[host]['ifaces'].append({
+ 'iface': iface,
+ 'ip': ip,
+ 'mascara': mascara,
+ 'broadcast': broadcast,
+ 'peer': peer,
+ })
+ line = f.readline()
+ line = f.readline()
+ hosts[host]['rutas'] = []
+ while line and line.strip() <> '"--"':
+ if line.startswith('"'):
+ (red, ip, mascara, gateway, iface, metrica) = get_campos(line)
+ if not metrica: metrica = "1"
+ hosts[host]['rutas'].append({
+ 'red': red,
+ 'ip': ip,
+ 'mascara': mascara,
+ 'gateway': gateway,
+ 'iface': iface,
+ 'metrica': metrica,
+ })
+ line = f.readline()
+ line = f.readline()
+ return hosts
+
+def up(host, fd):
+ os.system('cp /etc/hosts /etc/hosts.bak')
+ os.system('cp hosts /etc/hosts')
+ os.system('cp /etc/networks /etc/networks.bak')
+ os.system('cp networks /etc/networks')
+ hosts = parse(fd)
+ ppp = 0
+ for iface in hosts[host]['ifaces']:
+ if iface['iface'].startswith('ppp'):
+ if host == 'h131' or host == 'h118':
+ print 'UP: pppd -detach modem crtscts lock %(ip)s:%(peer)s /dev/ttyS0 9600' % iface
+ os.system('pppd -detach modem crtscts lock %(ip)s:%(peer)s /dev/ttyS0 9600 &' % iface)
+ else:
+ print 'UP: pppd -detach crtscts lock %(ip)s:%(peer)s /dev/ttyS0' % iface
+ os.system('pppd -detach crtscts lock %(ip)s:%(peer)s /dev/ttyS0 &' % iface)
+ ppp = 1
+ else:
+ print 'UP: ifconfig %(iface)s %(ip)s broadcast %(broadcast)s netmask %(mascara)s' % iface
+ os.system('ifconfig %(iface)s %(ip)s broadcast %(broadcast)s netmask %(mascara)s' % iface)
+ if ppp:
+ print 'while sleep 1; do if ping -c1 %(peer)s 2>&1 > /dev/null; then break; else echo Esperando link ppp...; fi; done' % iface
+ os.system('while sleep 1; do if ping -c1 %(peer)s 2>&1 > /dev/null; then break; else echo Esperando link ppp...; fi; done' % iface)
+ for ruta in hosts[host]['rutas']:
+ if ruta['metrica'] <> "0":
+ print 'UP: route add -net %(ip)s gw %(gateway)s netmask %(mascara)s dev %(iface)s metric %(metrica)s' % ruta
+ os.system('route add -net %(ip)s gw %(gateway)s netmask %(mascara)s dev %(iface)s metric %(metrica)s' % ruta)
+
+def down(host, fd):
+ hosts = parse(fd)
+ for iface in hosts[host]['ifaces']:
+ print 'DOWN: ifconfig %(iface)s down' % iface
+ if iface['iface'].startswith('ppp'):
+ os.system('killall pppd')
+ else:
+ os.system('ifconfig %(iface)s down' % iface)
+ os.system('mv /etc/hosts.bak /etc/hosts')
+ os.system('mv /etc/networks.bak /etc/networks')
+
+def list(fd):
+ hosts = parse(fd)
+ for host in hosts.keys():
+ print host
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print >>sys.stderr, 'Uso: %s [up|down] host' % sys.argv[0]
+ sys.exit(1)
+ fd = file('rutas.csv')
+ if sys.argv[1] == 'up':
+ up(sys.argv[2], fd)
+ elif sys.argv[1] == 'down':
+ down(sys.argv[2], fd)
+ elif sys.argv[1] == 'restart':
+ down(sys.argv[2], fd)
+ up(sys.argv[2], file('rutas.csv'))
+ elif sys.argv[1] == 'list':
+ list(fd)
+
--- /dev/null
+loopack 127.0.0.0
+Red1 192.168.1.192
+Red2 192.168.1.224
+Red3 192.168.1.240
+default 0.0.0.0
--- /dev/null
+"tabla de ruteo de A1"
+"eth0" "192.168.1.193" "255.255.255.224" "192.168.1.223"
+"red" "ip" "mascara" "gateway" "interfaz" "metrica"
+"Red1" "192.168.1.192" "255.255.255.224" "0.0.0.0" "eth0" "0"
+"Red2" "192.168.1.224" "255.255.255.240" "R1B1" "eth0" "1"
+"Red3" "192.168.1.240" "255.255.255.240" "R1B1" "eth0" "2"
+"Red2" "192.168.1.224" "255.255.255.240" "R1B5" "eth0" "1"
+"Red3" "192.168.1.240" "255.255.255.240" "R1B5" "eth0" "2"
+"default" "0.0.0.0" "0.0.0.0" "R1" "eth0" "1"
+"--"
+"tabla de ruteo de A2"
+"eth0" "192.168.1.194" "255.255.255.224" "192.168.1.223"
+"red" "ip" "mascara" "gateway" "interfaz" "metrica"
+"Red1" "192.168.1.192" "255.255.255.224" "0.0.0.0" "eth0" "0"
+"Red2" "192.168.1.224" "255.255.255.240" "R1B1" "eth0" "1"
+"Red3" "192.168.1.240" "255.255.255.240" "R1B1" "eth0" "2"
+"default" "0.0.0.0" "0.0.0.0" "R1" "eth0" "1"
+"--"
+"tabla de ruteo de A3"
+"eth0" "192.168.1.195" "255.255.255.224" "192.168.1.223"
+"red" "ip" "mascara" "gateway" "interfaz" "metrica"
+"Red1" "192.168.1.192" "255.255.255.224" "0.0.0.0" "eth0" "0"
+"Red2" "192.168.1.224" "255.255.255.240" "R1B1" "eth0" "1"
+"Red3" "192.168.1.240" "255.255.255.240" "R1B1" "eth0" "2"
+"Red2" "192.168.1.224" "255.255.255.240" "R1B5" "eth0" "1"
+"Red3" "192.168.1.240" "255.255.255.240" "R1B5" "eth0" "2"
+"default" "0.0.0.0" "0.0.0.0" "R1" "eth0" "1"
--- /dev/null
+<html lang=es>\r
+<head>\r
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">\r
+<title>Repaso de Concurrencia:</title>\r
+</head>\r
+\r
+<body>\r
+<h1 align="center">75.74 Sistemas Distribuidos I</h1>\r
+<h2>Repaso de Concurrencia:</h2><ol>\r
+<li><b>Exclusión Mutua:</b></li>\r
+<ol><li>Implemente el problema de los jardines o del museo usando solamente variables <i>(shared memory)</i> </li>\r
+<li>Ídem anterior con <i>semáforos</i></li>\r
+<li>Analice los problemas de entrelazado, interbloqueo (deadlock) y busy wait</li>\r
+</ol>\r
+<li>Sincronización:</li><ol>\r
+<li>usando <i>semáforos BINARIOS y shared memory</i></li><ol>\r
+<li>Implemente un esquema productor-consumidor.</li>\r
+<li>Extienda el problema anterior a 3 productores, donde cada uno produce un tercio de la información y 2 consumidores que consumen la totalidad y la misma información.</li></ol>\r
+<li>usando <i>colas de mensajes</i></li><ol>\r
+<li>Ídem 211</li>\r
+<li>Ídem 212</li></ol>\r
+<li>usando <i>pipes</i></li><ol>\r
+<li>Ídem 211</li>\r
+<li>Ídem 212</li></ol>\r
+<li>Explique\r
+las diferencias de sincronización, entrelazado e interbloqueo entre un\r
+productor consumidor del tipo del ejercicio 212 en cualquiera de sus tres\r
+variantes con 3 lectores y 2 escritores.<o:p></o:p></li></ol></ol>\r
+\r
+</body>\r
+\r
+</html>\r