Snel leren werken met TCP/IP
by Albrecht Becker
RFC 1541 about DHCP replaced by RFC 2131
ipv4 (32bit) vs ipv6 (128bit)
OSI-Model
- Physical: electricity, light, radio
- Datalink: crc
- Network: logic to physical, eg. MAC
- Transport: lost, duplicates, error free delivery, ...
- Session
- Presentation: encoding
- Application
Microsoft Stack
TCP:
connected with sequence and no duplicates
Winsock-app
Winsock-interface
connection, segments with sequence number
sender expects confirmation or resend
ports: 65536 (1024 first are well known ports)
20/21 ftp
23 telnet
25 smtp
80 www
110 pop3
139 NetBios
UDP:
without connection
NetBios-app: NetBEUI, IPX/SPX possible
NetBios over tcp/ip: net use \\UNC\...
broadcast, dns, rip, snmp, video, audio
69 TFTP
137 NetBios name service
138 NetBios datagram
161 SNMP
ARP: IP into MAC (Media Access Control - 48bits)
IP:
header: source ip, destination ip, tcp or udp, checksum, ttl
tracert
ICMP:
internet control message protocol (ping)
icmp source quench (when router overloaded, the clients should slow down)
IGMP:
internet group management protocol (multicast)
1-n (224.0.0.0) reduce bandwidth
LAN + WAN: frames
router/default gateway: replace source address with address of router
TTL: time to live, -1 for each router hop, mostly 32 seconds (up to 255 seconds), each router can subtract from it (on average 1-3s)
MAC: ipconfig /all
ARP:
- arp-cache: dynamic (max 10min) vs static (unlimited until reboot)
- broadcast on local network
- computer with ip will reply with it's MAC of the network card that has ip configured.
arp -a
arp -s ip MAC add
arp -d ip
www.internic.net (giving addressblocks to providers)
class A (eg. Apple, HP, IBM)
networkID: w
hostID: x.y.z
/8
class B (eg. M$, Exxon)
networkID: w.x
hostID: y.z
/16
class C
networkID: w.x.y
hostID: z
/24
class D
multicast
class E
testing
127.x.y.z: loopback addresses (16,7 milion)
w.x.y.255: broadcast addresses (eg. arp)
0.0.0.0: whole network (wildcard)
...1: mostly used for routers
subnets local network: 10.0.0.0; 172.16.0.0; 192.168.1.103
NAT: Network Address Translation 1-1 from pool of addresses (internal maps to real outside)
PAT: Port and Address Translation 1-n
Subnetmask decides what part of ip belongs to networkID and which to hostID
CIDR: Classless Interdomain Routing (number of zeroes at end of bitmask /x )
default gateway: local & remote ip different networkID.
peer-to-peer: workgroup network (name for logical grouping)
check if tcp/ip is setup correctly: ping 127.0.0.1
tcp/ip is server service on windows
subnets
254 hosts: 255.255.255.0
62 hosts: 255.255.255.192
14 hosts: 255.255.255.240
6 hosts: 255.255.255.248
routing
bridge allows broadcasts to pass through
router does not pass broadcasts
dynamic:
RIP (routing information protocol)
limited to 15 hops, for 10 to 50 networks
OSPF (open shortest path first)
will store information about neighboor routers
static:
route print
default gateway:
0.0.0.0 / 0.0.0.0 / 10.100.100.1 / IP / Metric (hops needed till destination)
if ip not found in routing table send to gateway
first in the list will be used unless unavailable
move routingtable to computer that is setup as default gateway
route add 10.100.40.0 mask 255.255.255.0 10.100.30.1
persist after reboot: route -p add
DHCP: dynamic host configuration protocol
server:
assigns ip addresses
subnetmasks
params for default gateway
lease
for DHCP initializing ports 67 and 68 need to be open
assigning:
- dhcp discover message (sourceip, destip, mac)
- dhcp offer message (ip broadcasted until client accepts)
- dhcp request (to all dhcp servers with ip of dhcp so other servers can release the ip)
- dhcp ack/nack
- on reboot only request & ack
lease:
after 50% of the lease, server will try and prolong until 3 misses (actually client is supposed to initiated)
auto addressing without dhcp server:
169.254.0.0 - 169.254.255.255
tries and uses if free
IP autoconfiguration can be enabled with a registry key
dhcp relay agent:
when network with more than 1 segment
will bypass router to the dhcp server
needed because dhcp broadcasts and they do not pass router
NetBios & WINS
before windows 2000
NETBEUI protocol (no routing)
convert computername into ip address
net use
name is 15 characters + peer byte
- x00 workstation
- x03 messaging
- x20 server
- x1b group
- x?? user
return netbios name:
nbtstat -n
- local netbios cache
- nb nameserver
- broadcast
- lmhosts file
- hosts file
- dns
local netbios cache
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters
default 10min timeout
small: 16 names
large: 128 names
reload lmhosts:
nbstat -R
nbstat -a <remotecomputername>
ipconfig /all
LMHOSTS:
%systemroot%\System32\drivers\etc\LMHOSTS.SAM
#PRE puts into cache
#MH multihoned (computers with multiple network cards)
Hostname
max 255 alphanumeric tokens
ip / full qualified name / alias / alias / ...
DNS-Servers have partial database
Reverse dns lookup turns ip into hostnames
in-addr.arpa
Domain Name Space
Root .
TLD .edu, .org, .com (assign by icann.com)
Second Level Domain .microsoft (internic.net), .nl (denic.nl)
Subdomains or hostname .europe www
Hostname server01
FQDN: computername.[subdomain].secondleveldomain.topleveldomain
Nameserver:
gives ip to client for name through zone-file
primary vs secundary
cache-nameserver: does not contain zone-file
name conversion:
- recursive: between client and local nameservers
- iterative: client gets ip of another nameserver
- inverse: in-addr.arpa (eg. 12.201.99.50.in-addr.arpa for ip 12.201.99.50)
zonedatabase:
- a-record or host record: ip of host (select ptr record to allow reverse lookups)
- ptr-record: pointer resource record
- soa-record: start of authority to specify the primary name server, serienumber is to know if zonetransfer is needed, increase number by 1 for each change
- ns-record: at least one (the soa-record), but can have additional name servers
- cname-record: canonical name, alias for a-record
- srv-record: location of services/protocols (eg. msdcs, _sites, _tcp, _udp)
you can configure multiple dns server for one network (fault tolerance)
nslookup <hostname>
Active Directory
users, computers, printers, release, ...
PDC: primary domain controller
BDC: backup domain controller
object + attributes
OU: organisational unit
The global catalog of a domain controller can be installed multiple times in the forest.
TCP/IP Troubleshoot
ping 127.0.0.1
ping local ip
ping gateway
ping host other network
ping netbios/hostname
tracert