online posts 15
networking 101, part 2: hands on

task 1.1 · chapter 1 of 3: your computer · 25 min

Meet your computer

objective

Open a terminal on the lab’s laptop and find its MAC address, IP address and prefix with ip addr. Then do the same on the printer, and work out its network and broadcast addresses.

you edit, in the labYour answers

in the lab app: Your answers, under the guide. Check task saves them

given
Lessons used1.1 hosts and MAC addresses, 3.1 IP addresses, 3.2 CIDR
Log inclick laptop on the Topology tab (and printer for the challenge)
Your answersunder the guide, in the lab app
new to this? step by stepbeginner
  1. Open the lab (the button on the lab’s page) and wait for the top bar to say network up.
  2. On the Topology tab, click laptop. In the laptop tab: ip addr show eth1.
  3. Copy the MAC address, IP address and prefix into Your answers, under the guide.
  4. Do the same for the printer (click printer on the Topology tab), then work out its network and broadcast addresses.
  5. Check task 1.1, under the guide.

more in meet the lab

1 explain

Asking a computer about itself

A terminal: typing to a computer

Most of the time you use a computer by pointing and clicking. Network engineers mostly type instead. They open a terminal: a window where you type a command (an instruction, one line long), press Enter, and the computer types its answer back underneath.

The terminal shows a prompt when it’s ready for your next command. In this lab the prompt says which computer you’re on, so you always know who you’re talking to:

laptop:~#

You type after the #. (The ~ means my home folder; you can ignore it.)

in one sentence A terminal is a window where you type a command and the computer types its answer back.

Logging in to another computer

The lab’s first tab, Topology, draws the lab network: every computer, the switch and the routers, and the cables between them. Hover over one to see what it is, what it runs, where each of its ports is cabled, and whether it’s running.

Click one, and a terminal on that computer opens in a tab of its own, named after it: click laptop and you get a laptop tab. That’s logging in: everything you type in that tab goes to the laptop, and the laptop answers. The prompt says which computer you’re on: laptop:~# on a host, r1# on a router.

You can have several computers open at once, each in its own tab, and switch between them by clicking the tabs. Clicking the computer on the Topology tab again takes you back to its tab. When you’re done with one, close its tab with its ×.

in one sentence Click a computer on the Topology tab to log in to it: its terminal opens in a tab named after it.

Interfaces: the computer’s name for its network cards

In lesson 1.1 you met the network card: the part of a host that sends and receives. A computer calls each of its network cards an interface, and gives each one a short name. On Linux, the system these hosts run, the names look like this:

NameWhat it is
eth1a network card with a cable (eth is short for Ethernet, the kind of cable and the rules it uses)
lothe loopback: a pretend card the computer uses to talk to itself. It’s on every computer, and never leaves it

Each lab host has one real network card, eth1, with a cable to the switch (or, for the servers, to r2).

in one sentence Linux calls a network card an interface; here the real one is eth1.

ip addr: what does this card know about itself?

The command ip addr (short for IP address) lists every interface, and for each one its MAC address and its IP addresses. It’s the first command an engineer types on a computer that won’t connect, because it answers the first questions: is the card up, does it have an address, and which network is it on?

2 show

Reading ip addr

Here’s what ip addr show eth1 prints on the laptop (show eth1 means just this one card). The table under it names each part you need:

laptop:~# ip addr show eth1
86: eth1@if87: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether aa:aa:aa:11:11:11 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.100/24 scope global eth1
       valid_lft forever preferred_lft forever
PartWhat it meansFrom lesson
eth1the interface’s name. (The numbers around it are the computer’s own bookkeeping: skip them)
UPthe card is switched on, and LOWER_UP: the cable is plugged in and working at the other end1.2, layer 1
link/ether aa:aa:aa:11:11:11the MAC address. link means layer 2, the data link layer; ether means Ethernet1.1
brd ff:ff:ff:ff:ff:ffthe broadcast MAC address: everyone on this network2.2
inet 192.168.1.100the IP address. inet means IPv4, the four-number kind3.1
/24the prefix: the first 24 bits are the network part3.2

Look at the MAC address: aa:aa:aa:11:11:11. It’s the laptop from lesson 1.1. We gave the lab’s hosts easy MAC addresses on purpose, so you can tell them apart at a glance. A real card’s MAC address comes from its factory and looks more random. (The switch and the routers have random-looking ones, as you’ll see in chapter 2.)

ip addr writes MAC addresses in small letters. aa:aa:aa:11:11:11 and AA:AA:AA:11:11:11 are the same address: hex digits don’t care about capitals.

3 follow along

The laptop

  1. Log in to the laptop: on the Topology tab, click laptop. A laptop tab opens, with the prompt laptop:~#. You’re on the laptop now.

  2. In the laptop tab, ask it its name, to be sure:

    run in the laptop tab
    hostname
    

    It prints laptop.

  3. List every interface:

    run in the laptop tab
    ip addr
    

    You’ll see lo with 127.0.0.1 (the loopback, always there) and eth1, the laptop’s real network card. You may see some extra entries with names like tunl0 or gre0, marked DOWN. They’re spare tunnel interfaces that come from the bigger computer this lab runs inside. They have no address, and nothing uses them: skip them.

  4. Now just the one card:

    run in the laptop tab
    ip addr show eth1
    

    Find the three things from the table above: the MAC address after link/ether, the IP address after inet, and the prefix after the slash.

  5. A short version, one line per interface, is handy once you know what you’re looking for:

    run in the laptop tab
    ip -br addr
    

    -br means brief: name, state and address. (The MAC address isn’t in this one: ip -br link shows it.)

  6. Fill in the laptop’s three answers in Your answers, under the guide:

    editYour answersunder the guide
    The laptop's MAC address: aa:aa:aa:11:11:11
    The laptop's IP address: 192.168.1.100
    The laptop's prefix: 24
    

    It saves when you press Enter or click away, and always before a check.

in one sentence ip addr show eth1 gives a card’s MAC address (link/ether), its IP address (inet) and its prefix (after the /).

4 challenge

The printer

Log in to the printer and answer its five questions in Your answers:

  1. its MAC address, IP address and prefix, from ip addr;
  2. its network address and broadcast address. No command prints these: work them out from the IP address and the prefix, the way you did in lesson 3.2.

Then click Check task 1.1, under the guide. It checks the laptop’s answers too.

hint

On the Topology tab, click printer. In the printer tab: ip addr show eth1.

hint

With a /24, the first three numbers are the network part. The network address keeps them and puts 0 at the end; the broadcast address puts 255.

show the solutionYour answers

or let the lab do it: Solve it for me, next to Check task, does the task and fills in the answers, printing every step

The printer's MAC address: aa:aa:aa:22:22:22
The printer's IP address: 192.168.1.20
The printer's prefix: 24
The printer's network address: 192.168.1.0
The printer's broadcast address: 192.168.1.255

The printer’s network part, 192.168.1, is the same as the laptop’s. They’re on the same network, so the laptop can send to the printer straight through the switch, with no router: the rule from lesson 3.2. Task 2.1 watches that happen.

5 check: run it, then prove it

Check task 1.1 under the guide, in the lab app

when it's right, you'll see

╭─ task 1.1 · meet your computer
│  ✓ the laptop's MAC address (follow along): aa:aa:aa:11:11:11
│  ✓ the laptop's IP address (follow along): 192.168.1.100
│  ✓ the laptop's prefix (follow along): 24
│  ✓ the printer's MAC address (challenge): ...
│  ✓ the printer's IP address (challenge): ...
│  ✓ the printer's prefix (challenge): ...
│  ✓ the printer's network address (challenge): ...
│  ✓ the printer's broadcast address (challenge): ...
╰─ 8/8 checks passed  verified