Domain Name System
Translate from name to IPv4 (32 bits). Hierarchical, short prefixes are used only to decide the next hop - much smaller routing table
Internet hosts, routers are identified by their 32 bit IPv4 address. Their names "www.google.com" are only used by humans.
DNS¶
- Distributed database of IPs - implemented in hierarchy of many name servers
- Application layer protocol - hosts, name servers communicate to resolve names (address/name translation). This is a core interenet function, implemented as app layer protocol. Complexity at network's edge
Functions of DNS:¶
- name to IP (Protect domains, strong modularity, fault isolation. cf. processes), allows servers to move w/o affecting end users (late binding)
- Distributed (hierarchical) servers: scalable
- mail server aliasing
- host aliasing - many names corresp. one IP (many to one mapping)
- load distribution - replicated web services, many IPs corresp. to one name (one to many mapping)
- Cost of indirection: Delay, potential poisoning
Why not centralised?¶
- DOES NOT SCALE
- Bottleneck
- Single pt of failure
- distant central database (long delay for lookup)
- Maintenance (modifying translations)
Hierarchy¶
- Root DNS Server
- Top Level Domains, (TLD)
com
,org
,edu
,net
... etc. andsg
,in
,jp
... etc. - Authoritative DNS: resolving names w/i the organisation.
Local DNS name servers - One for each ISP. When hosts make DNS queries, it is sent to the local DNS server. It maintains a cache of name-address pairs, acts as proxy, queries are forwarded up the heirarchy
query root -> query one of these -> get IP
13 root name "servers" (logical, aka named auth). Worldwide, over 400 physical servers.
- Iterated queries: Queried server replies with "IDK, but ask this server"
- Recursive queries: Queried server must return a resolved name, so now IT needs to ask other servers for name-IP map.
Qns:
- Who decides (client/server) iter/recur query?
- Are servers willing to support recur queries?
Once a DNS server learns the name-IP map, it caches. TLD servers are often cached in local servers - root servers not visited. Caches disappear after some time (TTL). Who sets TTLs? If the IP changes, it won't be known internet wide until all TTLs expire
Update/Notify mechanisms proposed IETF standards - RFC 2136
DNS Resource Records (RR)¶
Format¶
<name, val, type, ttl>
- type = A, name - hostname, val - IP
- type = CNAME, name - alias for canonical name, val - canonical name
- type = NS, name - domain, val - hostname of auth name server for this domain
- type = MX, val - mail server associated with name
Inserting¶
- Register name at DNS registrar, provide name, ip, auth name server (primary/secondary)
- Add two RRs to TLD, (NS (for auth DNS name server) and A type) and also a type MX RR.
Attacking¶
DDoS¶
- bombard root w/traffic. Ineffective (filtering, local caches allow root bypass)
- bombard TLD. Potentially more dangerous
- Send queries with spoofed source address, targete IP. Requires amplification
Redirect¶
- MitM
- DNS poisoning
Naming Application Endpoints¶
IP not enough to talk to a specific app on a machine.
Is the IP and pid enough to communicate with a specific process? No, pid too volatile.
- Sockets: door between application process and e2e transport protocol
- Network access: I/O, sockets: special file descriptors
- IP + Port
- Mux at sender (add transport header to data from multiple sockets)
- Demux at receiver (use header to deliver correct data to different sockets)
UDP¶
- No handshake (no "connection")
- IP + Port on each packet
- Lossy/Out of order
- Unreliable, but real time
TCP¶
- Socket: 4-tuple (source.ip, source.port, dest.ip, dest.port)
- Demux: All 4 values used to determine destination
- Concurrent TCP sockets
- Connection oriented
- handshake/setup, reliability, flow control, congestion control.
- Client contacts server, server must be listening for connections
- clients contact server by creating TCP socket specifying IP/Port of server. Client TCP establishes connection to server TCP
- When contacted by client, create new TCP socket to talk to client. Multiple clients support, source ip/port used to demux
- Reliable, in-order byte stream (pipe)
Web and HTTP: TCP servers¶
HTTP - web's application layer protocol
- Client initiates TCP connection to server, server accepts
- HTTP messages exchanged b/n client and server
- HTTP is stateless. No need to maintain history/cleanup
-
Cookies can be added to keep state
-
Non-persistent HTTP
- At most one object sent over TCP connection, connection then closed
- Multiple objects = multiple connections
- client: connection tcp init (syn)
- server: tcp connection accept, notify (syn + ack)
- client: request message (ack + piggy backed req)
- server: response message, close connection (ack + piggy backed res)
- client: receives response. repeat process for any sub-ref-ed objs
- Time: 2*RTT + file transmission time
-
Persistent HTTP
- Server leaves connection open
- Multiple objects can be sent over one connection