Comandos Redes Linux

Embed Size (px)

DESCRIPTION

comandos linux

Citation preview

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    Comandos de redes en GNU/Linux

    Clemente Lopez Giner

    IES Serpis

    [email protected]

    12 de marzo de 2015

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    Indice

    1 Configurar la redroutedhclient

    2 Comprobaciones de la rednetstatping

    3 Herramientas de rednslookup

    4 whois5 Conexiones remotas

    telnetssh

    6 Transferencia de archivosremotos

    scpwgetrsync

    7 Gestion de interfaces de rednetworkingifup/ifdown/ifquery

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    routedhclient

    Comandos utiles: ifconfig

    ifconfig

    ifconfig configura una interfaz de red.

    ifconfig

    ifconfig [-v] [-a] [-s] [interface]

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

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    routedhclient

    Comandos utiles: ifconfig. Ejemplos

    Demostracion.

    Mostrar detalles de eth0:

    ifconfig eth0

    Mostrar detalles de todas las interfaces (includas las desactivadas):

    ifconfig -a

    Demostracion.

    Activar la interfaz eth0:

    ifconfig eth0 up

    Desactivar la interfaz eth0:

    ifconfig eth0 down

    Poner en modo promscuo eth0:

    ifconfig eth0 promisc

    Quitar el modo promscuo de eth0:

    ifconfig eth0 -promisc

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    routedhclient

    Comandos utiles: ifconfig. Ejemplos: configurar la IP

    Demostracion.

    ifconfig eth0 10.10.10.50

    ifconfig eth0 netmask 255.255.255.0

    ifconfig eth0 broadcast 10.10.10.255

    Demostracion.

    ifconfig eth0 10.10.10.50 netmask 255.255.255.0 broadcast 10.10.10.255

    Demostracion.

    ifconfig eth0 mtu 1500

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    routedhclient

    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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    routedhclient

    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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    routedhclient

    Comandos utiles: route

    route

    route muestra/manipula la tabla de enrutamiento IP.

    route

    route [-nNvee] [-FC] [] Muestra las tablas de ruteado del nucleo

    route [-v] [-FC] {add|del|flush} ... Modifica la tabla de ruteado para AF

    Parametros:

    v, verbose. Descripcion amplian, numeric. Muestra direcciones numericasen vez de determinar nombres de hosts

    e, extend. Muestra otra/mas informacion

    F, fib. Muestra la base de informacionhacia adelante (predeterminado)

    C, cache. Muestra la cache de enrutado envez de la FIB

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    routedhclient

    Comandos utiles: dhclient

    dhclient (Dynamic Host ConfigurationProtocol Client)

    dhclient proporciona un medio para configurar una o masinterfaces de red utilizando el Dynamic Host ConfigurationProtocol, protocolo BOOTP, o si estos protocolos fallan,mediante la asignacion de una direccion estatica.

    dhclient

    dhclient [ -4 | -6 ] [ -S ] [ -N [ -N... ] ] [ -T [ -T... ] ] [ -P [ -P... ] ]

    [ -D LL|LLT ] [ -p port ] [ -d ] [ -e VAR=value ] [ -q ] [ -1 ] [ -r | -x ]

    [ -lf lease-file ] [ -pf pid-file ] [ --no-pid ] [ -cf config-file ] [ -sf script-file ]

    [ -s server-addr ] [ -g relay ] [ -n ] [ -nw ] [ -w ] [ -v ] [ --version ] [ if0 [ ...ifN ] ]

    Ver manual.

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    netstatping

    Comandos utiles: netstat

    netstatnetstat muestra las conexiones de red, tablas de enrutamiento,estadsticas de interfaces, conexiones enmascaradas y membresasde 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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    netstatping

    Comandos utiles: netstat. Parametros (1/2)

    verbose , -v Tell the user what is going onby being verbose. Especially print some usefulinformation about unconfigured addressfamilies.wide , -W Do not truncate IP addresses byusing output as wide as needed. This isoptional for now to not break existing scripts.numeric , -n Show numerical addressesinstead of trying to determine symbolic host,port or user names.

    numeric-hosts shows numerical hostaddresses but does not affect the resolution ofport or user names.

    numeric-ports shows numerical portnumbers but does not affect the resolution ofhost or user names.

    numeric-users shows numerical user IDsbut does not affect the resolution of host orport names.

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    netstatping

    Comandos utiles: netstat. Parametros (2/2)

    protocol=family , -A Specifies the addressfamilies (perhaps better described as low levelprotocols) for which connections are to beshown. family is a comma (,) separated list ofaddress family keywords like inet, unix, ipx,ax25, netrom, and ddp. This has the sameeffect as using the inet, unix (-x),ipx, ax25, netrom, and ddpoptions. The address family inet includes raw,udp and tcp protocol sockets.

    c, continuous This will cause netstat toprint the selected information every secondcontinuously.

    e, extend Display additional information.Use this option twice for maximum detail.

    o, timers Include information related tonetworking timers.

    p, program Show the PID and name of theprogram to which each socket belongs.

    l, listening Show only listening sockets.(These are omitted by default.)

    a, all Show both listening and non-listeningsockets. With the interfaces option, showinterfaces that are not up

    F Print routing information from the FIB. (Thisis the default.)

    C Print routing information from the routecache.

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    netstatping

    Comandos utiles: netstat. ejemplos

    Demostracion.

    netstat -a

    netstat -l

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    netstatping

    Comandos utiles: ping

    ping

    ping enva la senal 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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    nslookup

    Comandos utiles: nslookup

    nslookup

    nslookup solicita interactivamente nombre de servidores deInternet.

    nslookup

    nslookup [-option] [name | -] [server]

    Ver el manual.

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    nslookup

    Comandos utiles: nslookup. Ejemplo

    Demostracion.

    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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion 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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    Comandos utiles: whois. ParametrosParametros:

    h HOST, host HOST connect to serverHOST

    p PORT, port PORT connect to PORTH hide legal disclaimers

    verbose explain what is being donel find the one level less specific match

    L find all levels less specific matches

    m find all one level more specific matches

    M find all levels of more specific matches

    c find the smallest match containing a mnt-irtattribute

    x exact match

    b return brief IP address ranges with abusecontact

    B turn off object filtering (show emailaddresses)

    G turn off grouping of associated objects

    d return DNS reverse delegation objects too

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

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

    K only primary keys are returned

    r turn off recursive look-ups for contactinformation

    R force to show local copy of the domainobject even if it contains referral

    a also search all the mirrored databases

    s SOURCE[,SOURCE]... search the databasemirrored from SOURCE

    g SOURCE:FIRST-LAST find updates fromSOURCE from serial FIRST to LAST

    t TYPE request template for object of TYPE

    v TYPE request verbose template for object ofTYPE

    q [version|sources|types] query specified serverinfo

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    telnetssh

    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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    telnetssh

    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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    scpwgetrsync

    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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    scpwgetrsync

    Comandos utiles: wget

    wget

    wget es una aplicacion no interactiva para descargar ficheros de lared.

    wget

    wget [OPCION]... [URL]...

    Ver el manual.

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    scpwgetrsync

    Comandos utiles: rsync

    rsyncrsync es una aplicacion rapida y versatil para copiar ficherosremotos 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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    networkingifup/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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    networkingifup/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 Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    networkingifup/ifdown/ifquery

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

    Parametros:

    a, all If given to ifup, affect all interfacesmarked auto. Interfaces are brought up in theorder in which they are defined in/etc/network/interfaces. Combined withallow, acts on all interfaces of a specifiedclass instead. If given to ifdown, affect alldefined interfaces. Interfaces are brought downin the order in which they are currently listed inthe state file. Only interfaces defined in/etc/network/interfaces will be brought down.force Force configuration ordeconfiguration of the interface.h, help Show summary of options.allow=CLASS Only allow interfaces listedin an allow-CLASS line in/etc/network/interfaces to be acted upon.

    i FILE, interfaces=FILE Read interfacedefinitions from FILE instead of from/etc/network/interfaces.

    X PATTERN, exclude=PATTERN Excludeinterfaces from the list of interfaces to operateon by the PATTERN. PATTERN uses a usualshell glob syntax. If shell wildcards are not used,it must match the exact interface name. Thisoption may be specified multiple times resultingin more than one pattern being excluded.

    o OPTION=VALUE Set OPTION to VALUEas though it were in /etc/network/interfaces.

    n, no-act Dont configure any interfaces orrun any up or down commands.

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    networkingifup/ifdown/ifquery

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

    Parametros:

    no-mappings Dont run any mappings. Seeinterfaces(5) for more information about themapping feature.

    no-scripts Dont run any scripts under/etc/network/if-.d/

    no-loopback Disable special handling of theloopback interface. By default, the loopbackinterface (lo on Linux) is predefined internallyas an auto interface, so its brought up on ifup-a automatically. In the case the loopbackdevice is redefined by user, the interface isconfigured just once anyway. If, however,another interface is also defined as loopback,its configured as usual. Specifying this optiondisables this behaviour, so the loopbackinterface wont be configured automatically.

    V, version Show copyright and versioninformation.

    v, verbose Show commands as they areexecuted.

    l, list For ifquery, list all the interfaceswhich match the specified class. If no classspecified, prints all the interfaces listed as auto.

    state For ifquery, dump the state of theinterfaces. When no interfaces specified, listsall interfaces brought up together with logicalinterfaces assigned to them and exits with astatus code indicating success. If one or moreinterfaces specified, display state of theseinterfaces only; successful code is returned if allof interfaces given as arguments are up.Otherwise, 0 is returned.

    Clemente Lopez Giner Comandos de redes en GNU/Linux

  • Configurar la redComprobaciones de la red

    Herramientas de redwhois

    Conexiones remotasTransferencia de archivos remotos

    Gestion de interfaces de red

    networkingifup/ifdown/ifquery

    Comandos utiles: ifup/ifdown/ifquery. Ejemplos

    Demostracion.

    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 logica home

    ifdown -a

    Tira todas las interfaces que actualmente estan 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 configuracion de ifupdown.

    Cada par clave-valor se muestra en una lnea individual usando ":" como separador

    Clemente Lopez Giner Comandos de redes en GNU/Linux

    Configurar la redroutedhclient

    Comprobaciones de la rednetstatping

    Herramientas de rednslookup

    whoisConexiones remotastelnetssh

    Transferencia de archivos remotosscpwgetrsync

    Gestin de interfaces de rednetworkingifup/ifdown/ifquery