Networking Basics

An intranet is a Local Area Network: a LAN.

The Internet is a Wide Area Network: a WAN.

Otherwise there is little difference.

 

Client/Server Architecture

There are physical Servers and Clients: a server computer, a client computer.

And there are “virtual” Servers and Clients: a server application (like a web server) a client application (like a web browser).

 

Behind every good server is a daemon

A server application can run on a server computer or on a client computer.

But generally a “server” application is a daemon (in Unix/Linux) or simply a server (in Windows).

 

A daemon runs a service

A service is not a server.

The Apache web server, for instance, is actually an http daemon.

Look in your Services applet: You’ll find Apache running as httpd, which provides http services to remote clients.

 

LAN topologies

Wired topologies include:

Star: all computers are connected to a common hub using Cat 5 cable. All newer networks use this.

Bus: all computers share a common coaxial cable, and connect using “balun” or T connectors. No new networks are created this way. There are many older networks still using it.

Ring: the famous “Token Ring” architecture is largely outdated. Computers on a shared loop of cable take turns transmitting. The computer that holds the “token” (really just a digital packet) gets to transmit. UPS, for instance, still has a lot of Token Ring gear.

 

Wireless LAN topologies

Wireless LANs are still rare in the enterprise because of security issues. They can be:

“Peer-to-peer” or “Ad hoc” networks, which function without a wireless hub

“Access point” or “Infrastructure” networks, which depend on a hub to coordinate traffic.

 

Now for the tricky stuff

The whole issue in any network is identifying who you are and who you’re talking to.

At the lowest level lies the actual network card (or network interface or NIC). Every NIC has a unique address, a Media Access Control (MAC) address.

The MAC address is a 12-byte number usually represented like this:

00:80:C8:8C:8E:49

 

MAC is forever; IP is transient

Ranges of MAC addresses are allocated to NIC manufacturers. In theory at least, every MAC address is unique forever.

Thus, we need a way to assign IP addresses to every client computer, and match up those IP addresses to MAC addresses.

 

MACs are ugly
IPs are painful
Hostnames a
re nice

One of the most important functions of networking is to make things human-readable (notice the –h option of many commands – see man du).

Nobody wants to say, “You can find my project on the share at 192.168.2.1.”

It’s lots easier to say, “Look in my share folder on Icarus.”

 

You already have a MAC address…
…so how do you get an IP address?

  1. Define it at installation. You’ll need to know the range of IP addresses your network uses, and choose an unused one.
  2. Define it later. Use ifconfig (see the man page) or the Network Configuration applet (neat command or Main>System Settings>Network).
  3. Get it automatically through DHCP, either from your server or from your router.

 

DHCP
Dynamic Host Configuration Protocol

DHCP is a service (yes, there’s a daemon involved) that has a pool of IP addresses it can assign to hosts as needed.

Within a network, this is typically the 192.168 range: any number from 192.168.0.1 to 192.168.254.254.

 

Take a deep breath: Here comes IP

192.168.0.1

What gives with this number?

Once again it’s a “human-readable” version of a very ugly number. The dots divide it into “octets,” which are called this because they are actually groups of eight bits that have a value like this:

10111001

 

Doing it binary

The trick with any 8 bits like these is that they can express, in base 2, numbers up to 254 (more specifically, 255 numbers from 0 to 254, inclusive).

So any IP octet can be (theoretically) any number from 0 to 254. Thus:

192.168.0.1

 

Can’t get anything past you

Some IP addresses are “non-routable,” meaning they won’t make it through a router onto the Internet. They’re strictly for LAN use.

The most common of such non-routable addresses begin with:

192.168.

and more specifically, most routers will try to take:

192.168.0.1 for themselves.

 

My network, your network

Generally, when you’re inside a LAN, you’ve got an IP address like:

192.168.0.56

This (more or less) means that I’m on the 192.168.0 “subnet” and my computer is number 56. All other computers are outside this subnet.

However, you may be behind a DSL modem (for instance) that’s passing traffic from the Internet to the 192.168.0 subnet, where it’s caught by a local router that passes it in turn to the 192.168.2 subnet.

Now your address will likely be something like 192.168.2.56 .

 

Subnet masks

The thing you notice in this example is that the beginning numbers are the same. Actually, to find each other, the computers on our 192.168.2 subnet only need the very last octet to find each other:

“Hey, 56, are you there?”

We can mask the rest of the numbers with this strange set of numbers:

255.255.255.0

In binary this is actually:

11111111111111111111111100000000

 

1 means I can’t see you

11111111111111111111111100000000

See what we’re actually doing?

Down at the bit level we’re just “masking” those first bits and looking at the last eight bits.

In our case, they’d equal (in base 10) 56.

“Hey, 56, you there?”

“Yeah! Here I am!”

 

Meanwhile, back at the router

If the router is providing DHCP service, you can configure a range of addresses for it to use, for instance:

192.168.2.10 – 192.168.2.225

This leaves you IP addresses at the low end for servers, and the high end for printers.

 

Subnet Classes

Class A:
0.xxx.xxx.xxx through 127.xxx.xxx.xxx
Millions of numbers per Class A subnet

Class B:
128.0.xxx.xxx through 191.254.xxx.xxx
65,534 numbers per subnet

Class C:
192.0.0.xxx through 223.254.254.xxx
254 numbers per subnet

Class D:
Multicast addresses, shared by multicast groups

Class E:
Reserved for experimental uses

 

What this really means

This business of Classes just means people “back in the day” thought they had far more IP addresses than they needed.

They split out subnets every three numbers, at the dots.

You can actually split out subnets at every single number, instead, and just reveal how many you’ve masked:

192.168.2.56/24

 

Masking one byte at a time

So you could mask three octets:

192.168.2.56/24

Or two-and-two-thirds octets:

192.168.2.56/23

Or two-and-a-third octets:

192.168.2.56/22

And so forth.

 

Classless Inter-Domain Routing

This method of slicing apart thinner slices of IP addresses is called Classless Inter-Domain Routing (CIDR).

You’ll see this notation a lot….

Assignment: Set your IP

  1. Open a terminal window.
  2. Run ifconfig and find your IP address.
  3. Open Main>System Settings>Network.
  4. Double-click your ethernet adapter.
  5. Set your IP operation to Manual, and enter the IP address you got in step 2.
  6. Save and restart your network.

 

Once you have an IP address how do you get a host name?

  • Set it during installation.
    The hostname will remain until you change it.
  • Set it from the command line: hostname Icarus
    The hostname will disappear upon reboot.
  • Set it using a configuration file: /etc/sysconfig/network
    The hostname is set – for good, until you change this file.

 

Assignment: Set your hostname

Edit /etc/sysconfig/network and set your hostname.

You may be fanciful but you may not be obscene.

 

Time to talk over the network

Now you’ve got a MAC address (set at the NIC factory), an IP address (set manually or by DHCP) and a hostname (set manually).

Let’s plug in….

 

Hubs

Once upon a time, every LAN used a hub. A hub is just a box everyone’s Cat 5 cable plugs into.

All traffic shares the same “room”: I hear everything everyone says, and everyone hears everything I say.

Once there are dozens or hundreds of computers on the same hub-based network, there’s tremendous traffic contention. It’s hard to be heard over everyone else’s shouting.

 

Switches

Then came switches.

Switches segregate traffic: each conversation is effectively isolated to a “private room.”

If I’m HostA and I’m talking to HostB, HostC can’t hear a word!

How do they do this?

MAC addresses. The switch remembers MAC addresses and matches them to IP addresses so it can handle every conversation like a private, switched telephone line.