En sistemas POSIX el comando arp solo puede ser utilizado por el administrador.
# arp
Address HWtype HWaddress Flags Mask Iface
maquina01.net2.upv.e ether 00:09:97:xx:xx:xx C eth1
maquina2.degi.upv.es ether 00:15:F2:xx:xx:xx C eth1
#
# arp -a
maquina01.net2.upv.es (158.42.222.x) at 00:09:97:xx:xx:xx [ether] on eth1
maquina2.degi.upv.es (158.42.222.x) at 00:15:F2:xx:xx:xx [ether] on eth1
#
# arp -n
Address HWtype HWaddress Flags Mask Iface
158.42.222.x ether 00:09:97:xx:xx:xx C eth1
158.42.222.x ether 00:15:F2:xx:xx:xx C eth1
W:\>arp -a
Interface: 158.42.222.x -- 0x50003
Internet Address Physical Address Type
158.42.222.x 00-09-97-xx-xx-xx dynamic
$ dig guimi.net
; <<>> DiG 9.3.4-P1.1 <<>> guimi.net
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62659
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;guimi.net. IN A
;; ANSWER SECTION:
guimi.net. 4345 IN A 212.36.74.190
;; Query time: 0 msec
;; SERVER: 158.42.250.65#53(158.42.250.65)
;; WHEN: Tue Oct 14 12:39:53 2008
;; MSG SIZE rcvd: 43
$ dig -x 212.36.74.190
-> permite hacer búsquedas inversas
$ host guimi.net
$ host -t MX guimi.net
$ host -a guimi.net
$ host 212.36.74.190
-> Respuestas similares a dig
Este comando permite mostrar información:
# ifconfig
eth1 Link encap:Ethernet HWaddr 00:17:9A:xx:xx:xx
inet addr:158.42.222.x Bcast:158.42.222.255 Mask:255.255.255.0
inet6 addr: fe80::217:9aff:fe39:xxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5563 errors:0 dropped:0 overruns:0 frame:0
TX packets:4135 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3408791 (3.2 MiB) TX bytes:743314 (725.8 KiB)
Interrupt:50 Base address:0xe400
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:229 errors:0 dropped:0 overruns:0 frame:0
TX packets:229 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:246518 (240.7 KiB) TX bytes:246518 (240.7 KiB)
# ifconfig eth0 10.0.0.3 netmask 255.0.0.0
Permite activar o desactivar una interfaz:
# ifconfig eth0 up / down
Los parámetros más interesantes son:
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : dominio.es
IP Address. . . . . . . . . . . . : 158.42.222.x
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 158.42.222.250
W:\>
W:\>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : maquina01
Primary Dns Suffix . . . . . . . : upvnet.upv.es
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : upv.es
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : upv.es
Description . . . . . . . . . . . : Marvell Yukon 88E8001/8003/8010 PCI Gigab
it Ethernet Controller
Physical Address. . . . . . . . . : 00-15-F2-xx-xx-xx
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 158.42.222.x
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 158.42.222.250
DHCP Server . . . . . . . . . . . : 158.42.xxx.x
DNS Servers . . . . . . . . . . . : 158.42.250.195
158.42.250.65
Primary WINS Server . . . . . . . : 158.42.250.200
Secondary WINS Server . . . . . . : 158.42.xxx.x
Lease Obtained. . . . . . . . . . : martes, 14 de octubre de 2008 9:22:53
Lease Expires . . . . . . . . . . : jueves, 16 de octubre de 2008 9:22:53
Los parámetros más interesantes son:
Doing NBT name scan for addresses from 158.42.222.x
IP address NetBIOS Name Server User MAC address
---------------------------------------
158.42.222.x MAQUINA01 <server> <unknown> 00:15:f2:xx:xx:xx
$
$ nbtscan -v 158.42.222.x
Doing NBT name scan for addresses from 158.42.222.x
NetBIOS Name Table for Host 158.42.222.x:
Name Service Type
--------------------
MAQUINA01 <00> UNIQUE
MAQUINA01 <20> UNIQUE
UPVNET <00> GROUP
UPVNET <1e> GROUP
UPVNET <1d> UNIQUE
__MSBROWSE__ <01> GROUP
Adapter address: 00:15:f2:xx:xx:xx
--------------------
$
$ nbtscan -vh 158.42.222.x
Doing NBT name scan for addresses from 158.42.222.x
NetBIOS Name Table for Host 158.42.222.x:
Name Service Type
--------------------
MAQUINA01 Workstation Service
MAQUINA01 File Server Service
UPVNET Domain Name
UPVNET Browser Service Elections
UPVNET Master Browser
__MSBROWSE__ Master Browser
Adapter address: 00:15:f2:xx:xx:xx
--------------------
Los parámetros más interesantes son:
Local Area Connection:
Node IpAddress: [158.42.222.x] Scope Id: []
NetBIOS Local Name Table
Name Type Status
-----------------------
MAQUINA01 <00> UNIQUE Registered
MAQUINA01 <20> UNIQUE Registered
UPVNET <00> GROUP Registered
UPVNET <1E> GROUP Registered
UPVNET <1D> UNIQUE Registered
..__MSBROWSE__.<01> GROUP Registered
W:\>nbtstat -c
Local Area Connection:
Node IpAddress: [158.42.222.x] Scope Id: []
NetBIOS Remote Cache Name Table
Name Type Host Address Life [sec]
------------------------------
TYNDAREUS <20> UNIQUE 158.42.250.x 587
JUNO.UPVNET.UPV<2E> UNIQUE 158.42.250.x 467
W:\>nbtstat -r
NetBIOS Names Resolution and Registration Statistics
--------------------------
Resolved By Broadcast = 0
Resolved By Name Server = 4608
Registered By Broadcast = 0
Registered By Name Server = 12
W:\>net
NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |
SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]
Algunos de los más interesantes son:
W:\>net share <- Permite ver y modificar los recursos compartidos del sistema
Share name Resource Remark
----------------------------------------
C$ C:\ Default share
ADMIN$ C:\WINDOWS Remote Admin
IPC$ Remote IPC
D$ D:\ Default share
The command completed successfully.
W:\>net use <- Permite ver y modificar las conexiones del sistema
New connections will be remembered.
Status Local Remote Network
----------------------------------------
OK W: \\maquina01\guimi Microsoft Windows Network
Disconnected X: \\maquina02\guimi Microsoft Windows Network
The command completed successfully.
W:\>net start/stop <- Permiten iniciar/parar o ver los servicios iniciados del sistema
These Windows services are started:
[...]
Workstation
The command completed successfully.
netdiag [/q] [/v] [/l] [/debug] [/d:nombreDeDominio] [/fix] [/dcaccountenum] [/test:nombreDePrueba] [/skip:nombreDePrueba]
Algunas pruebas interesantes son: Bindings, DcList, DefGw, DNS, IPSec, Kerberos, Route...
netdiag /test:ipsec
W:\>netsh
netsh>help
<- Se han eliminado la mayoría de lineas de ayuda ->
add - Adds a configuration entry to a list of entries.
firewall - Changes to the netsh firewall context.
interface - Changes to the netsh interface context.
show - Displays information.
The following sub-contexts are available:
aaaa bridge dhcp diag firewall interface ipsec ras routing rpc wins winsock
netsh>quit
En sistemas Windows los parámetros más interesantes son:
IPv4 Statistics
Packets Received = 31097937
[...]
Datagrams Successfully Fragmented = 0
Datagrams Failing Fragmentation = 0
Fragments Created = 0
ICMPv4 Statistics
[...]
TCP Statistics for IPv4
[...]
UDP Statistics for IPv4
[...]
W:\>netstat -e
Interface Statistics
Received Sent
Bytes 3987777529 651861703
Unicast packets 30617810 32440422
Non-unicast packets 136910 9869
Discards 0 0
Errors 0 0
Unknown protocols 26122
W:\>
W:\>netstat -ano
Active Connections
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 9924
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 784
TCP 0.0.0.0:389 0.0.0.0:0 LISTENING 1296
[...]
UDP 0.0.0.0:445 *:* 4
UDP 0.0.0.0:500 *:* 476
[...]
En sistemas POSIX los parámetros más interesantes son:
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost:2208 *:* LISTEN -
tcp 0 0 *:vmware-authd *:* LISTEN -
[...]
tcp6 0 0 *:www *:* LISTEN -
tcp6 0 0 *:ssh *:* LISTEN -
[...]
udp 0 0 *:sunrpc *:* -
udp 0 0 *:ipp *:* -
Además en sistemas POSIX netstat sustituye a nivel de usuario a otros comandos que son propios del superusuario. Por ejemplo route:
$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
158.42.xxx.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 158.42.xxx.250 0.0.0.0 UG 0 0 0 eth1
O ifconfig:
$ netstat -inet
Kernel Interface table
eth1 Link encap:Ethernet HWaddr 00:17:9A:xx:xx:xx
inet addr:158.42.xxx.x Bcast:158.42.xxx.255 Mask:255.255.255.0
inet6 addr: fe80::217:9aff:fe39:xxxx/64 Scope:Link
[...]
Ejemplos de uso:
$ nmap localhost <- Si no se indican puertos con -p analiza [0-1023]
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2008-10-17 14:34 CEST
Interesting ports on localhost (127.0.0.1):
Not shown: 1672 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
113/tcp open auth
631/tcp open ipp
902/tcp open iss-realsecure-sensor
3306/tcp open mysql
5432/tcp open postgres
nmap finished: 1 IP address (1 host up) scanned in 0.209 seconds$ nmap 192.168.1.1
$ nmap -sP xxx.xx.xxx.0/24 <- Busca e identifica equipos en la red
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2008-10-17 14:34 CEST
Host maquina01 (xxx.xx.xxx.1) appears to be up.
[...]
Nmap finished: 256 IP addresses (5 hosts up) scanned in 2.258 seconds
Ejemplo de uso interactivo:
W:\>nslookup
Default Server: juno.cc.upv.es <- Nos indica el servidor DNS
Address: 158.42.250.195
> guimi.net <- Consultamos un dominio
Server: juno.cc.upv.es
Address: 158.42.250.195
[...]
> set type=MX <- Consultamos un subconjunto de entradas DNS
<- Podemos indicar: any, MX, NS, CNAME, A, SOA
> guimi.net
[...]
>
> server 213.0.184.85 <- Cambiamos el servidor DNS de consulta
Default Server: 85.red-213-0-184.static.ccgg.telefonica.net
Address: 213.0.184.85
> exit <- Terminamos la utilidad nslookup
Ejemplos de uso no interactivo:
W:\>nslookup guimi.net
Server: juno.cc.upv.es
Address: 158.42.250.195
Non-authoritative answer:
Name: guimi.net
Address: 212.36.74.190
$ nslookup 212.36.74.190
Server: 158.42.250.65
Address: 158.42.250.65#53
Non-authoritative answer:
190.74.36.212.in-addr.arpa name = hc05.cdmon.com.
[...]
Los parámetros más interesantes son:
Usage: pathping [-g host-list] [-h maximum_hops] [-i address] [-n]
[-p period] [-q num_queries] [-w timeout]
[-4] [-6] target_name
Options:
-g host-list Loose source route along host-list.
-h maximum_hops Maximum number of hops to search for target.
-i address Use the specified source address.
-n Do not resolve addresses to hostnames.
-p period Wait period milliseconds between pings.
-q num_queries Number of queries per hop.
-w timeout Wait timeout milliseconds for each reply.
-4 Force using IPv4.
-6 Force using Ipv6.
W:\>pathping -n guimi.net
Tracing route to guimi.net [212.36.74.190]
over a maximum of 30 hops:
0 158.42.xxx.x
1 158.42.xxx.xx
[...]
8 212.36.74.190
Computing statistics for 200 seconds...
Source to Here This Node/Link
Hop RTT Lost/Sent = Pct Lost/Sent = Pct Address
0 158.42.xxx.x
0/ 100 = 0% |
1 0ms 0/ 100 = 0% 0/ 100 = 0% 158.42.xxx.xxx
0/ 100 = 0% |
[...]
8 7ms 0/ 100 = 0% 0/ 100 = 0% 212.36.74.190
Trace complete.
En sistemas Windows ``-n'' establece el número de paquetes a enviar (por omisión 4).
W:\>ping guimi.net -n 1
Pinging guimi.net [212.36.74.190] with 32 bytes of data:
Reply from 212.36.74.190: bytes=32 time=6ms TTL=57
Ping statistics for 212.36.74.190:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 6ms, Maximum = 6ms, Average = 6ms
En sistemas POSIX el parámetro ``-n'' (numbers) indica que no resuelva los nombres y muestre solo los números de la dirección y el parámetro ``-c'' establece el número de paquetes a enviar (por omisión infinitos).
$ ping guimi.net -c 1 -n
PING guimi.net (212.36.74.190) 56(84) bytes of data.
64 bytes from 212.36.74.190: icmp_seq=1 ttl=57 time=6.90 ms
-- guimi.net ping statistics --
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 6.904/6.904/6.904/0.000 ms
Ejemplos en un sistema POSIX (debe ejecutarse como superusuario):
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
158.42.xxx.0 * 255.255.255.0 U 0 0 0 eth1
default rou-aulasiqn.ne 0.0.0.0 UG 0 0 0 eth1
# route add -net 192.56.76.0 netmask 255.255.255.0 eth0
-> Indica que los paquetes enviados a la red 192.56.76.0/24 salgan por la interfaz eth0
# route add default gw migw
-> Establece como pasarela por defecto ``migw''
# route add -net 10.0.0.0 netmask 255.0.0.0 reject
-> Indica que se rechacen los paquetes con destino 10.0.0.0/8
Ejemplos en un sistema Windows:
W:\>route print
IPv4 Route Table
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x50003 ...00 15 f2 d0 0c b8 ...... Marvell Yukon 88E8001/8003/8010 PCI Gigabit
Ethernet Controller - Trend Micro Common Firewall Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 158.42.222.250 158.42.222.1 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
[...]
Default Gateway: 158.42.222.250
===========================================================================
Persistent Routes:
None
C:\> route ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2
destination^ ^mask ^gateway metric^ ^
Interface^
El parámetro ``-n'' (numbers) indica que no resuelva los nombres y muestre solo los números de la dirección.
$ traceroute guimi.net
traceroute to guimi.net (212.36.74.190), 30 hops max, 40 byte packets
1 rou-aulasiqn.net2.upv.es (158.42.222.250) 0.631 ms 0.527 ms 0.521 ms
2 cauac-1.net2.upv.es (158.42.254.94) 0.234 ms 0.205 ms 0.204 ms
3 kukulcan.net.upv.es (158.42.255.58) 0.613 ms 0.538 ms 0.683 ms
4 GE1-0-3.EB-Valencia0.red.rediris.es (130.206.211.153) 1.092 ms 1.011 ms 0.815 ms
5 VAL.XE0-0-0.EB-Barcelona0.red.rediris.es (130.206.250.45) 15.142 ms 11.206 ms 5.661 ms
6 adam.01.catnix.net (193.242.98.12) 7.375 ms 6.776 ms 6.758 ms
7 sw2pp-rc1-dc.adam.es (195.219.118.3) 6.883 ms 7.623 ms 8.799 ms
8 * * *
$ traceroute guimi.net -n -I
traceroute to guimi.net (212.36.74.190), 30 hops max, 40 byte packets
1 158.42.222.250 0.674 ms 0.511 ms 0.508 ms
2 158.42.254.94 8.106 ms 0.335 ms 0.212 ms
3 158.42.255.58 0.786 ms 0.485 ms 0.341 ms
4 130.206.211.153 0.802 ms 2.129 ms 15.974 ms
5 130.206.250.45 7.915 ms 7.992 ms 7.917 ms
6 193.242.98.12 8.017 ms 9.086 ms 14.754 ms
7 195.219.118.3 8.104 ms 9.810 ms 6.707 ms
8 212.36.74.190 7.284 ms 6.463 ms 6.530 ms
W:\>tracert
Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name
Options:
-d Do not resolve addresses to hostnames.
-h maximum_hops Maximum number of hops to search for target.
-j host-list Loose source route along host-list (IPv4-only).
-w timeout Wait timeout milliseconds for each reply.
-R Trace round-trip path (IPv6-only).
-S srcaddr Source address to use (IPv6-only).
-4 Force using IPv4.
-6 Force using IPv6.
W:\>tracert guimi.net
Tracing route to guimi.net [212.36.74.190] over a maximum of 30 hops:
[...]
6 8 ms 7 ms 7 ms adam.01.catnix.net [193.242.98.12]
7 7 ms 7 ms 6 ms sw2pp-rc1-dc.adam.es [195.219.118.3]
8 6 ms 6 ms 6 ms hc05.cdmon.com [212.36.74.190]
Trace complete.
2009-05 Güimi (http://guimi.net) Está permitido copiar, distribuir y/o modificar los documentos bajo los términos de la licencia "Reconocimiento-Compartir bajo la misma licencia 3.0 España" de Creative Commons. Puede ver una copia de esta licencia completa. |