CS 5565 Network Architecture and Protocols Godmar Back Lecture 14
Announcements Project 2A due Apr 8 –Reminder: can be done as a team, can switch teams between projects, use forum if you’re looking for team members Midterm April 1 (no joke) –Will provide overview sheet and sample exams on Wednesday Required Reading: –DCCP by Koehler et al, SIGCOMM /27/2016CS 5565 Spring 20092
Network Address Translation TCP Hole Punching & Simultaneous Open
1/27/2016CS 5565 Spring NAT: Network Address Translation local network (e.g., home network) /24 rest of Internet Datagrams with source or destination in this network have /24 address for source, destination (as usual) All datagrams leaving local network have same single source NAT IP address: , different source port numbers
1/27/2016CS 5565 Spring NAT: Network Address Translation Motivation: local network uses just one IP address as far as outside word is concerned: –no need to be allocated range of addresses from ISP: - just one IP address is used for all devices –can change addresses of devices in local network without notifying outside world –can change ISP without changing addresses of devices in local network –devices inside local net not explicitly addressable, visible by outside world (a huge security plus).
1/27/2016CS 5565 Spring NAT: Network Address Translation Implementation: NAT router must: –outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)... remote clients/servers will respond using (NAT IP address, new port #) as destination addr. –remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair –incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
1/27/2016CS 5565 Spring NAT: Network Address Translation S: , 3345 D: , : host sends datagram to , 80 NAT translation table WAN side addr LAN side addr , , 3345 …… S: , 80 D: , S: , 5001 D: , : NAT router changes datagram source addr from , 3345 to , 5001, updates table S: , 80 D: , : Reply arrives dest. address: , : NAT router changes datagram dest addr from , 5001 to , 3345
1/27/2016CS 5565 Spring NAT Disadvantages 16-bit port-number field: –Only 60,000 simultaneous connections with a single LAN-side address! NAT is controversial: –routers should only process up to layer 3 –violates end-to-end argument NAT possibility must be taken into account by app designers, eg, P2P applications –address shortage should instead be solved by IPv6 –really annoying if you time out on rlogin.cs.vt.edu
NAT Challenges Considering that most Internet hosts are behind NAT these days – how should applications be written to deal with that? No problem as long as server has public IP and client knows where to connect (HTTP, XMPP, SMTP, POP) What about P2P applications? –Could relay through server, but that would defeat purpose of P2P –Instead, a technique called “hole punching” is widely used (e.g., in Skype) –Discussed in [Ford/Srisuresh/Kegel 2005]Ford/Srisuresh/Kegel 2005 UDP hole punching is widely used, but TCP hole punching is possible as well 1/27/2016CS 5565 Spring 20099
NAT Relaying All traffic goes through S Source: [Ford/Srisuresh/K egel 2005]Ford/Srisuresh/K egel /27/2016CS 5565 Spring
1/27/2016CS 5565 Spring Aside: TCP Hole Punching External server S records & provides private & public IP both behind-NAT hosts must punch holes with outgoing SYN – allows TCP connection
1/27/2016CS 5565 Spring Simultaneous Open (cont’d) Vint Cerf, 1987: Not invented for hole punching in NAT – coincidental use Distributed systems with symmetric processes that automatically seek to link to each other (no master/slave relationship) would use the simul-OPEN style. It was designed into TCP for that purpose; I do not know, however, whether any actual applications have made use of this feature.
1/27/2016CS 5565 Spring Simultaneous Open (a) TCP connection establishment in the normal case. (b) Call collision – one connection is established (“client-client” connection)
1/27/2016CS 5565 Spring TCP Connection FSM The heavy solid line is the normal path for a client. The heavy dashed line is the normal path for a server. The light lines are unusual events. Each transition is labeled by the event causing it and the action resulting from it, separated by a slash.
1/27/2016CS 5565 Spring TCP Hole Punching Must bind multiple sockets to same port (SO_REUSEADDR) Manage to identify which scenario has occurred Must handle case where both clients are behind the same NAT!
Remote Procedure Calls
1/27/2016CS 5565 Spring RPC: Remote Procedure Call (Birrell/Nelson 1984) CallerCallee arguments results CallerClient Stub arguments results Transport Callee arguments results Server Stub request/reply msgs
1/27/2016CS 5565 Spring RPC – Client & Server Stubs
1/27/2016CS 5565 Spring codea0a1a2a3.lena3.buf proc example_procedure = code takes int32 a0 int16 a1 int16 a2 bytearray a3 returns int32 32bit code argument #0 32bit int argument #1 16bit int argument #2 16bit int argument #3 of type bytearray 32bit length field followed by a3.len bytes RPC Encoding
1/27/2016CS 5565 Spring Architecture of Distributed Simulator in Project 2 Simulator Node 0 Node 1 Node n-1 … Outbound TCP Stream Inbound TCP Stream Outbound Request Reply Inbound Request Reply