 for our memory, what do we know about TCP congestion control, the algorithm for how do we increase and decrease our sending rate, which really is increasing and decreasing the congestion window, because they are proportional, as different components. We saw that we have additive increase where we, and may be shown by the diagram where we have a linear increase in the sending rate, this is the idea then, when there's no congestion, we're receiving acts, then increase our sending rate. If we have congestion and due to packet losses, congestion is detected, then decrease the sending rate and the general form is multiplicative decrease where we halve the sending rate for every packet loss. But in fact it's a little bit more detailed than that because depending upon the type of packet loss we respond in different ways. And in addition we have the slow start phase and that is there to rapidly increase the sending rate at the start of the connection and during the connection in some cases. So if we just have additive increase, we have a slow increase and therefore we may be inefficient in using our connection. So at the start increase fast and the result if there's no packet loss is that at the start of our connection we start sending slow but we rapidly increase the sending rate. We have another parameter called the slow start threshold which tells us at what point do we switch from slow start to additive increase. Send rapidly increase the rate until you get to some cut off level and then just gradually increase the rate. And at some point you'll reach the advertised window and remember it's the minimum of the two windows which limits our sending rate. And then in packet losses two different types of events, small amount of congestion, three duplicate acts, large amount of congestion, timeout, we reduce by more in the event of a timeout. And we get similar to this in a simple case. Slow start, additive increase, packet loss due to three duplicate acts, halve the threshold and set our window to the new threshold value and then additive increase if there's a loss due to a timeout, halve the threshold again and revert back to the start. Minimum window, slow start, additive increase. So that's the basics of TCP congestion control and in practice that's the basics of the algorithm. There are many extensions, so there are many variations that try to improve the performance because really this limits the congestion control algorithm and the flow control algorithm limit how fast we can send data using TCP and because almost all of our internet applications use TCP it has a large impact on the performance of our applications. When you download a file from a website using BitTorrent, FTP, whatever, the throughput that you achieve is largely dependent on how TCP works and especially TCP congestion control because if we start to get packet drops when you're downloading that file then the sender is going to slow down and your throughput is going to go down. So it's about achieving this trade-off of getting a high throughput. We want a high throughput for our applications but no congestion or avoid congestion and that's what all the extensions to the congestion control algorithm have tried to achieve different trade-offs between high throughput and avoiding congestion. We've just gone through the very basic steps of the algorithm. There are many extensions. It works well. Current TCP congestion control works well in the internet where most of the packet losses are due to congestion. In other networks like a wireless link where you may have packet losses due to errors in the wireless link, it doesn't work so well. So in some wireless networks using TCP the performance or the throughput can drop off and it's not good for applications and there have been some variants of TCP to work just in wireless networks. There are some modifications so that it's faster in a wireless LAN or maybe in a 3G network. In some cases in very high-speed networks say across optical fiber it may perform poorly. When we have a few packet losses it can slow down and since our capacity is very high in a high-speed network say greater than 10 gigabits per second if TCP slows down then it will maybe sending at a very low rate and be very inefficient compared to what our link can support. So in there are some cases where it doesn't work so well but there have been some modifications to try to handle those cases. In general it works well. It works well in that it gives a good throughput for applications but it avoids congestion and over the time there's been many variations to the algorithm trying to improve it. So the original TCP didn't have any congestion control. In 1988 they added slow start and additive increase and fast retransmit and they added different features to TCP over time and nowadays there are many different algorithms available. The most common one or the normal one is called Reno, TCP Reno but there are variations. We will see maybe in a demo on Linux there's two congestion control algorithms available one's called Reno and one's called Cubic but you can install others. That is you when you set up your operating system can select which variation of the congestion control algorithm to use depending upon your network. Usually the default ones are suitable for most purposes but if you have a special case that you want to deal with then maybe you'll try a different algorithm. So there are others and it depends upon the operating system as to which ones are available. Just quickly on Linux we can see the set of congestion control algorithms. It's part of the operating system so like in Windows you have a registry that has operating system variables in Linux we have a set of variables which we can see with system control and there's one called it's a networking parameter with IP version 4 called TCP what is it called? TCP available congestion control if I can spell correctly so this parameter is for my operating system that tells me my current OS has two algorithms available to choose from Cubic or Reno so the other ones available which ones in use the current one in use is indicated by a different parameter current one in use by my computer is Cubic so just two variables as parameters for my OS that tell me what's available and what's in use and I can change by selecting the other one, Reno so to change a variable in my operating system I need to be the administrator or root user so I use sudo in my computer and sys control is to change the value the TCP congestion control parameter to Reno and it's now set to Reno so now my computer when I use TCP is using a different algorithm in fact Reno is the one that we described is very similar to what Reno is Cubic is a more advanced one so it operates different from what we've seen in the lectures in your assignment your task is to test the performance of a TCP connection measure the throughput under different conditions so you have a source computer, a destination computer you use IPERF to send data using TCP and you measure the throughput and the basic test is to change the amount of packets which are dropped so if you use TCP you'll get some throughput and normally in your simple network there should be no packets dropped no congestion, you've just got a single link or to your router and another two links so there should be no congestion in your simple network but what I would like you to do in the assignment is to run some tests and see what happens with your throughput as the number of packets dropped increases so if you draw your network in fact for your assignment you can do it two ways you can do it with your router and it's using wired links your client and server for IPERF run IPERF on one computer run it in the client mode on the other computer and run a test and you'll get a throughput for this network whatever it is 80 megabits per second for example and then see what throughput you get if there are packet drops because with packet drops you know packet loss means the sender will slow down and therefore you'll be sending less and therefore your throughput should drop by how much? that's the main experiment here so what do you do to do that? how do you get packet drops? so normally in our network there's no congestion in this very simple network there's no one else sending no congestion there should be no packet losses so for your experiments what I'd like you to do is to emulate packet losses pretend there are packet losses or introduce your own set of packet losses in here and I'll show you two ways to do that and what I'm showing there are some links from your assignment to these instructions so you don't have to copy them down you can see them in more detail but the idea is that what you want is let's say we start IPERF on the client and server and we do our test what happens if some packets are dropped in our network? then you measure the throughput again and let's say you get 70 megabits per second and what happens if you increase the number of packets dropped and you should measure the throughput and see what you get so as a result you'll get some plot as the number of packets dropped increase the throughput goes down or some relationship between packet drops packet losses and throughput that's what I want you to get from the experiment from the assignment the challenge is how do you make packets be lost in the network when normally there's no congestion what you do is there's two ways and the idea is to emulate packet drops this is a more detailed picture so here's your network, client, router, server you have IPERF running on the client what it does is it generates packets sends them to TCP and TCP follows its flow control and congestion control algorithm to work out when to send and assuming the congestion control is the limiting factor for how fast we can send then we'll start in sending one segment per round trip time and then in slow start phase double the amount we send and double reach additive increase and that will limit the throughput what happens is TCP sends packets to IP and puts them into a queue and then your LAN card as it can take some out of the queue and sends across the link to the router the router receives those packets in some queue or some buffer and usually because there's no congestion at this router it will transmit them immediately in your network there's no congestion here if there are many other nodes sending into this router there may be congestion and packets may be dropped here and as they're sent to the server computer they received an IPERF measures and counts how many packets it receives that's the normal behaviour what you need to do is to introduce some packet drops and there are two ways to do that the first way is to use a program called TC what TC does and we saw briefly in a demo last week but TC is a program that manipulates this queue normally a packet comes into the queue it's a first in first out queue so as packets arrive in the queue the head of the queue is transmitted when the LAN card will allow it to be transmitted so the normal way is IP puts it into the queue and as the LAN card becomes ready it can transmit them TC allows us to manage that queue for example what we could do is say packets which are destined to a specific address send them first give some priority to packets we're not going to do that in this assignment that's another topic what we can do with TC also is add some for example some arbitrary delay to the packets here and when I demonstrated the bandwidth delay product that's what I did I say when a packet comes in here don't send it immediately delay it for 5 milliseconds as if there's an extra delay between client and server the other thing you can do with TC is say of all the packets that come into the queue drop 1% of them so it will randomly choose 1 out of every 100 packets that come into the queue and not send them drop them, delete them and that's what you want or that's one way to emulate packet drops you tell you can do it either on the client you can potentially do it on the router as well if you have the software and that you set up the queues such that some fraction of the packets that go through the queue are dropped or lost and as a result the server will not receive them and as a result, TCP will take effect and start slowing down its sending rate and that's how you'll measure the throughput and see how the number of packet drops impact upon throughput so TC is one way to create arbitrary packet drops there's a problem there it works if you can run it on the router so if you run TC on the router then it will drop the packets and TCP here will slow down and you'll see the impact of packet drops on congestion control if you do it on the client TCP is smart enough to recognize that the packet was dropped local to this computer that this packet that was dropped is not due to congestion it's due to something else happening inside this computer and therefore TCP will not slow down so in fact using TC on the client computer does not impact upon TCP in the way that we expect with congestion control so I advise against using TC on the client computer we need to do something else so one option is to use TC on the router and that controls the number of packets which are dropped as the router sends them out another option to cause packets to be dropped on the client computer is to use another piece of software called IP Tables it's normally used as a firewall where we control which packets are allowed or are not allowed either which packets are accepted or dropped well we can do that and we can say with IP Tables create a rule such that what do we do all packets sent to the LAN card we can create a rule that says again 1% of those packets are dropped normally with a firewall we say all packets sent to some destination address are dropped or all packets coming from some destination are dropped we can also use IP Tables to say for example all packets coming out of this interface to the LAN card 1% of them are dropped I'll quickly show you the command for doing that and then you can use that in your assignment so you don't need to understand much about firewalls to do this you just need to use the command and then you can run your tests what is the command I will not show you how to use TC there's some links on the website which show you how to use TC but I recommend that you use IP Tables it's just as easy and again the details of this command you can find on the assignment web page but that's clear I've made a mistake and there's a mistake in this picture we don't want to run IP Tables on the client we want to run it on the server because we have the same problem if we drop packets here on the client then the TCP here recognises it's happening locally and will not slow down so there's two ways you run IP Tables on the server and drop packets as they arrive or there's another way you can run it on the router or even as packets come back so this diagrams the best way is this green arrow should be pointing here run IP Tables on the server the idea is as packets come into the server drop 1% of those packets and the command and I would run this on the server computer add a rule such that the packets coming in input to my computer input to the server and here we need to say let's use a special mode that looks at the statistics of those packets and let's randomly drop some of those packets with some probability for example 0.01 1% and take the action to drop them what this command will do is say all packets coming into this computer input coming in let's look let's use this statistics mode where we'll randomly select 1% of those packets and drop them as if they didn't arrive at that computer so that's just the syntax of IP Tables the input the mode is statistic and random and the probability is 0.01 meaning 1% and the action drop those packets and then what IP Tables will do as packets come in every 100 packets it will look and drop a random selection of them 1% on average does it work? what did I do wrong? my computer's not set up to run it I have to test that let me check maybe it's the wrong version why doesn't that work? okay that used to work that's the problem with running demos that used to work I have to find the exact syntax maybe it's updated since last year it worked last year but I'll check the syntax and let you know tomorrow the right way to do that it's possible that you need to install a new package to get that to work it may have been available last time but not this time the idea is there if it does work if it did work then that would be performed on the server what happens as you send packets they arrive here at this queue IP Tables drops 1% of them hence TCP doesn't receive them here and hence eventually this TCP will slow down and you'll measure the throughput then you can change it instead of dropping 1% drop 2% and increase the rate at which you drop packets and see how that impacts on the throughput so it turns out if we can get IP Tables to work that it's quite easy to run those experiments you just keep changing the percentage or the probability of packet drop and measure the throughput with IPerf I'll get back to you tomorrow on how to do that on the latest version any questions on that so in summary use IP Tables to drop packets on the server and then run IPerf to measure the throughput yep okay and use use the LAN to get more predictable results in this case so in fact you have two options you can use your router here and two cables you can also do the same test connecting the two computers direct together if you can set them up you don't even need the router because unless you want to run TC on the router which you can do but it's a bit harder then you can set up like this with two LAN cables or remove the router and one LAN cable client to server and run the same test just note that when you connect client to server together note what the LAN speed is is it 100 Mbps or 1000 Mbps it may be different any other questions so there's your assignment TC on the router you would need to install TC on the router the command for TC on the router is the same as on Linux it's a Linux operating system on the router but OpenWRT doesn't have it installed by default so you'd need to install TC so you'd need to go to the OpenWRT website to find out how to install that it's possible once it's installed then the command for running TC you can find there's a link on the assignment website that shows how to run TC to drop packets but you'll need to install it first if you want to install it and if you have troubles then let me know it's not too hard to install packages but test it first to make sure it works it may be a different version or an older version any other questions so everyone can do the assignment okay tomorrow once I get IP tables working everyone can do the assignment okay and to get more marks then well now how many tests do you do you don't just run five tests and that's it so try and investigate different factors the packet drop is one thing you can try the different congestion control algorithms I showed you that there are two by default cubic and Reno I recall last year a group installed two other algorithms and they gave results of the packet drop with Reno with cubic and two others so you can try different congestion control algorithms and see how they work which ones are better in the presence of packet drops and there may be a few other things you could try but those are the two main things and there's another part the fairness part and that's what we want to discuss now and this is not too complex so now in summary you don't control as the user you don't control how fast TCP sends the operating system the implementation of TCP controls how fast it sends and it's dependent upon what's happening in the network and at the receiver what about when you have multiple TCP connections running at the same time how do they compete with each other that's one aspect of fairness an example here we have three source computers wanting to send data to three destination computers the top one to the top one here so we're going to have three TCP connections running at the same time and in this case the three connections are going to share one bottleneck link so let's say that this link here is the slowest of all of them this is 100 megabits per second 100 100 and this is just one megabit per second so we say this is the bottleneck link for all the connections so the throughput of each TCP connection is going to be limited by that bottleneck link if the bottleneck link was one megabit per second and we ran just one TCP connection from this computer to this top one approximately what throughput would they get so if it was if those computers were labeled A, B, C, D and F if we had a TCP connection from A to D approximately what throughput would we get approximately there may be some overheads which we cannot easily calculate but throughput if I an IPERF test from computer A this top one to the top one on the right computer D what throughput would we get assuming the others aren't sending anything so ignore the other computer if this link data rate is 100 megabits per second this is 100 and the bottleneck link is this one one megabit per second then we're limited by this bottleneck so the throughput is going to be about one megabit per second because there'll be overheads assuming because there'll be no congestion in here because no one else is sending so we'd get about one megabit per second from A to D what if all three are sending A is sending to D B to this one and the lowest one to this one all three are sending all going via this one bottleneck so what do you think A to D is going to get one third we have a bottleneck link and we ideally would expect that under the same conditions each of the three connections would share that bottleneck link fairly amongst them so that get one third each 330 kilobits per second and that's the issue of fairness if that happens we'd say this system is fair because everyone gets a fair portion of that capacity and in fact with TCP when all conditions are the same in an ideal case that is true that we will get that TCP is considered fair fair amongst connections so in the green one the blue one and the red one would all get approximately equal throughput when they share this bottleneck link so TCP is fair but fair amongst connections so if we have N connections sharing some link with R bits per second then each connection would achieve R divided by N bits per second we divide the capacity by the number of connections and that's true at least in ideal conditions ideal conditions means for example the connections have the same round trip time from A to D and from B to E the round trip time is the same and the same size segments so they're sending the same size segments across their links and there's no other traffic then TCP is fair in those cases if we have different round trip times it becomes more complicated usually connections with a smaller round trip time may get a slightly larger proportion of the bandwidth or capacity and it becomes more complicated if there are sources sending data which are not using TCP for example some are using UDP like a voice over IP call is using UDP but no TCP then some of the TCP connections may not equal proportion as what the others get it becomes more complicated and importantly TCP is fair amongst connections only if there are applications using multiple TCP connections then although it's fair amongst connections it's not amongst the applications a simple example I'm using this computer I run an application that opens two TCP connections at the same time to the server on this computer so my application is designed to use not just a single connection but two connections the two green ones and because TCP is fair amongst connections of these four connections sharing this bottleneck link each of them get about a quarter of capacity that's what we said before about fairness amongst connections so this first green one gets 250 kilobits per second the second one 250 and the last two the blue and the red ones 250 so the green one the blue is 250 and the red gets 250 TCP is fair amongst those four connections the one megabit per second divided by four connections but my application on this computer gets a total of 500 because my application it's a web browser downloading data or transferring data between another application a server if it's using two connections at the same time the total my application is getting is 500 kilobits per second this is not fair amongst applications my application on computer C the red one is getting 250 on computer B the blue one is getting 250 on computer A the green one is getting 500 so the end users are not treated fairly in this case and TCP doesn't try and handle that so what do you do if you want to increase your throughput for your application on your computer your download for example from server to your application what do you do how do you get higher throughput when you're using TCP add more connections so if you can get an application both client and server that use more connections then in this case then the more connections you get the higher the throughput that your application gets when sharing with others if the red one realises I'm only getting a quarter of this capacity then install an application that uses three connections the red one if they use three connections then we have a total of six connections sharing that link the red one is going to get a half the green one two thirds and the blue one one third and that's how download managers can increase their performance and we'll see later peer to peer file sharing applications by having multiple TCP connections you can increase the throughput for your application so TCP is fair amongst connections but not necessarily amongst applications now what stops an application from using multiple TCP connections well if the green one has increased to two and the red one realises okay I'm not getting as much as the other person then I increase mine to three then the blue one says I'm not getting as much as the others I increase mine to ten and then everyone increases the number of connections but note for each connection there's some overhead so having an infinite number of connections produces an infinite overhead in this case so you cannot just keep increasing so there's some overhead of having more connections more complexity at the client and server and more overhead in setting up the connection so in general application should be designed to take into account the fact that other applications will be in use in the internet but as you see download managers some applications will open multiple connections web browsers nowadays open multiple connections but usually for example to download images in a web page you download the HTML the multiple images in separate connections it speeds up the transfer in some cases although for different reasons so you can investigate this in your assignment again you can so instead of having multiple computers you just have multiple instances of IPer you open up three terminals for example and same on the server you run three instances of IPer use different port numbers and then on the client three different instances of IPer so effectively you have three separate TCP connections across the same bottleneck length and you should see that they get about a third of the capacity so you can increase the number of connections and see how that works and then you can do different things to see what happens if we change some parameters for example there's different options what happens if we also have a UDP data transfer across that connection and for UDP you use the minus U option in IPer or what happens if one of these connections runs for 10 seconds and one runs for 60 seconds and you repeat the connection that runs for 10 seconds six times so run for 10 seconds stop start a new one for 10 seconds do that six times while the other TCP connection is running all at once for 60 seconds so there's a variation that you can do and see does that impact upon the fairness do they get different throughputs and you can try a number of different things to see what happens when you have different combinations of TCP and UDP connections across that link and how does the throughput get affected and as a result how's the fairness so that's the second part of your assignment and you can do that you don't need IP tables to do that you can do that now so yes you would need three instances of the server there and in that case you must set a port number because when you start the client you need to say which instance of the server to connect to and you do that using a port number not so IPer server port number one two three port number one two four one two five so they must be different port numbers so the client when you connect you specify the destination port number using again the minus P option so there's a port number option minus P in fact you don't have to start multiple instances I think there's even an option in IPerf to start multiple instances to run multiple TCP connections so there's another option you can check in IPerf to run multiple TCP connections at the same time so there are different combinations IPerf will in fact do it for you run N connections so that's one way to test so this is the manual approach and what some students last year did was they start to write some scripts that will do it automatically for them so put it in a for loop for I equal one to ten start IPerf and same with the client so you just run one script and it does all your tests for you so I may be able to find some of their work from last year and see if I can find a script that you can use to do that but think about how you can combine multiple connections in different ways there are many different combinations that will give interesting insights any any other questions on this issue of TCP fairness so TCP is fair amongst connections but when we have different parameters or when we have different parameters like round trip time and packet size or using other protocols like UDP it may not be fair try and investigate that let's finish IP does not have any congestion control built in if we had no congestion control in TCP then the internet would not work because everyone would send as fast as possible and there would be congestion and too many packets dropped so that's where the internet relies on TCP and it works because most of the traffic in the internet is TCP traffic so it's been very successful in providing congestion control on the internet there are a number of cases where it doesn't work so well as you start to get applications that no longer follow the rules of TCP congestion control then that creates problems or you start to have multiple connections many connections from a single application then in some parts of the internet it becomes unfair for some users and the performance may degrade like web browsers opening many connections at once many applications many applications starting to use UDP which impacts upon TCP and peer-to-peer applications having many connections so they cause problems for TCP we will see in the last topic some peer-to-peer applications BitTorrent for example and in the next or tomorrow multimedia applications voice over IP for example let's stop there on TCP what's the next topic let's go home now this is the topic we're going to go through quite quickly in fact we'll just introduce the concept of multicast today and we may even finish there in fact two sides of it multicast and quality of service we will not try to describe quality of service or the techniques for it if you don't understand the term it's about giving priority to different applications or users all the packets that Steve sends across the internet or across SIT's network make sure they go first or go before the packet sent by students that's one of the examples of quality of service or where it can be used give priority to the packets of particular users the users that pay more get higher priority than others we will not go through we don't have time to cover the details of that multicast is easy as well send to multiple people and it becomes easy when we compare it to the alternative methods so let's just introduce the different addressing and delivery mechanisms that we have and that will lead us to how multicast works and then we'll mention how it's important so there are four different ways that we can address our destination and deliver data to a destination in any network the first one is what we almost always assume unicast unicast means there's a one to one association between an address and a host that may be a bit too general more an address and an interface of a host may be more specific for example my laptop its interface has one address associated with it an IP address for example and when someone wants to send to that interface on my laptop they use that one IP address this is the most common form of how we deliver data and what we normally assume that when someone specifies a destination address that destination address means a particular host on the internet one host so I have one interface a cable going into my device it has an address associated with it that address refers to a single interface or more generally a single host when a source creates a packet to send and they set the destination address in that packet if they set it to this what we say this unicast address one dot one dot one dot one then that packet should be delivered just to one computer in the network if it's a unicast address then it means that this packet will go to one device in the network one host and that's available in the internet protocol all the example IP addresses that we usually give are unicast addresses here's a unicast address if you set the destination of some IP to be one two five seven eight sixteen dot three then it should be delivered to one host with that address just one host uni meaning one similar when we use the MAC protocol or Ethernet protocol if the frame has a destination address of this zero zero one seven so on to eighty nine then that frame should be delivered and processed by just one host in the network if a host receives a packet or a frame not the unicast destination that host should discard that packet if my address is one two five seventy sixteen dot three my address and I receive a packet where the destination is not that value I will discard it unicast is the normal mode in which we send or address and deliver packets broadcast is another mode where we send to everyone in the network so we have a one to many association between address and hosts we have one address when we set that as the destination address that packet should go to many hosts and in this case many means every host on the network so we have a network on the board here with four hosts one dot one dot one two three and four four different hosts with IP addresses if this one wants to send to everyone on the network what does it set the destination address to be if host with address one one one four wants to send to everyone else what's the destination address all ones in binary we're talking about IP addresses all ones in binary yes that's correct and in an IP address in IP address an IP address all ones in binary is 32 ones when we convert it to dot a decimal that is 255 dot 255 dot 255 if this source wants to send everyone in its network it can set the destination to be this special address this special IP address a local broadcast address and the result should be that everyone everyone else it doesn't have to receive it but everyone else in the network receives a copy of that packet that's the idea here so there's a one to many mapping sorry many to one many I'm getting confused one to many association between addresses than hosts this address this one address maps to many hosts there's many means all or all other so that's the idea of broadcast I think everyone understands broadcast send to everyone else there are other ways that we can do this in IP there are two types of broadcast addresses this is called a local broadcast means send to everyone on your network there's also a directed broadcast and it depends upon the net mask it may be this if it's flash 24 address direct broadcast means the network portion followed by all ones in binary which is 255 in this case so this should also send to those those three so there are in fact two forms of broadcast addresses in IP there's a send to everyone on your network and send to everyone on a specific network but both are using broadcast and when this host with address one one one one receives this datagram even though the destination address doesn't match it because the destination address is a special address it accepts and processes that packet whereas with unicast if you receive a packet and the destination doesn't match your address you discard that packet at the land layer the land level with Ethernet there's a broadcast address all f's in hexadecimal all ones in binary 48 ones all f's address that is when you set a destination address to be this in the Ethernet frame then that frame should be delivered to everyone on that land so broadcast one to many where many means everyone where do we use it mainly in controlling networks managing networks exchanging information in protocols for example when we're doing routing when we are looking up addresses DHCP ARP some of you would have seen using broadcasts in those cases so in the control and management broadcast is used but it's very inefficient if we have to use broadcast a lot because we send one packet and possibly many are sent across the network so we have to be careful when we use it it's usually only allowed within one land I cannot send a broadcast packet to everyone in the internet there's no concept of that because it would be very inefficient security problem so broadcast is usually inside a land or maybe in special cases to a specific land so we have unicast one to one broadcast one to all and multicast which is a subset of all one to many same as broadcast a one to many association between address and hosts there is one address which represents many hosts in this case many is not all it's a selection of the hosts a subset of the hosts so in fact it's a more general form of broadcast so broadcast can be covered by multicast if the selection of hosts includes all of them then it's in fact broadcast now this is more complex because which hosts are in the set well you need some form for the hosts that want to receive the packet to subscribe or join some group so we have a group of hosts so it becomes more complex than broadcast let's try and draw a picture our same four computers I'll just call them then if we some have if we have some way where hosts can join some group a multicast group let's say we have a multicast group and in this case it includes hosts four one and three we only have four to choose from here then actually make it simple just one and three the multicast group contains hosts one and three of these four and then this source host creates a packet and sets the destination address of that packet to be let's give this group a name group A if this is multicast group A and it contains hosts one and three if we set the destination to a special address identifying multicast group A then the idea is a copy of that must be sent to one and three not to two broadcast it would go to one two and three multicast it goes to a selection of those hosts so the difficulty arises is how do we know which hosts it goes to so we need this concept of a multicast group and we need some way for normally hosts to join a group which hosts should be in group A well maybe host one will join or subscribe to that group and so will host three and then we need some way to keep track of who is in that group and there are different ways for doing that so the concept is that we have some group of hosts and when we send a packet to a special address which identifies that group we deliver to every host in that group in IP addresses there is a special set of IP addresses that are reserved for multicast this was an example of a special case broadcast address for IP in IP addresses then the IP addresses that start with greater than 224 so the first dot a decimal number are reserved for multicast addresses so a special set of addresses so what we have is one IP address that represents a group of hosts so where it says destination A it would be a special multicast address for example the one on the screen 225 70 820 where this multicast address is associated with a selection of hosts one and three in this case so we create an IP datagram destination to this multicast address and the network should deliver that packet to everyone in that multicast group IP has multicast addresses so does ethernet so the MAC addresses there are special case multicast addresses as well so when a host sends a datagram to that one address it should be delivered to all hosts subscribed to that group so one to many but many is a selection of the hosts this is useful for multimedia applications streaming of radio for example let's say there's an online radio station and there's many people listening to that station at the same time radio or even TV then there's one source the radio station and there are many subscribers to that channel they're listening to the radio they're listening and should receive the same content there's a single source there's a multicast group which contains all the people listening to that radio channel at the same time and if the packets contain the audio content the source sends one copy and everyone in the group should receive a copy so multicast is beneficial for multimedia applications where you're sending data from one to many TV, audio and so on and some collaborative applications where you share data between multiple users and it's the same data so document editing and so on presentations so there's one presentation that's going to multiple computers at the same time then there's one source it goes to a selection of the hosts in some network so unicast one to one address represents one host broadcast one to many where one address represents many hosts and in this case many is all that's broadcast and multicast also one to many but many means just a subset of the host, a selection of the host it's more complex than the other two in that we need some way for hosts to join or subscribe to a multicast group for the network to keep track of who's in that group last one unicast what is that? still one to many there's one address that represents many hosts unicast is a special case where I send a packet to one address and that address can cover many hosts I only need that packet to be delivered to one of those hosts in that group so again there's a group of destinations destination hosts but we only need to get the data to just one of them any of them not necessary to all of them multicast we need to get the data to all of the hosts in the group any cast to any host in a group and the main purpose of this is in very specialized applications like DNS I think most people understand with DNS you send a query you have a domain name www.google.com you send a query to a DNS server and that DNS server returns the IP address that's the basics of DNS but we can have multiple DNS servers for redundancy for performance there are thousands of DNS servers across the internet so what we can do with any cast I create one query I send it to an any cast group which includes many DNS servers I don't care which DNS server responds just as long as one of them responds any one of those DNS servers respond so that's an example of where any cast can be used and these four delivery mechanisms are captured in this diagram where the green host is the source and the red ones are the ones who should or potential destinations any cast we send to one destination so here's our network broadcast we want to send our data to all destinations or all other hosts multicast to a subset or a selection of the hosts in the network and any cast to a selection or to any one from a selection of the hosts so the orange ones and the red one are in the potential destination group we care about getting a packages to any one of them if it goes to two of them that's fine but if it just reaches one of them that's also sufficient so the main forms of addressing and delivery in the internet and in fact in any network not just the internet let's finish with one example of multicast here's an example of multicast in the internet we have a source let's say it's a server that's sending data for a live video stream and there are many hosts that are trying to watch that same live video stream so they all want to receive the data so if they're all part of a group group one in this case so there are other hosts in this internet these are routers there are many other hosts but the ones shown here are all part of a particular multicast group group one then the idea is that the source sends one copy of the packet source address S1 it's coming from S1 destination G1 G1 is a multicast group address then there are IP addresses for multicast groups it sends one copy of the IP packet to the router it's the first router that router if it knows information about who is in this group then what it does it recognises to reach the destinations in this group I need to send a copy of the packet in this direction because there's a host here that should receive a copy and another copy of the packet in this direction because I know that there are hosts in this direction that need to receive a copy as well so this router must know something about the multicast group with normal unicast and even broadcast we don't need any special knowledge about who's in a multicast group so it's much easier but with multicast the routers need extra information to know where the destinations are this router sends a copy to the next router who recognises, ok destination is group 1 the hosts in group 1 there's one here there's one in this direction and there's some in this direction and so it sends 3 copies of that packet that it received one it sends 3 copies one will go to the host here and eventually these 2 other hosts receive it so one source sent one packet and all 5 hosts in the multicast group received a copy so that's using multicast for that to work somehow these hosts need to tell the routers that they want to be in group 1 so that these routers know where to send a copy of the packet this one knows you don't need to send a copy in this direction because if we send in this direction we'll eventually reach the destinations so in fact there are special multicast routing protocols to handle that but it becomes complex and the diagram on the previous slide is the one shown in the top here, this is using multicast the source sent one copy of the packet the first router sends 2 copies of that same packet the second router sends 3 copies this one sends 1 copy and we see in total there are 1, 2, 3 10 packets sent in the network in this simple example so to deliver from one source to the 5 destinations there was 10 packets sent in the network using multicast what if we didn't use multicast and instead used unicast we want to achieve the same goal of the source wants to deliver that packet to the 5 destinations if we didn't have multicast it would look like this in fact here the source shows 4 packets being sent it should be 5 here there are 5 destinations we would send 1 packet to D1 a second packet to D2 to D3 and to D5 and D4 source would send 5 copies of the same data to this router this router would send 1 copy to D1 and the other 4 would go to this router and eventually they'd go to the destinations count the number of packets sent in the network 5, 10 13 19 packets sent in the network to get the same data from one source to the 5 destinations if we don't use multicast in the bottom case there are 19 packets sent in the network all destinations receive 1 copy of that packet if we use multicast there are just 10 packets sent in the network better, less overhead we don't have to send as much to get the same data to the destinations so multicast can be much more efficient in using the network because now expand this up to 100 or 1000 hosts across the internet then using unicast it can be very inefficient with multicast much more efficient than using unicast but it's more complex in that these routers must know of the members of the multicast group and that adds complexity to multicast in the internet we're not going to describe how the IP multicast works in any more detail than that just the concepts of what it is and what the benefits and disadvantages are we will see it in use when we look at multi-media applications so in fact on this topic we will stop there on this topic and tomorrow what we'll do is we'll move on to the next topic which is multi-media applications and we'll see when we look at for example IPTV multicast is used and we'll see it in a more detailed example then