物联网与嵌入式系统概论-week4-Networking and the Internet-Lesson1: Networking Basics
This series of articles are the study notes of "An Introduction to Programming the Internet of Things", by Prof.Harris, Department of Computer Science, University of California, Irvine. This article is week 4, Lessen 1: Networking Basics.
1. Lesson 1 Networking Basics
1.1 Lecture 1.1 Why is Networking Needed
In this lecture, we'll talk a little bit about networking. Networking is a central feature of Internet of Things. We'll talk about why it's needed, how it's helpful. Also we'll start talking about general structure of networks, sort of the broad categories of networks.
1.1.1 Why is network needed?
(1) To enhance many devices
- Cars communicating to reduce traffic
- On-line game play
- Access media libraries
(2) To access data orcomputational power outside of the device
It enhances features by giving you access to computational complexity outside of the local device. So if the Internet of Things device is a camera or a phone or a car or whatever it is, the fact that it's connected on a larger network means that from that smaller device, you can access much more powerful servers, much bigger databases. You can access all that through whatever the device is. And having access to all this computational power and all this data can it be used, can it be leveraged to enhance a lot of devices and improve their features.
1.1.2 Client-Server Transactions
Client-server modelis very common. The communication between an Internet of things device and the main network is usually, most commonly, follows aclient-server model that we're showing here. So, the client would be the Internet of Things device. That's a smaller machine, relatively less powerful machine, connected to some server and you see that in the middle of the server it is guarding, protecting some resource. Giving access let's say to a resource.So you see the resource over there on the side.
(1) The resource
The resource can be any kind of resource, may be it's a web server. And the data for the web pages is in that resource or something like that. Then the server gives access to that resource. So the client which might be the Internet of things device, that thing is communicating, making requests of, the server to get whatever the appropriate information is. The server then manages the resource. So it handles the request, gets whatever it is that is needed from the resource, and sends it back in the form of a response to the client which will be your Internet of things device.
(2) Client and Server
The client is generally less powerful. Thatis, it's a smaller machine, literally less power. It's slower. Where the server can be a very large, cloud-based server, very powerful, plugged directly into the wall, has lots of power, cooling fans, whatever it has. So, and the resource can be whatever you want, a bank of disk drives and some machines, whatever you want. So this is typically the model that you see Internet of Things devices communicating with the network through.
- Single server, one or more clients
- Server provides a server for clients
- Server manages a resource
- Server responds to requests from the client
1.1.3 Computer Networks: LAN
So, we're going to talk about three really broad classes of networks right now.
First, a LAN, local area network, stands for. And a local area network is just a relatively small network. Usually spans a building, a campus, a campus might have just one local area network, a floor of your building. You've had experience with local area networks I'm sure. And typically the way you access these networks is either through the wall, through a wall socket, an Ethernet jack in the wall. I see one right here. Also Wi-Fi routers. I see one in here too right. So we're familiar with those. Local area network is commonly for a building or something relatively small. Hierarchical system of computer-based devices which communicate Local Area Network (LAN) – spans a building or campus (Ethernet is most common).
1.1.4 Computer Networks: WAN
Wide Area Network(WAN) – Internet is best example.
Now, on the other side of that, there is awide area network, the other extreme. Wide area network, the best example of that is the Internet itself. That's an extremely wide area network. And a wide area network is just a lot more complex than a local area network. There is ahierarchy of machines that are communicating together.
1.1.5 Computer Networks: MANET
Mobile Ad Hoc Network (MANET)- continually changing network built from wireless, mobile device.
- Typically short-range
- Most common for IoT devices
Now in addition to this we have Mobile Ad Hoc Networks MANET. These are actually important to Internet of Things components because Mobile Ad Hoc Networks are composed of largely mobile devices. Thus the term mobile. And a lot of Internet of Things devices are mobile. And it's an ad hoc network because it reconfigures itself constantly. So that is maybe an Internet of Things device of cell phones let's say comes into range of the network then it joins the network. But you continue walking and you walk another block and you're outside of the network. So the network is reconfiguring every few seconds, maybe something is walking into the network. Something's moving out ofthe network, it's very dynamic. So that's what a MANET is. And a lot of Internet of Things devices, are part of network like that, of a MANET.
1.2 Lecture 1.2 WAN Structure
The internet is a wide area network (WAN).The WAN is generally the network that we want to communicate with eventually. So we're going to talk about the general structure of a wide-area network.These pictures are pretty high level, but they give you the general picture of what a wide-area network like the Internet would be, how it's composed, and what the different components are inside there.
(1) WAN is combination of LAN
So a wide-area network, like the Internet, is a network, it's a combination of local area networks. So if you think about the Internet, it's very ad-hoc. There's no regularity, meaning like right now, if I wanted to, I could build a network right here in this building, and it would beadded to the Internet. I could give it a name, and it would be part of the Internet. And so the Internet isn't one of these networks that's controlled and well-structured.
(2) LAN is very structured
(3) WAN is prettyunstructured
But, generally,wide area, the internet specifically, is pretty unstructured. There is someminimal structure, there has to be, but it's fairly unstructured. So at a lowlevel, at the leaf level, local area network level, there can be any number ofdifferent local area network types involved in the internet, just depending onwhat people want locally.
1.2.2 Local Network
So you start off with local area networks. You've got our local area network and you've got several hosts, Host one, two, three, and these hosts suggest confrontational devices that on the network. So basically computers or IoT devices. And they are all communicating with a component.
Now in this picture we have a switch. It could be hub or a switch. A hub is a network component that has several input ports. We're assuming wired right now. This can also be all done wirelessly, but let's talk wired for a minute. It's got several input ports, input-output ports, like in this case, this switch has three ports. So you could have a hub there that has three. And any time apacket is sent on one of the ports it is reflected, copied to the other ports. So if host one sends a message to anybody, that same message is spit out to codes two and three. So both of them get the message. That's what a hub does.
A switch is more intelligent. A switch says look, it looks at the packet header to see where it's going. So if host one sends a message to the switch and it looks at the destination message is host three, then the switch there is smart enough to know that that message should only be send to host three not to host two. So the switch is more intelligent about where it sends messages to, where a host is more dumb. But you got a host or switch some where in there that transmits data between the different input ports and output ports. So generally, LANs look like this.
Now, you canhave larger LANs, which involve multiple protocols. So you see on the left you've got a LAN, on the right you've got a LAN, you can combine them with a bridge. The bridge can communicate different LAN protocols. So maybe you got these LANs and one group, one department in the University decides they want to use this particular protocol, another department uses another particular protocol, but they want their machines to communicate so they put a bridge in between. And the bridge basically talks both protocols and can do conversions between the two. So you can group together these LANs into larger LAN components, let's call them. It's not a single LAN any more; you can have multiple protocols that are glued together by this bridge.
1.2.3 A wide area network (WAN)
Now, a wide area network is a set of these LAN's all put together with routers. So if you look at this network, this is by the wayis a vastly simplified internet. But you got a bunch of LAN's, and
they are all communicating to routers. And then the routers can communicate with each other to pass data. So, one LAN can communicate with a completely different LAN through these routers. So you notice every message is sent from one machine to another
has to, has many hops, what are called hops. Has to go through several different machines before it reaches its destination. So if you want to go from one LAN to another, you might leave this LAN and go to this router, and then go to another router and another
router and then finally back to the destination LAN and then to the host. So there is a sequence of hops, it is called routes, actually, of hops that you have to go through to reach your destination. And so with these routers, they are organized. This is very
simple, it's only three, but and realitiesa vast hierarchy of these routers and they have intelligent protocols that determine where they should send the packet next to reach its destination most quickly and avoid flow. You don't want to have one router that
receives too much data, maybe all the messages are running through one router; you'd like to spread out that data across the entire network, so that the one router doesn't get bogged down. So there are lots of protocols along those lines, and the internet
involves protocols like that to level out the traffic.
1.3 Lecture 1.3 Networking Components (Lab Tour)
This is an Ethernet hub. These are hard to find. They don't make many of these anymore, but this is a hub. This is a four port hub. It's got four Ethernet jacks. You can plug four things in. And it's very simple what a hub does. It receives a packet on one port and it just copies that out to the other three ports. So it's just a repeater in that sense. It's very dumb. And it's wasteful interms of bandwidth, right. Because if you're sending a message to, sending a message from one, from this port to this port. It doesn't need to appear on these two ports, but it does anyway. So, there's extra traffic with a hub. Ahub is very dumb and wasteful in terms of bandwidth. That's why you don't see them too much anymore.
Compare of these three components