Академический Документы
Профессиональный Документы
Культура Документы
ifconfig:
route:
netstat:
Comando ifconfig
$ /sbin/ifconfig eth0
eth0
Link encap:Ethernet HWaddr 00:12:43:A6:05:5C
inet addr:193.144.84.77 Bcast:193.144.84.255
Mask:255.255.255.0
inet6 addr: fe80::211:43ff:fea6:55c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1035446 errors:0 dropped:0 overruns:0 frame:0
TX packets:1053062 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:196973192 (187.8 MiB) TX bytes:270128587 (257.6 MiB)
Interrupt:169
Sintaxis:
ifconfig [opciones] [interfaz]
ifconfig interfaz [configuracin] [up|down]
Opciones de visualizacin:
o
-a
-s
-i)
ifup/ifdown
# ifdown eth0
iwconfig
ip
Comando route
Se usa route
(equivale a netstat
[-n -e -ee]
$ /sbin/route -n -ee
Kernel IP routing table
Destination
Gateway
Iface
MSS
Window irtt
193.144.84.0
0.0.0.0
eth0
0
0
0
0.0.0.0
193.144.84.1
eth0
0
0
0
-r
Genmask
Use
255.255.255.0
0.0.0.0
UG
Opciones:
o
-n
-e
-ee
-r
salida larga
ruta rehabilitada
ruta rechazada
Metric
Ref
Use
MSS
Window
irtt
Se usa
Aadir una ruta para la red 172.16.0.0/24, usando como pasarela en host
con IP 192.168.0.1
route add -net 172.16.0.0 netmask 255.255.255.0 gw 192.168.0.1
El host pasarela tiene que permitir routing entre sus interfaces; pasa eso
debemos activar el ip_forward:
Opciones del IP
ip_forward
ip_default_ttl
defecto 64 ms)
Informacin de la red: comando netstat
Formato:
netstat [tipo
de informacin] [opciones]
$ netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address
Foreign Address
State
tcp
0
0
jumilla.dec.usc.e:58946 aiff.usc.es:telnet
ESTABLISHED
tcp
0
0
jumilla.dec.usc.e:43658 ulla.dec.usc.es:1301
ESTABLISHED
tcp
0
0
jumilla.dec.usc.e:35346 sd.cesga.es:ssh
ESTABLISHED
tcp
0
0
jumilla.dec.usc.es:ssh ulla.dec.usc.es:1688
ESTABLISHED
tcp
0
0
jumilla.dec.usc.es:ssh teneguia.dec.usc.:35161
ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags
Type
State
I-Node Path
unix 8
[ ]
DGRAM
15368
/dev/log
unix 2
[ ]
DGRAM
194110
@/org/kernel/udev/udevd
unix 2
[ ]
DGRAM
15671
@/var/run/hal/hotplug_socket
--route, -r
--interface, -i
o
o
$ netstat -i
Kernel Interface table
o
o
Iface
MTU Met
RX-OK RX-ERR RX-DRP RX-OVR
TX-DRP TX-OVR Flg
eth0
1500 0
5110292
0
0
0
0
0 BMRU
TX-OK TX-ERR
5011769
B:
L:
P:
O: ARP desactivado
M:
A:
R:
U:
--statistics, -s
o
o
o
o
o
o
o
$ netstat -s
Ip:
5001746 total packets received
7479 forwarded
0 incoming packets discarded
4894721 incoming packets delivered
......
--numeric
--continuous
continua
o
arp
Ejemplo:
# arp
Address
almansa.dec.usc.es
193.144.84.1
teneguia.dec.usc.es
HWtype
ether
ether
ether
HWaddress
00:0D:56:6F:E6:90
00:E0:63:93:26:E5
00:C0:4F:A1:5D:89
Flags Mask
C
C
C
Iface
eth0
eth0
eth0
Algunas opciones:
-i
-a
-d
-s
-n
Comando ping
Muestra la disponibilidad de conexin y la velocidad de transmisin con
un host remoto:
$ ping 193.144.84.1
PING 193.144.84.1 (193.144.84.1) 56(84) bytes of data.
64 bytes from 193.144.84.1: icmp_seq=1 ttl=255 time=0.420 ms
64 bytes from 193.144.84.1: icmp_seq=2 ttl=255 time=0.396 ms
64 bytes from 193.144.84.1: icmp_seq=3 ttl=255 time=0.368 ms
Algunas opciones:
-b
-c
Comando traceroute
Muestra la ruta que sigue un paquete hasta llegar a destino
$ traceroute www.elpais.es
traceproto:
tcptraceroute:
firewalls
Comandos host, dig, nslookup
Permiten obtener la direccin IP de un sistema a partir del nombre o
viceversa:
$ host www.elpais.es
www.elpais.es is an alias for elpais.es.edgesuite.net.
elpais.es.edgesuite.net is an alias for a1749.g.akamai.net.
a1749.g.akamai.net has address 130.206.192.38
a1749.g.akamai.net has address 130.206.192.32
nslookup
Comando mii-tool
# mii-tool -v eth0
eth0: negotiated 100baseTx-FD flow-control, link ok
product info: vendor 00:08:18, model 16 rev 0
basic mode:
autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
flow-control
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
flow-control
# mii-tool --force=100baseTx-HD eth0
# mii-tool eth0
eth0: 100 Mbit, half duplex, link ok
/etc/init.d/networking
/etc/init.d/network
en Debian
en RedHat
auto eth0
iface eth0 inet static
address 193.144.84.77
netmask 255.255.255.0
network 193.144.84.0
broadcast 193.144.84.255
gateway 193.144.84.1
# dns-* options are implemented by the resolvconf package, if
installed
dns-nameservers 193.144.75.9
dns-search dec.usc.es
name Tarjeta de red Ethernet
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=193.144.84.186
NETMASK=255.255.255.0
GATEWAY=193.144.84.1
TYPE=Ethernet
domain dec.usc.es
search dec.usc.es usc.es
nameserver 193.144.75.9
nameserver 193.144.75.12
127.0.0.1
localhost.localdomain localhost
red1 172.16.1.0
red2 172.16.2.0
Fichero /etc/host.conf
order hosts,bind
multi on
Fichero /etc/nsswitch.conf
hosts:
networks:
dns files
files
hosts:
networks:
notfound
unavail
tryagain
Fichero /etc/protocols
ip
icmp
tcp
udp
.....
0
1
6
17
IP
ICMP
TCP
UDP
#
#
#
#
Fichero /etc/services
ftp-data
ftp
ssh
ssh
telnet
smtp
....
20/tcp
21/tcp
22/tcp
22/udp
23/tcp
25/tcp
#
#
#
#
#
#
Datos de ftp
Control de ftp
SSH por TCP
SSH por UDP
Telnet
Correo electrnico
auto eth0
iface eth0 inet dhcp
Automatizacin de tareas
at, batch
cron