lecture2.shtml (5853B)
1 <h3>How the Net Works, Networks</h3> 2 3 <h4>Networks</h4> 4 <p> 5 In this session we introduced some very basic networking ideas and setups. 6 The most common types of any planar network of nodes to connect 7 is displayed below. 8 </p> 9 <img src="resources/topologies.png" alt="Network topologies"> 10 11 <p> 12 Internet noawdays as it came to be, seems an almost fully connected network. 13 The interesting thing though is that apart from the physical connection, 14 we implement protocols that define the behaviour of network flow in our 15 fully connected graph. 16 </p> 17 18 <h4>Protocols</h4> 19 <p> 20 Protocols define the way data is transmitted. 21 But since computers are machines, we need both hardware protocols 22 (the media layers, things done on circuitry: Physical, Data Link, Network) 23 and software ones (Transport, Session, Presentation and Application). 24 </p> 25 <img src="resources/osi.png" alt="The OSI model"> 26 27 <h4>TCP/IP</h4> 28 <p> 29 TCP provides acknowledge connection-oriented communications and 30 provides guaranteed delivery proper sequencing and data integrity checks. 31 If errors occurs during transmission, TCP is responsible for retransmitting 32 the data back. FTP which stands for File Transfer Protocol is an example 33 of a TCP/IP service that depends on TCP. 34 </p> 35 <p> 36 IP is Internet Protocol and is an unreliable connectionless protocol. 37 This means that the internet protocol does not verify that a specific 38 packet of data has reached its destination. 39 The sole function (or role) of the IP protocol is to transmit TCP/IP. 40 Where TCP is there to check that the information went through. 41 Think of this: a truck driver has to deliver 50 tons of paper 42 to a paper company. 43 The driver is TCP. 44 The load is IP. 45 The driver is there to make sure that the load gets to the paper company. 46 </p> 47 48 <h4>ThreeWay (handshake)</h4> 49 <p> 50 We already said that TCP ensures the integrity of our network session. 51 So it records the progress of our communication by having a number 52 that is increased after the completion of each dialogue. 53 To start the connection a handshake ensures the initial "agreement". 54 </p> 55 <img src="resources/handshake.png" alt="TCP three-way handshake"> 56 <p> 57 After that they keep ACKnowledging and increasing the number, 58 until one sends FIN (end) or RST (reset). 59 Now if a packet gets lost, by either endpoint, 60 it can request from his partner to retransmit it. 61 </p> 62 63 <h4>Private IP ranges</h4> 64 <p> 65 The Internet Assigned Numbers Authority (IANA) has reserved 66 the following three blocks of the IP address space for local networks: 67 </p> 68 <pre> 69 10.0.0.0 - 10.255.255.255 70 172.16.0.0 - 172.31.255.255 71 192.168.0.0 - 192.168.255.255 72 </pre> 73 74 <p> 75 The most common use of these addresses is in residential networks, 76 since most Internet Service Providers (ISPs) only allocate 77 a single routable IP address to each residential customer, 78 but many homes have more than one networked device, 79 for example, several computers and a video game console. 80 In this situation, a NAT gateway is usually used to enable Internet 81 connectivity to multiple hosts. 82 Private addresses are also commonly used in corporate networks, 83 which for security reasons, are not connected directly 84 to the Internet. Often a proxy, SOCKS gateway, or similar devices, 85 are used to provide restricted Internet access to network-internal users. 86 In both cases, private addresses are often seen as enhancing security 87 for the internal network, since it is difficult for an Internet host 88 to connect directly to an internal system. 89 </p> 90 91 <h4>NAT</h4> 92 <p> 93 NAT is the process of modifying network address information in 94 datagram (IP) packet headers while in transit across a 95 traffic routing device for the purpose of remapping one IP address 96 space into another. Most often today, NAT is used in conjunction with 97 network masquerading (or IP masquerading) which is a technique 98 that hides an entire IP address space, usually consisting of private 99 network IP addresses behind a single IP address in another, often public, 100 address space. This mechanism is implemented in a routing device that uses 101 stateful translation tables to map the "hidden" addresses 102 into a single IP address and readdresses the outgoing 103 Internet Protocol (IP) packets on exit so that they appear to originate 104 from the router. In the reverse communications path, responses 105 are mapped back to the originating IP address using the rules 106 ("state") stored in the translation tables. 107 </p> 108 109 <h4>BGP</h4> 110 <p> 111 Important nodes that connect vast networks with other vast networks 112 (central internet routers) need extra protocols if they are to be efficient. 113 The Border Gateway Protocol (BGP) is the protocol backing 114 the core routing decisions on the Internet. It maintains a table of 115 IP networks or 'prefixes' which designate network reachability among 116 autonomous systems (AS) (Europe/Greece are one larger and one smaller 117 autonomous systems). 118 </p> 119 120 <h4>Application Layer</h4> 121 <p> 122 OK, all these are really interesting but mostly non important. 123 How does a UNIX system access the whole Internet? 124 Since everything in UNIX is a file 125 (like devices which are interfaced as files), 126 and specific system functions that operate on these device files 127 (like socket() and connect()) can create even more files, 128 our "virtual" internet session is represented as a file 129 (that we just write to and read from). 130 We can understand why BSD sockets (this framework) took the early 131 Internet by storm and is even today the de facto way to exchange data on any 132 Operating System (yes, even Winlose95) ;). 133 To know how to control these things from your code, 134 you must read the excellent book of Richard Stevens: 135 <cite>Unix Network Programming</cite>. 136 </p> 137 138 <p> 139 Finally, when we said fully connected, we meant it. Here is a part of it 140 visualised by the <a href="http://opte.org/">Opte</a> project. 141 </p> 142 <img src="resources/internet.png" alt="Internet's visualization"> 143 144 <p>Happy Hacking ;)</p> 145 <p>dsp@</p>