Академический Документы
Профессиональный Документы
Культура Документы
Contenido
Vamos
a configurar las
interfaces y ruta de esta red
IP.
Los
comandos
de
configuracin indicados son
vlidos para cualquier sistema
Unix.
Interfaces
Configuracin de la Interfaz I
Vamos a empezar la configuracin de Alice.
Si desea eliminar cualquier @ IP configurada previamente en una interfaz:
alice:~# ifconfig 0.0.0.0 eth0
alice:~# ifconfig
eth0
Link encap:Ethernet
HWaddr fe:fd:00:00:01:00
inet6 addr: fe80::fcfd:ff:feOO:100/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:27 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3582 (3.4 KiB) TX bytes:468 (468.0 B)
Interrupt:5
lo
Link encap:Local Loopback
inet addr:127.0.0.1
Mask:255.0.0.0
inet6 addr:
::1/128 Scope:Host
UP LOOPBACK RUNNING
MTU:16436 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:660 (660.0 B)
TX bytes:660 (660.0 B)
alice:~# route -n
Kernel IP routing table
Destination Gateway Genmask
Use Iface
Configuracin de la Interfaz II
Vamos a configurar una direccin IP y una mscara para
eth 0 de Alice:
Use Iface
0
eth0
phyhost
tiene interfaces
SWX
en el
escenario.
Hagamos un
ping a Bob:
Las medias de los errores previos que existen no tienen ninguna entrada vlida en la tabla
de enrutamiento de alice para la direccin IP de destino.
t ap 0 .
route
route
es la siguiente:
MASK [gw
@IP
dev
IF]
Configuracin de Rutas II
Podemos aadir entradas de enrutamiento para hosts con la opcin
host .
Una ruta de host es la entrada ms especfica que puede ser utilizado desde que el destino
debe coincidir completamente con los 32 bits de la entrada de enrutamiento.
Use Iface
0
eth0
0
eth0
10.0.0.202
10.0.0.128/26 gw 10.0.0.31
Genmask
255.255.255.192
255.255.255.192
Use Iface
0
eth0
0
eth0
10.0.0.0
0.0.0.0
255.255.255.128
eth0
Metric
0
0
0
0
Ref
0
0
0
0
Use
0
0
0
0
Iface
eth0
eth0
eth0
eth0
Observe que r1 es el nico nodo que puede ser usado por alice para enviar su trfico
indirecta.
As, podemos eliminar las rutas indirectas anteriores y aadir una ruta por defecto:
alice:~# route del -host 10.0.0.140
alice:-# route del -net 10.0.0.128/26
alice:-# route del -net 10.0.0.192/26
alice:~# route add default gw 10.0.0.31
alice:~# route -n
Kernel IP routing table
Destination Gateway
Genmask
10.0.0.0
0.0.0.0
255.255.255.128
0.0.0.0
10.0.0.31
0.0.0.0
Use Iface
0
eth0
0
eth0
Configuracin de r1 I
Vamos a configurar
Configuracin de r1 II
Ahora, vamos a configurar eth1 en
Ref
0
0
0
Use Iface
0
ethl
0
ethl
0
eth0
et0
r2
de
Configuracin de r2 I
Si tratamos el
ping de nuevo:
Ahora configuremos
et 1
de
r2
ping :
Configuracin de bob I
Vamos a configurar
eth 0 de bob
bytes of data.
alice :
Iface
eth0
ethl
eth0
time 0ms
1 packets transmitted,
0 received,
time 0ms
Iface
eth0
eth0
ping funciona!
Configuracin de bob II
Pero un ping desde
r1 a bob
no funciona.
b ob
time 0ms
Metric
0
0
0
Ref
0
0
0
Use
0
0
0
Iface
ethO
ethO
ethO
ifconfig .
Sin embargo, podemos quitar y aadir rutas directas tambin con el comando
route .
r1 .
Use
0
0
Iface
ethl
ethl
eth0
de
r1
Cuando intentamos un
mensaje
echorequest
ping
cruza
desde
alice
bob
se observar en
tap2
que el
r1
genera
r1 .
echoreplay
no se puede enviar a
alice
destination unreachable .
Genmask
255.255.255.252
255.255.255.192
Use Iface
0
eth1
0
eth1
Genmask
255.255.255.252
255.255.255.192
255.255.255.128
Flags
U
UG
U
dev
y la opcin
r1:~# route -n
Kernel IP routing table
Destination
Gateway
Genmask
192.168.0.0
0.0.0.0
255.255.255.252
10.0.0.192
192.168.0.2 255.255.255.192
10.0.0.0
0.0.0.0
255.255.255.128
r1:~# route del -net 192.168.0.0/30
r1:~# route -n
Kernel IP routing table
Destination
Gateway
Genmask
10.0.0.192
192.168.0.2 255.255.255.192
10.0.0.0
0.0.0.0
255.255.255.128
r1:~# ifconfig eth1 down
r1:~# ifconfig eth1
eth1
Link
route
Flags
U
UG
U0
Flags
UG
U0
encap:Ethernet
HWaddr fe:fd:00:00:02:01
inet addr:192.168.0.1
Beast:192.168.0.3
BROADCAST PROMISC MULTICAST
MTU:1500
RX packets:47 errors:0 dropped:0 overruns:0
TX packets:30 errors:0 dropped:0 overruns:0
collisions:0 txqueuelen:1000
RX bytes:3460 (3.3 KiB) TX bytes:2200 (2.1
Interrupt:5
Metric
0
0
0
Mask:255.255.255.252
Metric:1
frame:0
carrier:0
KiB)
Iface
eth0
Ref
0
0
Use
0
0
Iface
eth1
eth1
10.0.0.0
0.0.0.0
255.255.255.128
r1:~# route del -net 192.168.0.0/30
r1:~# route -n
Kernel IP routing table
Destination Gateway
Genmask
10.0.0.192 192.168.0.2
255.255.255.192
10.0.0.0
0.0.0.0
255.255.255.128
r1:-# route add -net 192.168.0.0/30 dev eth1
r1:-# route -n
Kernel IP routing table
Destination Gateway
Genmask
192.168.0.0 0.0.0.0
255.255.255.252
10.0.0.192
192.168.0.2 255.255.255.192
10.0.0.0
0.0.0.0
255.255.255.128
Flags Metric
UG
0
U
0
Flags
U
UG
U
Metric
0
0
0
Ref
0
0
Use
0
0
Ref
0
0
0
Use
0
0
0
eth0
Iface
eth1
eth0
Iface
eth1
eth1
eth0
Finalizamos la configuracin del escenario con el menor nmero de entradas posible en las
tablas de enrutamiento (use la coincidencia ms larga) y haga que las rutas por defecto
apunten a Internet.