Вы находитесь на странице: 1из 28

Configurar la red

Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

Comandos de redes en GNU/Linux


Clemente L
opez Giner
IES Serpis
clemente.lopez@institutoserpis.org

12 de marzo de 2015

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

Indice

4
5

Configurar la red
route
dhclient
Comprobaciones de la red
netstat
ping
Herramientas de red
nslookup
whois
Conexiones remotas

Clemente L
opez Giner

telnet
ssh
Transferencia de archivos
remotos
scp
wget
rsync
Gesti
on de interfaces de red
networking
ifup/ifdown/ifquery

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

route
dhclient

Comandos utiles: ifconfig

ifconfig
ifconfig configura una interfaz de red.

ifconfig
ifconfig [-v] [-a] [-s] [interface]
ifconfig [-v] interface [aftype] options | address ...

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

route
dhclient

Comandos utiles: ifconfig. Ejemplos


Demostraci
on.
Mostrar detalles de eth0:
ifconfig eth0
Mostrar detalles de todas las interfaces (inclu
das las desactivadas):
ifconfig -a

Demostraci
on.
Activar la interfaz eth0:
ifconfig eth0 up
Desactivar la interfaz eth0:
ifconfig eth0 down
Poner en modo prom
scuo eth0:
ifconfig eth0 promisc
Quitar el modo prom
scuo de eth0:
ifconfig eth0 -promisc

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

route
dhclient

Comandos utiles: ifconfig. Ejemplos: configurar la IP


Demostraci
on.
ifconfig eth0 10.10.10.50
ifconfig eth0 netmask 255.255.255.0
ifconfig eth0 broadcast 10.10.10.255

Demostraci
on.
ifconfig eth0 10.10.10.50 netmask 255.255.255.0 broadcast 10.10.10.255

Demostraci
on.
ifconfig eth0 mtu 1500

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

route
dhclient

Configurando la red desde un fichero. . .

/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.28.12.120
netmask 255.255.255.0
network 172.28.12.0
broadcast 172.28.12.255
gateway 172.28.12.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

route
dhclient

Comandos utiles: iwconfig

iwconfig
iwconfig configura una interfaz de red inalambrica.
iwconfig
iwconfig [interface]
iwconfig interface [essid X] [nwid N] [mode M] [freq F]
[channel C][sens S ][ap A ][nick NN ]
[rate R] [rts RT] [frag FT] [txpower T]
[enc E] [key K] [power P] [retry R]
[modu M] [commit]

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

route
dhclient

Comandos utiles: route

route
route muestra/manipula la tabla de enrutamiento IP.
route
route [-nNvee] [-FC] [<AF>]
route [-v] [-FC] {add|del|flush} ...

Muestra las tablas de ruteado del n


ucleo
Modifica la tabla de ruteado para AF

Par
ametros:
v, verbose. Descripci
on amplia
n, numeric. Muestra direcciones num
ericas
en vez de determinar nombres de hosts
e, extend. Muestra otra/m
as informaci
on

Clemente L
opez Giner

F, fib. Muestra la base de informaci


on
hacia adelante (predeterminado)
C, cache. Muestra la cach
e de enrutado en
vez de la FIB

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

route
dhclient

Comandos utiles: dhclient

dhclient (Dynamic Host Configuration


Protocol Client)
dhclient proporciona un medio para configurar una o mas
interfaces de red utilizando el Dynamic Host Configuration
Protocol, protocolo BOOTP, o si estos protocolos fallan,
mediante la asignacion de una direcci
on estatica.
dhclient
dhclient [ -4 | -6 ]
[ -D LL|LLT ] [ -p
[ -lf lease-file ]
[ -s server-addr ]

[ -S ] [ -N [ -N... ] ] [ -T [ -T... ] ] [ -P [ -P... ] ]


port ] [ -d ] [ -e VAR=value ] [ -q ] [ -1 ] [ -r | -x ]
[ -pf pid-file ] [ --no-pid ] [ -cf config-file ] [ -sf script-file ]
[ -g relay ] [ -n ] [ -nw ] [ -w ] [ -v ] [ --version ] [ if0 [ ...ifN ] ]

Ver manual.
Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

netstat
ping

Comandos utiles: netstat

netstat
netstat muestra las conexiones de red, tablas de enrutamiento,
estadsticas de interfaces, conexiones enmascaradas y membresas
de multidifusion.
netstat
netstat [address_family_options] [--tcp|-t] [--udp|-u] [--raw|-w] [--listening|-l] [--all|-a]
[--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--symbolic|-N]
[--extend|-e[--extend|-e]] [--timers|-o] [--program|-p] [--verbose|-v] [--continuous|-c]
netstat {--route|-r} [address_family_options] [--extend|-e[--extend|-e]] [--verbose|-v]
[--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--interfaces|-i} [--all|-a] [--extend|-e[--extend|-e]] [--verbose|-v] [--program|-p]
[--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c]
netstat {--groups|-g} [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users]
[--continuous|-c]
netstat {--masquerade|-M} [--extend|-e] [--numeric|-n] [--numeric-hosts] [--numeric-ports]
[--numeric-users] [--continuous|-c]
netstat {--statistics|-s} [--tcp|-t] [--udp|-u] [--raw|-w]

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

netstat
ping

Comandos utiles: netstat. Parametros (1/2)

verbose , -v Tell the user what is going on


by being verbose. Especially print some useful
information about unconfigured address
families.
wide , -W Do not truncate IP addresses by
using output as wide as needed. This is
optional for now to not break existing scripts.
numeric , -n Show numerical addresses
instead of trying to determine symbolic host,
port or user names.

Clemente L
opez Giner

numeric-hosts shows numerical host


addresses but does not affect the resolution of
port or user names.
numeric-ports shows numerical port
numbers but does not affect the resolution of
host or user names.
numeric-users shows numerical user IDs
but does not affect the resolution of host or
port names.

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

netstat
ping

Comandos utiles: netstat. Parametros (2/2)

protocol=family , -A Specifies the address


families (perhaps better described as low level
protocols) for which connections are to be
shown. family is a comma (,) separated list of
address family keywords like inet, unix, ipx,
ax25, netrom, and ddp. This has the same
effect as using the inet, unix (-x),
ipx, ax25, netrom, and ddp
options. The address family inet includes raw,
udp and tcp protocol sockets.
c, continuous This will cause netstat to
print the selected information every second
continuously.
e, extend Display additional information.
Use this option twice for maximum detail.

Clemente L
opez Giner

o, timers Include information related to


networking timers.
p, program Show the PID and name of the
program to which each socket belongs.
l, listening Show only listening sockets.
(These are omitted by default.)
a, all Show both listening and non-listening
sockets. With the interfaces option, show
interfaces that are not up
F Print routing information from the FIB. (This
is the default.)
C Print routing information from the route
cache.

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

netstat
ping

Comandos utiles: netstat. ejemplos

Demostraci
on.
netstat -a
netstat -l

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

netstat
ping

Comandos utiles: ping

ping
ping enva la se
nal ICMP ECHO REQUEST a un host en red.
ping
ping [-aAbBdDfhLnOqrRUvV] [-c count] [-F flowlabel] [-i interval] [-I interface] [-l preload]
[-m mark] [-M pmtudisc_option] [-N nodeinfo_option] [-w deadline] [-W timeout] [-p pattern]
[-Q tos] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp option] [hop ...] destination

Ver el manual.
Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

nslookup

Comandos utiles: nslookup

nslookup
nslookup solicita interactivamente nombre de servidores de
Internet.
nslookup
nslookup [-option] [name | -] [server]

Ver el manual.
Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

nslookup

Comandos utiles: nslookup. Ejemplo

Demostraci
on.
nslookup
nslookup frabits.com
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: frabits.com
Address: 82.98.160.80

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

Comandos utiles: whois

whois
whois es un cliente para el servicio de directorios whois.
whois
whois [ { -h | --host } HOST ] [ { -p | --port } PORT ] [ -abBcdGHKlLmMrRx ]
[ -g SOURCE:FIRST-LAST ] [ -i ATTR[,ATTR]... ] [ -s SOURCE[,SOURCE]... ]
[ -T TYPE[,TYPE]... ] [ --verbose ] OBJECT
whois -q KEYWORD
whois -t TYPE
whois -v TYPE

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

Comandos utiles: whois. Parametros


Par
ametros:
h HOST, host HOST connect to server
HOST

i ATTR[,ATTR]... do an inverse look-up for


specified ATTRibutes

p PORT, port PORT connect to PORT


H hide legal disclaimers

T TYPE[,TYPE]... only look for objects of


TYPE

verbose explain what is being done

K only primary keys are returned

l find the one level less specific match

r turn off recursive look-ups for contact


information

L find all levels less specific matches


m find all one level more specific matches

R force to show local copy of the domain


object even if it contains referral

M find all levels of more specific matches

a also search all the mirrored databases

c find the smallest match containing a mnt-irt


attribute

s SOURCE[,SOURCE]... search the database


mirrored from SOURCE

x exact match

g SOURCE:FIRST-LAST find updates from


SOURCE from serial FIRST to LAST

b return brief IP address ranges with abuse


contact

t TYPE request template for object of TYPE

B turn off object filtering (show email


addresses)

v TYPE request verbose template for object of


TYPE

G turn off grouping of associated objects

q [version|sources|types] query specified server


info

d return DNS reverse delegation objects too


Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

telnet
ssh

Comandos utiles: telnet

telnet
telnet interfaz de usuario para el protocolo TELNET.
telnet
telnet [-468ELadr] [-S tos] [-b address] [-e escapechar] [-l user] [-n tracefile] [host [port]]

Ver el manual.

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

telnet
ssh

Comandos utiles: ssh

ssh
ssh cliente de OpenSSH (programa de inicio de sesion remoto).
ssh
ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
[-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec] [-O ctl_cmd]
[-o option] [-p port] [-Q cipher | cipher-auth | mac | kex | key]
[-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] [user@]hostname [command]

Ver el manual.
Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

scp
wget
rsync

Comandos utiles: scp

scp
scp es una aplicacion para copia segura de ficheros remotos.
Similar a cp, pero usando ssh.
scp
scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2

Ver el manual.
Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

scp
wget
rsync

Comandos utiles: wget

wget
wget es una aplicacion no interactiva para descargar ficheros de la
red.
wget
wget [OPCI
ON]... [URL]...

Ver el manual.
Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

scp
wget
rsync

Comandos utiles: rsync

rsync
rsync es una aplicacion rapida y versatil para copiar ficheros
remotos o locales.
wget
Local: rsync [OPTION...] SRC... [DEST]
Access via remote shell:
Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOST:DEST
Access via rsync daemon:
Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST

Ver el manual.
Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

networking
ifup/ifdown/ifquery

Comandos utiles: /etc/init.d/networking

/etc/init.d/networking
/etc/init.d/networking gestiona los servicios de red.
/etc/init.d/networking
Inicia los servicios de red:
/etc/init.d/networking start

(service networking start)

Reinicia los servicios de red:


/etc/init.d/networking restart (service networking restart)
Detiene los servicios de red:
/etc/init.d/networking stop

(service networking stop)

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

networking
ifup/ifdown/ifquery

Comandos utiles: ifup/ifdown/ifquery

ifup/ifdown/ifquery
ifup/ifdown/ifquery levanta/para/analiza una interfaz de red.
ifup/ifdown/ifquery
ifup [-nv] [--no-act] [--verbose] [-i FILE|--interfaces=FILE] [--allow CLASS] -a|IFACE...
ifdown [-nv] [--no-act] [--verbose] [-i FILE|--interfaces=FILE] [--allow CLASS] -a|IFACE...
ifquery [-nv] [--no-act] [--verbose] [-i FILE|--interfaces=FILE] [--allow CLASS] -a|IFACE...
ifquery -l|--list [-nv] [--no-act] [--verbose] [-i FILE|--interfaces=FILE] [--allow CLASS] -a|IFACE...
ifquery --state [IFACE...]

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

networking
ifup/ifdown/ifquery

Comandos utiles: ifup/ifdown/ifquery. Parametros (1/2)


Par
ametros:
a, all If given to ifup, affect all interfaces
marked auto. Interfaces are brought up in the
order in which they are defined in
/etc/network/interfaces. Combined with
allow, acts on all interfaces of a specified
class instead. If given to ifdown, affect all
defined interfaces. Interfaces are brought down
in the order in which they are currently listed in
the state file. Only interfaces defined in
/etc/network/interfaces will be brought down.
force Force configuration or
deconfiguration of the interface.
h, help Show summary of options.
allow=CLASS Only allow interfaces listed
in an allow-CLASS line in
/etc/network/interfaces to be acted upon.

Clemente L
opez Giner

i FILE, interfaces=FILE Read interface


definitions from FILE instead of from
/etc/network/interfaces.
X PATTERN, exclude=PATTERN Exclude
interfaces from the list of interfaces to operate
on by the PATTERN. PATTERN uses a usual
shell glob syntax. If shell wildcards are not used,
it must match the exact interface name. This
option may be specified multiple times resulting
in more than one pattern being excluded.
o OPTION=VALUE Set OPTION to VALUE
as though it were in /etc/network/interfaces.
n, no-act Dont configure any interfaces or
run any up or down commands.

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

networking
ifup/ifdown/ifquery

Comandos utiles: ifup/ifdown/ifquery. Parametros (2/2)


Par
ametros:
no-mappings Dont run any mappings. See
interfaces(5) for more information about the
mapping feature.
no-scripts Dont run any scripts under
/etc/network/if-.d/
no-loopback Disable special handling of the
loopback interface. By default, the loopback
interface (lo on Linux) is predefined internally
as an auto interface, so its brought up on ifup
-a automatically. In the case the loopback
device is redefined by user, the interface is
configured just once anyway. If, however,
another interface is also defined as loopback,
its configured as usual. Specifying this option
disables this behaviour, so the loopback
interface wont be configured automatically.

Clemente L
opez Giner

V, version Show copyright and version


information.
v, verbose Show commands as they are
executed.
l, list For ifquery, list all the interfaces
which match the specified class. If no class
specified, prints all the interfaces listed as auto.
state For ifquery, dump the state of the
interfaces. When no interfaces specified, lists
all interfaces brought up together with logical
interfaces assigned to them and exits with a
status code indicating success. If one or more
interfaces specified, display state of these
interfaces only; successful code is returned if all
of interfaces given as arguments are up.
Otherwise, 0 is returned.

Comandos de redes en GNU/Linux

Configurar la red
Comprobaciones de la red
Herramientas de red
whois
Conexiones remotas
Transferencia de archivos remotos
Gesti
on de interfaces de red

networking
ifup/ifdown/ifquery

Comandos utiles: ifup/ifdown/ifquery. Ejemplos


Demostraci
on.
ifup/ifdown/ifquery
ifup -a
Levanta todas las interfaces de red definicas con auto en /etc/network/interfaces
ifup eth0
Levanta la interfaz de red eth0
ifup eth0=home
Levanta la interfaz de red eth0 como la interfaz l
ogica home
ifdown -a
Tira todas las interfaces que actualmente est
an levantadas
ifquery -l
Muestra los nombres de todas las interfaces especificadas con la palabra clave auto
ifquery -l --allow=hotplug
Muestra los nombres de todas las interfaces especificadas con la palabra clave allow-hotplug
ifquery eth0
Muestra las opciones de interfaz como se especifica en la configuraci
on de ifupdown.
Cada par clave-valor se muestra en una l
nea individual usando ":" como separador

Clemente L
opez Giner

Comandos de redes en GNU/Linux

Вам также может понравиться