侯智晟 meowheckerouo@gmail.com [TOC] # Switch ![](https://i.imgur.com/sPwIzek.png) How a beautiful device!!! XD I love it so much switch is helping out computer to connect to each other talk, hung up, chat and send data we could use a cable to enter its body (Hey hey :smiling_imp: ![](https://i.imgur.com/8FOwe9G.png) Waht is going on inside of switch !!!! It's good question ## Ethernet cable ![](https://i.imgur.com/KNWXtWG.png) it sends electrical signal going in and out of the port ## Switch Predecessor the one that came before them is hub he's disguising and dump XD the switch is smart but hub is not Hub is big mouth XD It will tell message to everyone who plugs it (broadcast) ## Packet tracer Download cisco packet tracer https://www.computernetworkingnotes.com/ccna-study-guide/download-packet-tracer-for-windows-and-linux.htm ## Hub ![](https://i.imgur.com/X5eLlN2.png) if when you sent a text to your friend, it didn't just go to your one friend it went to all your friends. And then when your friend response back to you it only went to you but it went to all friend as well XD that's stupid right? ![](https://i.imgur.com/dXAYCIk.png) ping message is used to see if other computer or server are up and can be reached ![](https://i.imgur.com/RLBPw2H.png) ![](https://i.imgur.com/zru20rK.png) what did you do that XD ![](https://i.imgur.com/4cx6U20.png) hub is idiot, he's got not brain he job is repeat electrical signal whenever your computer sends down wires. hub is going to go and send out to everyone. ## Switch Workflow the switch can do all this magic because he has brain, he'll remember where they are switch port interface, he store that information in something called the CAM(contents address memeory ) table the switch don't know johnny as johnny. the swtich know johnny as layer 2 Address ![](https://i.imgur.com/aUIMTfR.png) ![](https://i.imgur.com/KxQI7yL.png) Information at PC 0 ![](https://i.imgur.com/eM45qxH.png) Information at switch Switch is lay 2 device which only care about layer 2 information (it don't care other people ![](https://i.imgur.com/RV0wwAg.png) Information at PC 1 ![](https://i.imgur.com/aqpQwrE.png) ## Switch CLI ``` enable # show mac-address-table ``` ![](https://i.imgur.com/bEN1PDA.png) he just know PC 0 PC 1, but he didn't know PC 2 But doesn't matter, he has the brain . He can learn it and store it, if PC want to ping or receive ping message from other PC So, he learning where everyone is by learning their mac address. (CAM) ## Frame ALL in the layer 2 message we called frame (switch,frame layer 2) ## wireless access point they're basically doing the same job as the switch, but they more like the hub than switch ![](https://i.imgur.com/S4rTtlH.png) AP just an extension of the switch, SO we can use AP to connect to switch with an Ethernet cable. ![](https://i.imgur.com/MXoSY6s.png) ![](https://i.imgur.com/N4KY96P.png) ![](https://i.imgur.com/tMOZfP2.png) ![](https://i.imgur.com/LHS4sxn.png) That's why wireless connection more like the hub. In fact, all the message are going to each device is not worst part with hub. It's just a traffic jam collision all the time which is switch is great. ## Quiz ![](https://i.imgur.com/tBzPmLd.png) the answer is D because ,Ethernet frame is created which would contain the source mac-address as that of PC1 and destination mac-address of PC2. [reference link](https://www.networkshelf.com/how-does-a-switch-populate-cam-table/) ![](https://i.imgur.com/nWUEFsn.png) the answer is D # Router Router ![](https://i.imgur.com/cA6TOuP.png) Router connect us to the internet they also connect this to other networks ARP source MAC -> broadcast MAC(FFFF.FFFF.FFFF) ![](https://i.imgur.com/vNorz2B.png) And then our ARP message are going to where ![](https://i.imgur.com/T98vGtQ.png) ![](https://i.imgur.com/46EhDE9.png) ARP Response ![](https://i.imgur.com/8LoUbiy.png) ![](https://i.imgur.com/CuD2Jyl.png) ![](https://i.imgur.com/YdBISmz.png) Router between the network has the map of how to the thing ![](https://i.imgur.com/ZYyzJZE.png) ## DNS Server ![](https://i.imgur.com/08MjqKI.png) ![](https://i.imgur.com/laED3Je.png) ![](https://i.imgur.com/oUcisFD.png) ![](https://i.imgur.com/qt0L0uu.png) ![](https://i.imgur.com/AdyQb0q.png) --- Now we get destination IP form the DNS server. we can use http to get web response. ![](https://i.imgur.com/ITJVbZs.png) Request ![](https://i.imgur.com/Pjvmcuy.png) Response ![](https://i.imgur.com/AV3BImg.png) # TCP/IP & OSI ## Network model The model we used to day is called TCP/IP, this is what every computer supports and has implement into their system the TCP/IP mode and they also call TCP/IP stack. TCP/IP The tradition view of TCP model - application - transport - network - data link - physical OSI The view of OSI model - application - presentation - session - transport - network - data link - physical Quiz ![](https://i.imgur.com/tr6CmS4.png) ans:A note: WAP is wireless access point, this was kind of trickly one, because they do operate at layer 2, they also operate layer 1 Question is primarily at layer 2,So that primary focused on layer 2 So, we can select D option. ![](https://i.imgur.com/58opASO.png) ans: A, C ## Life Example Consider at the following figure!! If Johnny want to buy the delicious coffee, how network help with Johnny. ![](https://i.imgur.com/Ph4s9yN.png) Ok Now, he have to use transport layer to transport his packet, and this way he have two options. One is TCP. another is UDP Versus tcp -> reliable udp -> more fast port 443 -> https port 80 -> http ![](https://i.imgur.com/9xORk5n.png) **Network layer** deal with ip address and routers **Data link layer** We're deal with mac Address we're giving our switch direction to the next stop ![](https://i.imgur.com/cMHVsDv.png) the ip address information inside a new layer 2 header and he change the source and destination mac address ![](https://i.imgur.com/qCmu8Z4.png) Quiz 1 ![](https://i.imgur.com/xTofZho.png) Ans : a c e B and D is impossible B: Because delivery should be layer 4 to deal with, ensuring -> TCP D: logical and physical addressing -> probably is layer 2 f: It is presentation layer 6 ![](https://i.imgur.com/LuY6VIK.png) Ok this problem is fucking easy, if you know 3-way handshake Obviously, the answer is B ## Application layer The application layer is kind of the portal an interface for a program on the computer that need the network like the web browser or video game that you play online ![](https://i.imgur.com/V7FCWpW.png) ## Presentation layer Presentation layer is responsible for making it presentable The two of the main thing you're going to be worried about is data format and encryption. - Data format - file type (like .pdf , .html, jpg, .xml ...) - Encryption > - SSL(security socket layer Making sure our data that's being sent back and forth can't been seen by old hackers XD That's done at the presentation layer so what the presentation layer is done with our data he's made it look pretty putting into the right form. ![](https://i.imgur.com/B9FS4SW.png) ## Session layer the data jump off the session is to open up the communication to start the conversation between your application and web server - make sure things - have been authenticated - conversation is smooth All the stuff still going through all the other layers and brunch of thing are happening. It's manage all those different session on your computer ### protocol #### L2 TP (layer 2 tunneling protocol we'll see this a lot of vpn connection #### RTCP (remote transport control protocol) it's helps set up phone calls and speaking of the phote calls #### h.245 h.245 which helps set up the video calls #### socks socks proxies also operate at this layer, when you're trying to hide yourself as a hacker XD. ## Transport layer TCP is so reliable because TCP is kind of naggy XD TCP (transport controls protocol) It with strong emphasis on control because it want to control every bit of communication. UDP Do you know Why UDP is fast, because it doesn't care if you get the message. It's doesn't wait for verification. it just only send send send send send send XD If we open youtube what happen will occur? let us try it TCP (video) ![](https://i.imgur.com/Wtp9Vnb.png) UDP(html.body) ![](https://i.imgur.com/cxAwYNh.png) ### Port FTP port : 21 SSH port : 22 RDP port : 3389 Port 59889 is ephemeral port. ## Quiz ![](https://i.imgur.com/8EjZJtA.png) TCP: FTP, HTTP, SMTP UDP: DHCP, SNMP TFTP TCP and UDP: DNS ![](https://i.imgur.com/eaZ1wOD.png) Answer: C # Network Design ## BAD Network :-1: Now to find the bad network we don't have to look very far. just look in the house. Basically, home network is suck. XD A lot of businesses when they first start out their network look very similar to a home network. they make some big boo-boos some very big mistake. ### Home Network In the home network, your route isn't just your router. It's also your switch your modem even your web ![](https://i.imgur.com/wtm0GqI.png) So, it's doing a lot of which is a horrible thing Uh,I think you don't want one device doing everything. :laughing: ### Small Business ![](https://i.imgur.com/OE23nXX.png) Hold on a second, if the switch out of the port, we have more thing to connect more computers or devices We need more port to connect device to the network. ![](https://i.imgur.com/7dBgH3P.png) Hold on, what did you do !!!!!!!!!! what did you do !!!!! what did you do !!!!! :rolling_on_the_floor_laughing: I am sure a lot of you know network that's probably scaring you ![](https://i.imgur.com/l6FPksA.png) This is baddddddddddd The problem is if the cable breaks, other switch will gone A single point of failure, don't ever have those in your network ever :no_good: Daisy chaining our switches together. Don't do that So, how can we make it better? ## The 2-tier Network Design Multilayer-Switch(L) Multilayer-switch can deal with ip address and mac address, and it's blazing fast ![](https://i.imgur.com/Cp08GMu.png) ### Distribute layer Distribute layer's job is to distribute all the packet and all the frame through the network. ![](https://i.imgur.com/Aqc9mtC.png) ### Solve the single point of failure between the router and multilayer-switch We can add one more distribute layer switch ![](https://i.imgur.com/yEhtEQD.png) man look at all that redundancy it's beautiful but it's expensive. ok this is ideal, a lot of companies aren't willing to pay that much for stuff. ![](https://i.imgur.com/Y6Hi6OW.png) ## the 3-tier network Design Core layer ![](https://i.imgur.com/msZv0ns.png) He just fast. XD He associate with low latency and high reliability. it as the network backbone. ![](https://i.imgur.com/Bp4crlo.png) ![](https://i.imgur.com/rB1sbnv.png) ## 2-tier network design it combines with the core layer with the attribute layer, and called it the collapsed layer. the function of the core was collapsed into the distribution layer. they have to do - a bunch of the routing - inter-VLAN routing - access-control list - network backbone # Data Center Networks ## Concept A data center is all about severs connect to things or the internet Google data center ![](https://i.imgur.com/9poWd19.png) full of servers, routers and switchs Pretty much any resource you access over the internet is going to be inside a data center --- Do all companies have and use data center? Ans: Yes But not all in the same way Example Meowhecker.com is online through a website that lived on a sever Offer server options - You can build one room or one rack in your home or company - Rent space in a data center (majority) - Cloud ![](https://i.imgur.com/v22swg5.png) ## Old Data Center Network Design Rack each of these racks would have a bunch of server Tor switch is at top of the rack ### Virtualization #### East-West traffic With virtualization, our data center become more distributed which basically means that server can communicate with each other that we called east-west traffic. But now, the problem is that we didn't design our network for east-west traffic East-west traffic accounted for the majority of our traffic ![](https://i.imgur.com/Zq2ibxV.png) it only can handle north south traffic(server-client), that is problem with this design. ## Spine-leaf design We need something faster, something quicker ### leaf switch They're still going to server the function of being the access layer for the server in those rack. Each of leaf switch is connective to every spine switch ### spine switch spine -> backbone Spine (Backbone) is like you body support the entire network has to handle the most bandwidth, most packet going through it. ### Why is this better? Because of - We care about east west traffic (server-server)(70-80% of our traffic) - It go to another server just only two hops, always and all the time. Notice: these connection switch to switch is not layer 2. leef switch and spine switch they're both layer three switch or multi-layer switches We don't worry about any one of links be blocked by spanning tree which is loop prevention mechanism. ![](https://i.imgur.com/rg5jWhV.png) Layer three routing ![](https://i.imgur.com/t3PrG7N.png) Topology Network ![](https://i.imgur.com/0t79Z2p.png) ## Quiz ![](https://i.imgur.com/eXvEcJB.png) leaf/spin node = leaf/spine switch ANS: E Because the leaf switch can't connect of each other. ![](https://i.imgur.com/sOe9x0b.png) Ans:B, E