Showing posts with label Internet. Show all posts
Showing posts with label Internet. Show all posts

Friday, March 1, 2019

Computing - the Internet, Cont.

I debated which way to go from here - in that I can go into much greater detail on how the internet works, or I can focus more on what really is relevant to the general user. There's all sorts of important things for a network engineer to know, but going into the OSI model or the alphabet soup of various protocols (EIGRP, BGP, OSPF, as well as the TCP handshake, SYN Flooding, and more) seems more likely to cause a non-technical person to get overwhelmed rather quickly.

So I'm going to talk about databases for a bit. It's relevant, I promise, and I'll try to turn it into a personal story of sorts.

When you grow up with technology, but not a techie - in my case, at least - you just sort of absorb odds and ends as you come across them. Databases have been like that for me, a topic that started impinging on my awareness about a decade ago.

It's not that I didn't know the term, or have some general sense of what it meant, but when a colleague of mine decided our reports would be easier to work with in a database rather than the excel files we'd been using, I started learning more about when and why their important.

And the key to understanding the most common type of database is to understand relationships. That is, if you wanted to create an excel file for customer orders you would probably have to enter in the customer name and address for every single time that the customer placed an order.

If it's in a database, on the other hand, you can have a customer table and an order table, and establish a relationship between the two (i.e. a customer id number). In the customer table you only have to enter the address once, but because it's associated with the corresponding customer id in the order table you can easily create a table showing all the orders that customer has placed. Including the mailing address.

Businesses use these all. the. time. That way you can have a table showing all your employees, and a separate table showing all the wages paid, as well as a table for all customers, and a table for all the orders they placed, and a table for all the bills charged to the customer... and businesses can run queries against that database to get the information they need. Like a history of all the orders a particular customer placed, or an aggregate of all orders from a particular region, or all the customers who owe the company money.

Although I've worked more with Microsoft Access than the big enterprise databases (Oracle, MySQL, SQLServer, etc.) but most have a similar structure for querying the data - Structured Query Language (hence the 'SQL' in the databases above).

SQL statements are actually fairly obvious when you keep them simple, though they can grow to be horrendously complicated. A basic query might look like this:

SELECT * FROM Users WHERE Name = 'foo' AND Pass = 'bar' 

It's basically saying you want to select everything from the Users table where the name is 'foo' and the password is 'bar'. (The * is a wildcard, it means select everything that matches the criteria)

So why is this important?

Well, websites these days are interactive. You don't just download a page and read what it says. You login - to check your bank account, or the news for a site you've subscribed to, to check your friends on Facebook, or post to Instagram, check your employee benefits, request time off, or any number of things online - and that login is generally used to find your specific information in a database.

When you go to a website, well... to use the postal service analogy, that site is getting thousands and thousands of letters a day, and it is passing your particular information to a warehouse (the database) that processes your request and sends back the information you wanted.

The website and database together have to a) keep track of your mail vs. all the other user's mail, so you don't have to send your username and password every time you send a letter and b) make sure that you only see your information, it doesn't send you someone else's response or let someone else see yours.

That means businesses operating over the internet generally have a way of tracking your session (that's where cookies come in to play, though it's not the only way of doing so) and some sort of system for authenticating you as the user and granting access to the information you are authorized to see.

And most of those have to deal with the exact same problem I listed when describing the buffer overflow - user input.

Thursday, February 28, 2019

Computing - the Internet, Cont.

I used the postal service to describe how information gets routed on the internet, but that doesn't quite explain what goes on when you type a URL in a browser.

A couple of points need to be made here - we remember names better than numbers, but computers run on numbers. Binary, to be exact.

When we put 'www.google.com' into a browser, we are sending a request to whatever computer hosts the file for that site, and asking them to send us the file.

However, it's a bit like putting 'New York, NY' on the letter... and then the post office asks us for the full and complete zip code, to include the final four digits (the zip might be 10004-1007) In computing, that's actually the IP address... which is really just a fancy way of making all the 1s and 0s a little more human readable. (254.171.170.75 is just a fancy way of saying 111111101010101110101010010010111 by breaking the binary into groups of eight and converting to decimal. Since 11111111 is 255 in decimal, each grouping can store a number between 0 and 255. They started running out of numbers as the internet boomed, and came up with a few workarounds to help extend the system for a little while, but ultimately came up with IPv6 - or Internet Protocol version 6 - as a better solution. IPv6 numbers are in hexadecimal, so you'll see something like FE80:CD00:0000:0CDE:1257:0000:211E:729C, which is again a fancy way of organizing a string of 1's and 0's)

So the computer needs a number, and the address you entered is not it. So the computer has to have a way of looking up what number is associated with that address, sort of like my zip code finder above.

In computers, the entire process relies on what's called a Domain Name Server, or DNS. Most of what you can find online likes to describe DNS as something like a telephone book, but I used zip code for a reason.

Let's say you go to the USPS zip code finder and enter an address in New York, NY... but someone's hacked that site, and it gives you the zip code 92101-1007. The post office routes it off the zip code, so that letter is going to San Diego, CA. You  may have intended to send it to New York, but there's this thing called 'DNS poisoning' where hackers will give your computer an address that isn't the one you intended. If they're really good, they'll even make the site look exactly like the site you expected. It's just, well, it might record your login information or trick you into downloading something malicious.

So you entered an address in your browser, and your computer looks up the number associated with that address. It then sends out the letter(s) to your destination, asking for the web page. Your destination receives your request and serves a response, sending a stream of letters back to you.

That's a very rough idea of what's going on, and I'll dig into it a bit more...

Another time. I've been messing around creating VMs (virtual machines) this morning (CentOS installed fine, but why oh why does my Ubuntu say there was an unresolvable error? Ugh! And I need to find out if I have any old Windows software lying around. Even though I'm just creating some VMs to practice my skills with, virtual machines are computers in their own right. They use the keyboard, mouse, CPU, display screen, etc. that the physical computer does.  See, your CPU is amazingly powerful... and if you're not using it, it sits idle. Once you've downloaded that webpage and sit there reading it, there's not really a lot for your CPU to do. Some genius realized that you can make computing more efficient if you kept that CPU humming... so putting multiple virtual computers on one physical computer was one way of doing that - and provided some additional layers of security and whatnot. Anyways, I'm not really intending to use the VM as a Windows XP or Windows 7 machine, but it could be used that way and the software is proprietary.)

Anyways, I don't really feel like delving further into internet basics.


Wednesday, February 27, 2019

Computing - the Internet

I'm feeling rather proud of myself. After a conversation with someone yesterday, I installed ESXi on my home built computer. I was concerned at first, as it wasn't connecting to the internet... but then I realized that I didn't have a physical ethernet cable plugged in and had been relying on the wireless NIC. I plugged the cable in this morning, and it's working fine. I even managed to access it from another computer. So now I'm downloading some files necessary for creating virtual machines, so I can try creating a virtual lab to mess around in.

Anyways. Today I wanted to talk a bit about the internet. The usual place to start is with a rather technical discussion, but I'm trying to translate these concepts into everyday language, so I'm going to try something different. Understand that I am vastly oversimplifying some things, and skipping over a lot of detail here.

With that out of the way, let's talk about the internet.

Actually, let's start with something most people are more comfortable with - tracking a package.



Whether it's USPS, DHL, UPS, or Amazon, every carrier will show the progress of a package as it moves from it's source to it's destination. I think most people understand what is going on here without thinking about it too much, either.

That is, the carrier isn't going to send your mail directly from one place to another. There's too much mail going to too many places and if you need that to happen, you'd hire a courier to do the job.

Instead, the post office (and other such carriers) regularly carry mail to nearby facilities, and will route everything they receive to the facility best suited for sending that mail on to it's final destination. As you can see in the picture above, the package goes from Chicago to Indianapolis before going to Fort Wayne. Indianapolis is a bit further south than Fort Wayne, so routing it this way added a bit more time than sending it directly to Fort Wayne, but there probably isn't enough mail going to straight to Fort Wayne to warrant a direct connection... so Indy was the closest place along the way (and much closer then sending the mail to St. Louis!).

It's all done for the same reason airlines have hubs, and it's difficult to get a flight straight to your destination unless you live at one of those hubs, and are going straight to another hub.

The internet is a bit like that, as well. When you get on an internet browser and put in a location, the page you're looking for is not floating out there in the digital aether. It's sitting on a computer somewhere. (Okay, so it might be sitting on a virtual machine, with twenty other virtual machines... but those are all sitting on a physical machine somewhere. Ultimately, everything you do on the internet is tied to a real, physical place.)

If you want to go see funny cats, and you put https://icanhas.cheezburger.com/lolcats in the browser, that /lolcats indicates a subdirectory where the file is stored, much like you might find a picture by going to C:\Users\Yourname\Pictures.

Your internet browser will send a request for the webpage to the site (called a 'server', since it serves webpages to whoever asks) and that site will send you the information you requested. The browser knows how to read the result and present it to us with all the fonts, colors, and pictures the creator intended.

Although the internet works a bit like the postal service, there are also (numerous) key differences. For one thing, a post office generally stays open for years. Decades even. Carrier routes are somewhat stable, and any significant changes tend to be advertised well in advance.

In contrast, routers may appear and disappear on the internet in the blink of an eye. Someone may add a router in one location, and another might break down and go off the net. So the routers, or 'sorting facilities' of the post office, regularly send out messages to their neighbors going "Are you still there?"

And whenever a new router comes online, it sends out messages to all its neighbors saying "Tadah! I AM HERE!"

The sorting facilities constantly have to update their routing information to take into account any sudden loss of connection, and they have to sense whether their neighbor is getting flooded with mail so they can lighten the load a bit and route things to a different facility.

There are other differences as well, such as size limits. If you wanted to send a letter, or mail a package, most of the time you can do it all at once. And when you send it, you can send it off and forget about it, relying on the carrier to get it where it needs to be. (Like UDP, an internet protocol that fires and forgets.)

That won't work for certain things, though I'm editing to say video is UDP, because waiting for confirmation slows it down too much. Web pages and file transfers are TCP, since you want to make sure everything arrives. 

The size limit means your letter might need to be broken down into 20 letters, and those letters might get routed differently... so letter 18 might arrive at its destination before letter 12. And letter 13 might fall into a puddle, and be completely unreadable. The letters have to be sent and received in a timely fashion, and put in order. Otherwise you'll get lag, and bits of the video will be missing.

So you need mechanisms for keeping track of what order the letters were sent, you need to verify that all the letters were actually received correctly (and that any missing letters are resent), and the letters ought to be sealed so that you know if someone got in and tampered with it.

And so on, and so forth. You can get into the nitty gritty details on how this is managed if you want, there are plenty of resources out there.