Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Configuraci N de Redes Opt

Descargar como pdf o txt
Descargar como pdf o txt
Está en la página 1de 29

Clase-15: Configuración de

Redes

David Olivieri
ACSO Curso 2002-2003

ACSO 2002/2003 1
Introducción a redes TCP/IP para
Adminstración de sistemas
• Continuamos estudiando configuración básica de Redes
– Domain Name Server (DNS)
– Configuración del interfaz
– Configuración de resolución de nombres
– Configuración de Routing

ACSO 2002/2003 2
Nombres y Direcciones
• IP define nombres, direcciones y routes como:
– Un nombre indica que estamos buscando,
– Un dirección indica adonde esta.
– Un route indica como vamos a llegar a un sitio.

ACSO 2002/2003 3
Tabla de Host
• Un fichero simple que asocia direcciones IP con
hostnames.
– En sistemas Unix/Linux, la tabla esta en fichero /etc/hosts
– Cada entrada en /etc/hosts contiene una direccion de IP y el
hostname
# Table of IP addresses and hostnames
#
172.16.12.2 peanut.nuts.com peanut
127.0.0.1 localhost
172.16.12.1 almond.nuts.com almond loghost
172.16.12.4 walnut.nuts.com walnut
172.16.12.3 pecan.nuts.com pecan
172.16.1.2 filbert.nuts.com filbert
172.16.6.4 salt.plant.nuts.com salt.plant salt

ACSO 2002/2003 4
localhost
• El dirección loopback simplifica el software dejando
código común para estar usado para comunicar con los
procesos remotos o locales.
• Este direccionamiento reduce trafico de red porque la
dirección de los datos esta direccionado otro vez a
propio máquina y no en la red.

ACSO 2002/2003 5
Porque usar /etc/hosts cuando existe DNS

• Ventajes:
– muchos sistemas tiene tablas pequenas que contiene
servidores/hosts importantes cuando DNS no esta ejecutando.
– Utilizacion de NIS, NIS crea tablas de host
– redes local que no estan conectado al Internet utiliza tablas de host.
– Si hay poco que no cambiar frecuentamente, host tablas son útiles.
• Disventajes:
– o hay manera que un tabla simple puede dar servicio a numero de
servicios requerido de Internet
– no tiene un manera para automáticamente distribuir información de
nuevas hosts

ACSO 2002/2003 6
Domain Name Service:

• Domain Name System supera ambos desventajes de las


tablas host:

– DNS no depende en un tabla grande simple, es un base de


datos distrubuido que no crece demasiado (Hay mas que 16M
hosts, pero cada host table < 10k)
– DNS garantiza información de nuevas host esta enviada a todo
red cuando necesita

ACSO 2002/2003 7
DNS: Como funciona
• Si un servidor DNS recibe un request para información
de host que no tiene, se envía una petición a un servidor
authoritive
• Un servidor authorative es cualquier server responsable
para mantener información sobre un dominio queried
– cuando contesta el servidor authorative, el servidor local guarda
la respuesta (cache) para la siguiente vez
– la siguiente vez, el servidor local puede contesta

• DNS también substituya un servicio <named>; pero DNS


esta denominada named en muchos sistemas.

ACSO 2002/2003 8
Jerarquía Del Dominio
• DNS es un sistema distribuido con jerarquía para la
resolución de nombres a direcciones de IP.
– No hay un base de datos central
– DNS tiene un dominio raíz (root domain, como el sistema de
ficheros)
• Directamente abajo el dominio root son (top level
domains)
– Hay dos tipos de top-level domains - geographic and
organizational
• Abajo son dominios secundarios.

ACSO 2002/2003 9
/etc/resolv.conf
• Cuando haciendo resolución de nombres, muchos máquinas de
Unix chequear el fichero /etc/hosts y después con su servidor de
nombres.
• El fichero que indica la ubicación de su servicio de nombres es
/etc/resolv.conf.
– Un fichero de texto que contiene tres tipos de entradas.
– # comentarios
– Nombre de domino: define dominio por defecto
– Dirección de Nameserver: define una dirección IP del servidor
de nombres (es posible tener más que uno
domain ei.uvigo.es
nameserver 172.77.5.6
Ejemplo de /etc/resolv.conf
nameserver 172.77.1.1

ACSO 2002/2003 10
Encaminamiento: routing

• Como vemos antes, routing es como decide las


datagramas como buscar su destinación con muchos
posibilidades
• Simple routing:
– Muchas veces, la encaminamiento es muy sencillo porque esta
en la misma red: y solo tiene que ir al gateway

ACSO 2002/2003 11
Routing tables
• Routing is concerned with finding the right network for a
datagram. Once the right network has been found the
datagram can be delivered to the host.

• Most hosts (and gateways) on the Internet maintain a


routing table. The entries in the routing table contain the
information to know where to send datagrams for a
particular network.

ACSO 2002/2003 12
Configuring the device/interface

• ifconfig
• Network interfaces are configured using the ifconfig
command and has the standard format for turning a
device on
ifconfig device_name IP_address netmask netmask up

Ejemplos: ifconfig eth0 138.77.37.26 netmask 255.255.255.0 up


Configures the first ethernet address with the IP
address of 138.77.37.26 and the netmask of 255.255.255.0.

ifconfig lo 127.0.0.1
Configures the loopback address appropriately.

ACSO 2002/2003 13
Más sobre ifconfig

• Parametros de ifconfig
– up and down
These parameters are used to take the device up and down (turn
it on and off). ifconfig eth0 down will disable the eth0 interface
and will require an ifconfig command like the first example above
to turn it back on.
– arp
Will turn on/off the address resolution protocol for the specified
interface
– pointtopoint addr
Used to specify the IP address (addr) of the computer at the far
end of a point to point link.

ACSO 2002/2003 14
Configuring the name resolver
• Once the device/interface is configured you can start using the
network. However you'll only be able to use IP addresses

• This is where the name resolver and its associated configuration


files enter the picture. In particular the three files we'll be looking at
are
– /etc/resolv.conf
Specifies where the main domain name server is located for your
machine.
– /etc/hosts.conf
Allows you to specify how the name resolver will operate. For example,
will it ask the domain name server first or look at a local file.
– /etc/hosts
A local file which specifies the IP/hostname association between
common or local computers.

ACSO 2002/2003 15
/etc/host.conf

• The /etc/host.conf file is where you configure some items


that govern the behaviour of the name resolver code.

• The format of this file is described in detail in the `resolv'


man page. In nearly all circumstances the following
example will work for you:

Ejemplo de fichero order hosts,bind


/etc/host.conf multi on

ACSO 2002/2003 16
/etc/hosts

• The /etc/hosts file is where you put the name and IP


address of local hosts

# /etc/hosts
127.0.0.1 localhost loopback
192.168.0.1 this.host.name

ACSO 2002/2003 17
Configuring routing
• how does routing work ? Each host keeps a special list
of routing rules, called a routing table.
• This table contains rows which typically contain at least
three fields,
– destination address,
– the name of the interface to which the datagram is to be routed
– the IP address of another machine which will carry the datagram
on its next step through the network.

– # cat /proc/net/route
• or by using either of the following commands:
– # /sbin/route -n
– # /bin/netstat -r
ACSO 2002/2003 18
Process of Routing
• The routing process is fairly simple:
– an incoming datagram is received, the destination address (who
it is for) is examined and compared with each entry in the table.
– The entry that best matches that address is selected and the
datagram is forwarded to the specified interface.
– If the gateway field is filled then the datagram is forwarded to
that host via the specified interface, otherwise the destination
address is assumed to be on the network supported by the
interface.
• To manipulate this table a special command is used.
– This command takes command line arguments and converts
them into kernel system calls that request the kernel to add,
delete or modify entries in the routing table.
– The command is called `route'.

ACSO 2002/2003 19
Ejemplo:
• Given an ethernet network: You've been told it is a class-
C network with an address of 192.168.1.0. You've been
supplied with an IP address of 192.168.1.10 for your use
and have been told that 192.168.1.1 is a router
connected to the Internet.

• Paso 1. Configurar Interfaz


# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up

• Paso 2. Configurar routing


• # route add -net 192.168.1.0 netmask 255.255.255.0 eth0

ACSO 2002/2003 20
Default Gateways
• It would be a very difficult job to have to add routes to every possible
destination network, The trick is called the `default' route
• The default route matches every possible destination, but poorly, so
that if any other entry exists that matches the required address it will
be used instead of the default route.
– The idea of the default route is simply to enable you to say "and
everything else should go here".

# route add default gw 192.168.1.1 eth0


Complete Solution:

# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up


# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
# route add default gw 192.168.1.1 eth0

ACSO 2002/2003 21
Startup files
• On a normal Linux machine these steps are performed automatically in the
system startup files
– /etc/sysconfig/network
A text file which defines shell variables for hostname,
domain, gateway and gateway device.
– /etc/sysconfig/network-scripts
A collection of scripts used to perform common tasks
including bringing network interfaces up and down.
– /etc/rc.d/init.d/network
A shell script which actually brings up the networking
on startup. Linked to from a number of scripts in the
rcX.d directories.
ACSO 2002/2003 22
Network “management” tools
• Of particular interest to this chapter is the network configuration tool which
allows you to configure the hosts, name servers, devices and routing for
your system.

• nslookup
– The nslookup command is used to query a name server and is
supplied as a debugging tool. It is generally used to determine if
the name server is working correctly and for querying information
from remote servers.
– nslookup can be used from either the command line or
interactively. Giving nslookup a hostname will result in it asking
the current domain name server for the IP address of that
machine.
– nslookup also has an ls command that can be used to view the
entire records of the current domain name server.
ACSO 2002/2003 23
Ejemplo de nslookup
[david@cq-pan:~]$ nslookup
Default Server: pc1.uvigo.es
Address: 138.77.5.6

> jasper
Server: pc1.uvigo.es
Address: 138.77.5.6

Name: pc2.ei.uvigo.es
Address: 138.77.1.1

> exit
[david@cq-pan:~]$ nslookup jasper
Server: pc1.uvigo.es
Address: 138.77.5.6

ACSO 2002/2003 24
netstat
• The netstat command is used david@cq-pan:~]$ netstat -rn
Kernel routing table
to display the status of Destination Gateway Genmask Flags Metric Ref Use
network connections to a Iface
UNIX machine. 138.77.37.0 0.0.0.0 255.255.255.0 U 0 0 109130 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 9206 lo
• One of the functions it can be 0.0.0.0 138.77.37.1 0.0.0.0 UG 0 0 2546951 eth0
bash$ netstat -rn
used for is to display the Routing tables
contents of the kernel routing Destination Gateway Flags Refcnt Use Interface
table by using the -r switch. 127.0.0.1 127.0.0.1 UH 56 7804440 lo0
default 138.77.1.11 UG 23 1595585 ln0
138.77.32 138.77.1.11 UG 0 19621 ln0
138.77.16 138.77.1.11 UG 0 555 ln0
138.77.8 138.77.1.11 UG 0 385345 ln0
138.77.80 138.77.1.11 UG 0 0 ln0
138.77.72 138.77.1.11 UG 0 0 ln0
138.77.64 138.77.1.11 UG 0 0 ln0
138.77.41 138.77.1.11 UG 0 0 ln0

ACSO 2002/2003 25
traceroute
• For some reason or another, users on one machine
cannot connect to another machine or if they can any
information transfer between the two machines is either
slow or plagued by errors. What do you do?
• Remember it is not only the machines at the two ends
you have to check. If the two machines are on different
networks the information will flow through a number of
gateways and routers. It might be one of the gateway
machines that is causing the problem.
• The traceroute command provides a way of discovering
the path taken by information as it goes from one
machine to another and can be used to identify where
problems might be occurring. On the Internet that path
may not always be the same.

ACSO 2002/2003 26
Ejemplos de traceroute
• The following are the results of a number of executions of traceroute
from the machine aldur (138.77.36.29).
• In the first example the machine knuth is on the same network as
aldur. This means that the information can get their directly

bash$ traceroute knuth


traceroute to knuth.cqu.edu.au (138.77.36.20), 30 hops max, 40 byte packets
1 knuth.cqu.EDU.AU (138.77.36.20) 2 ms 2 ms 2 ms

jasper is one network away from aldur

ACSO 2002/2003 27
bash$ traceroute archie.au
traceroute to archie.au (139.130.23.2), 30 hops max, 40 byte packets
1 centaurus.cqu.EDU.AU (138.77.36.1) 1 ms 1 ms 1 ms
2 tucana.cqu.EDU.AU (138.77.5.27) 2 ms 2 ms 2 ms
3 138.77.32.10 (138.77.32.10) 5 ms 5 ms 5 ms
4 qld.gw.au (139.130.60.1) 21 ms 13 ms 51 ms
5 national.gw.au (139.130.48.1) 35 ms 36 ms 40 ms
6 plaza.aarnet.edu.au (139.130.23.2) 38 ms 35 ms 68 ms

ACSO 2002/2003 28
ACSO 2002/2003 29

También podría gustarte