Professional Documents
Culture Documents
20110820(v1.0)
PortantierInformationSecurityIntroduccinaGNU/Linux
FabianPortantier
TCP/IP
PortantierInformationSecurityIntroduccinaGNU/Linux
ModeloOSI
Creadoen1984
Divididoensietecapas
http://web.frm.utn.edu.ar/comunicaciones/modelo_osi.html
PortantierInformationSecurityIntroduccinaGNU/Linux
ModeloOSI
APLICACIN PRESENTACIN SESIN TRANSPORTE RED ENLACEDEDATOS FSICA
PortantierInformationSecurityIntroduccinaGNU/Linux
Capa1:Fsica
PortantierInformationSecurityIntroduccinaGNU/Linux
Capa2:EnlacedeDatos
Capa3:Red
Capa4:Transporte
Capa5:Sesin
Sesionesentredosextremos
Puedeserprescindible
Controldedilogo(HalfDuplex,FullDuplex)
PortantierInformationSecurityIntroduccinaGNU/Linux
Capa6:Presentacin
Formateodedatos(ASCII,UTF8,etc)
Cifradodedatos
Compresindedatos
PortantierInformationSecurityIntroduccinaGNU/Linux
Capa7:Aplicacin
Defineprotocolosautilizarporaplicaciones
Sueleserutilizadoporlasaplicaciones
HTTP,FTP,IMAP,SMTP,SSH,etc
PortantierInformationSecurityIntroduccinaGNU/Linux
PortantierInformationSecurityIntroduccinaGNU/Linux
PuertosTCPyUDP
Asocianpuertosconaplicaciones
Tantoparasalidacomoparaentrada
Ej:ApacheHTTPDTCP/80
PortantierInformationSecurityIntroduccinaGNU/Linux
DireccionesIP
DireccionesIPClases
PortantierInformationSecurityIntroduccinaGNU/Linux
DireccionesIPPrivadas
MscaradeSubred
Mscaradesubred(ejemplos)
IP: 192.168.000.001 Mscara: 255.255.255.000 ----red---- -hostIP: 192.168.000.001 Mscara: 255.255.000.000 --red-- --host-PortantierInformationSecurityIntroduccinaGNU/Linux
Rutas
Rutasestticas
Sedefinenconelcomando'route': routeadddefaultgw192.168.0.1 routedeldefault routeaddnet10.0.0.0netmask255.0.0.0dev eth0 routedelnet10.0.0.0netmask255.0.0.0
PortantierInformationSecurityIntroduccinaGNU/Linux
Switches
Routers
Operanenlacapadered(Capa3)
Interconectandiferentesredes
Puedenelegirlamejorrutahaciaundispositivo
PortantierInformationSecurityIntroduccinaGNU/Linux
ifconfig
Nospermitever/configurarinterfacesdered Ejemplos: ifconfig ifconfigeth010.0.0.1netmask255.0.0.0 ifconfigeth0up ifconfigeth0down
PortantierInformationSecurityIntroduccinaGNU/Linux
ping
PortantierInformationSecurityIntroduccinaGNU/Linux
ping
PortantierInformationSecurityIntroduccinaGNU/Linux
traceroute
PortantierInformationSecurityIntroduccinaGNU/Linux
/etc/protocols
Definelosprotocolosysusnmerosasignados
PortantierInformationSecurityIntroduccinaGNU/Linux
Puertosbienconocidos
PuertosTCPyUDPasignadosaaplicaciones DefinidosporelIANA
http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_po
PortantierInformationSecurityIntroduccinaGNU/Linux
/etc/services
Definicionesdepuertosyaplicacionesconocidos
PortantierInformationSecurityIntroduccinaGNU/Linux
telnet
PortantierInformationSecurityIntroduccinaGNU/Linux
ConfiguracionesdeRed
PortantierInformationSecurityIntroduccinaGNU/Linux
ifconfig
ifconfig (Muestralasinterfacesactivas) ifconfiga (Muestratodaslasinterfaces) ifconfigeth010.0.0.1netmask255.255.255.0 (Defineladireccin10.0.0.1/24) ifconfigeth0down (Deshabilitalainterfaz) PortantierInformationSecurityIntroduccinaGNU/Linux
/etc/network/interfaces Configuracindelasinterfaces(Debian)
autoloeth0eth1 ifaceeth0inet address 192.168.14.10 netmask 255.255.0.0 gateway 192.168.1.1 uprouteadddefaultgw192.168.2.1 downroutedeldefaultgw192.168.2.1 ifaceeth1inetdhcp PortantierInformationSecurityIntroduccinaGNU/Linux
ifup/ifdown
Subir/Bajarinterfaces(/etc/network/interfaces) ifupa,ifdowna (Subir/Bajartodaslasinterfaces) ifupIF,ifdownIF (Subir/Bajarunainterfaz) Ejemplo: ifupeth0
PortantierInformationSecurityIntroduccinaGNU/Linux
/etc/hostname
PortantierInformationSecurityIntroduccinaGNU/Linux
/etc/resolv.conf
PortantierInformationSecurityIntroduccinaGNU/Linux
netstat
Muestraconexionesypuertosenescucha netstatlnpt (puertosTCPenescucha) netstats (estadsticasdeconexin) netstatc (actualizalainfocada2segundos)
PortantierInformationSecurityIntroduccinaGNU/Linux
ResolucindeNombres(DNS)
PortantierInformationSecurityIntroduccinaGNU/Linux
JerarquadeNombres
PortantierInformationSecurityIntroduccinaGNU/Linux
TiposdeRegistrosDNS
PortantierInformationSecurityIntroduccinaGNU/Linux
dig
PermiteconsultarlosregistrosDNS
PortantierInformationSecurityIntroduccinaGNU/Linux
dig
PortantierInformationSecurityIntroduccinaGNU/Linux
dig
PortantierInformationSecurityIntroduccinaGNU/Linux
dig
PortantierInformationSecurityIntroduccinaGNU/Linux
host
$hostwww.portantier.com www.portantier.comhasaddress174.122.105.94
PortantierInformationSecurityIntroduccinaGNU/Linux
nslookup
$nslookupwww.portantier.com Server: 192.168.0.1 Address: 192.168.0.1#53 Nonauthoritativeanswer: Name: www.portantier.com Address:174.122.105.94
PortantierInformationSecurityIntroduccinaGNU/Linux
tcpdump
Permitecapturarpaquetesdered
PortantierInformationSecurityIntroduccinaGNU/Linux
tcpdump
#tcpdumpieth0 (Escuchapaquetesenlainterfazeth0) #tcpdumpieth0A (MostrarelcontenidodelospaquetesenASCII) #tcpdumpieth0tcpport80 (CapturarlospaquetesTCPpuerto80) #tcpdumpieth0host192.168.0.10 (Capturarlospaquetesdelaip192.168.0.10) PortantierInformationSecurityIntroduccinaGNU/Linux
nmap
Escaneapuertos
Puedereconocersistemasoperativos
Puedereconocerversionesdesoftware
PortantierInformationSecurityIntroduccinaGNU/Linux
root@debian:~#nmap127.0.0.1 Starting Nmap 5.00 Interesting ports on localhost (127.0.0.1): PORT 22/tcp 53/tcp 80/tcp 143/tcp 3306/tcp STATE open open open open open SERVICE ssh domain http imap mysql
nmap
PortantierInformationSecurityIntroduccinaGNU/Linux
nmap
nmappT:80,U:53127.0.0.1 (EscanearpuertosTCP/80yUDP/53) nmapsV127.0.0.1 (Reconocerversionesdesoftware) nmapO127.0.0.1 (Reconocerversindelsistemaoperativo)
PortantierInformationSecurityIntroduccinaGNU/Linux
NombresdeDominio
AsignadosaunadireccinIP
RequierenunadireccinIPfija(paga)
Necesariosparadarservicios(web,mail,etc)
PortantierInformationSecurityIntroduccinaGNU/Linux
DNSDinmicos
Seactualizanapedidodelcliente
PermitendarserviciosconIPdinmica
Requierenclientesdeactualizacin
PortantierInformationSecurityIntroduccinaGNU/Linux
DNSDinmicos(proveedores)
aptcachesearchdyndns
PortantierInformationSecurityIntroduccinaGNU/Linux
ProtocolosdeEnrutamiento
SistemasAutnomos(AS)
SistemasAutnomos(AS)
PortantierInformationSecurityIntroduccinaGNU/Linux
EnrutamientoInterior
EnrutamientoExterior
(EntredistintosAS) BGPv4(BorderGatewayProtocol)
PortantierInformationSecurityIntroduccinaGNU/Linux
Netcat
Netcat(minichat)
PortantierInformationSecurityIntroduccinaGNU/Linux
Netcat(copiadearchivosremota)
PortantierInformationSecurityIntroduccinaGNU/Linux
lsof
Listalosarchivosabiertos lsofinP
PortantierInformationSecurityIntroduccinaGNU/Linux
Samba
Permitecompartirarchivosycarpetas
ProtocoloCIFS(WindowsShares)
Multiplataforma(Windows,Linux,Mac)
PortantierInformationSecurityIntroduccinaGNU/Linux
aptgetinstallsamba
PortantierInformationSecurityIntroduccinaGNU/Linux
/etc/samba/smb.conf
[global] workgroup=midominio serverstring=%hserver security=share [shared] path=/home/fabian/shared browseable=yes readonly=yes guestok=yes
PortantierInformationSecurityIntroduccinaGNU/Linux
Administracingrfica
aptgetinstallgadminsamba
PortantierInformationSecurityIntroduccinaGNU/Linux
webmin
NAT
PortantierInformationSecurityIntroduccinaGNU/Linux
NetworkAddressTranslation
PortantierInformationSecurityIntroduccinaGNU/Linux
Habilitarenrutamiento
echo1>/proc/sys/net/ipv4/ip_forward
PortantierInformationSecurityIntroduccinaGNU/Linux
SourceNATEsttico
iptablestnatAPOSTROUTINGs 192.168.3.0/24oeth0jSNATto80.58.1.14 APOSTROUTING:AadeaPOSTROUTING s192.168.3.0/24:Direccinorigen oeth0:Interfazdesalida jSNATto80.58.1.14:Cambiaaestadireccin
PortantierInformationSecurityIntroduccinaGNU/Linux
SourceNATDinmico
iptablestnatAPOSTROUTINGs 192.168.3.0/24oeth0jMASQUERADE
PortantierInformationSecurityIntroduccinaGNU/Linux
DestinationNAT
iptablesAPREROUTINGptcpdport8080i eth0jDNATto192.168.3.3:80 APREROUTING:AadeaPREROUTING ptcp:ProtocoloTCP dport8080:Puertodedestino ieth0:Interfazdeentrada jDNATto192.168.3.2:80:CambiaaIP:Puerto
PortantierInformationSecurityIntroduccinaGNU/Linux
iwconfig
#iwconfig wlan0IEEE802.11bgESSID:"bomberman" Mode:ManagedFreq:2.4GHzAP:00:1E:58:C6:73:C7 BitRate=48Mb/sTxPower=27dBm Retrylonglimit:7RTSthr:offFragmentthr:off Encryptionkey:off PowerManagement:off LinkQuality=56/70Signallevel=54dBm Rxinvalidnwid:0Rxinvalidcrypt:0Rxinvalidfrag:0 Txexcessiveretries:0Invalidmisc:0Missedbeacon:0
PortantierInformationSecurityIntroduccinaGNU/Linux
wpa_supplicant
network={ ssid="ssidelared" scan_ssid=1 proto=WPA2 key_mgmt=WPAPSK psk="contrasena" } wpa_supplicantdDwextiwlan0
PortantierInformationSecurityIntroduccinaGNU/Linux