Networking Trivia

5 03 2014

flickr: by estebanvillano

In today’s post, I’d like to share some basic networking minutiae mostly from a Linux perspective as if it were a quiz. But, I’ll do one better, and share the results of all my Goog-ooling. Disclaimer: I am not a sys admin nor network engineer so use the below answers provided at your own risk.

What are  the port numbers for SSH, HTTP and HTTPS? They are as follows:

SSH    - 22
HTTP   - 80 
HTTPS  - 443 

Source: http://en.wikipedia.org/wiki/Port_(computer_networking)#Common_port_numbers

But what about port 8080?  According to Ask.com, it’s a popular alternative to the default for the web http protocol.

Let’s move on.  What command should you run to check file system consistency?  Hint: the command name is an abbreviation.  Give up? The command which runs automatically when the computer boots on a Linux (or Unix system) is called fsck which stands for file system check. One needs to take care about how to use it manually since running it indiscriminately results in bigger problems.   See  http://en.wikipedia.org/wiki/Fsck to determine whether you really need to manually run the tool and how to responsibly use it.  As an aside, there’s also a little joke about “fsck.”  According to Dennis Ritchie, it formerly had a slightly different spelling.

Changing gears, what is the command to monitor CPU usage?  Well, on WindowsXP (are you ready for April 8, 2014?), I would just press Control-Alt-Delete to bring up the Task Manager and then I would click the Performance tab.  On a Linux system, the command is called top and you may find more info here.   I also tried it myself and it is quite simple to use. But how do you stop it??? Just press the letter and that’s it 🙂

Wait, there’s more fun.  What do the three numbers represent when typing UPTIME?  Okay, this question is a little misleading because you don’t type anything except the command whose output are three numbers dealing with Linux load averages.  Apparently, those involved with networking acquire this basic information at some point, understanding that these numbers  “…  represent averages over progressively longer periods of time (one, five, and fifteen minute averages), and that lower numbers are better. ”  (See Understanding Linux CPU Load – when should you be worried?)

Let’s return to the file system.  What are the three different file times associated with a UNIX-style file?  If you guess  archive, creation, modify time, well, I have some bad news.  Creation time is not something that Linux keeps track of (unlike Windows).   The correct answer is atime (access time), mtime (modify time) and ctime (change time of inode for file or directory); see here for more info.  These times are not something you actually set but are OS-dependent. The following indicates the different timestamp names and their respective commands:

  atime: ls -lu 
  ctime: ls -lc 
  mtime: ls -l 

Source: http://www.unixmantra.com/2013/04/mtime-ctime-and-atime.html#.UxenBD-zHTo

Example:  when I use the touch command, I cause a file to be created.  Then, I can alter its contents in vim by perhaps inserting a few useful commands, such as showing the new file’s mtime, atime, and ctime. After saving the file, I ran it which produced the following output:

-rwxr-xr-x 1 slevy slevy 77 Mar 5 14:56 ./test_time_stamps
-rwxr-xr-x 1 slevy slevy 77 Mar 5 14:57 ./test_time_stamps
-rwxr-xr-x 1 slevy slevy 77 Mar 5 14:56 ./test_time_stamps

Note: when the mtime changes, the ctime gets updated also which explains why the first and third lines have the same timestamp.

Here’s another question, completely unrelated.  How many effective hosts are in a /23 subnet? The answer is immediately available in the following cheatsheet: http://www.aelius.com/njh/subnet_sheet.html.  For a deeper understanding, you may wish to peruse this  resource which clarifies the math involved. And, there’s more info here.  Basically, one needs to know that for the traditional IPv4 addressing, there are 32 bits.   In this case, the formula becomes: 32 – 23 = 9 and 2 to the power of 9 = 512, subtract 2 for the reserved network and broadcast host addresses and the result is 510. Voila! Of course, all of the forgoing will be overturned when IPv6 addressing becomes the standard with its 128-bit addresses.

And, now for another question to ponder.  What username does root wrap to when accessing an NFS partition when root_squash is on?  Hint if root is all powerful, who is then the least powerful?  How about nobody?  Almost, but not quite.  According to this RedHat resource,  if one is a remote root user and remote_squash is on, then the nfs system will give the user the lowly id of nfsnobody and thereby prevents such a user from exercising root privileges. The default is root_squash but if you need to override that setting you may if you use the term no_root_squash. “Typically this is needed if you are hosting root filesystems on the NFS server (for diskless clients). If you don’t things break…” (source: https://www.linkedin.com/groups/What-is-use-rootsquah-norootsquash-49301.S.192942962.)

Okay, now let’s wrap this up with one final albeit morbid-sounding question.  What is the default kill command in *nix systems? Personally, I think that command ought to have been called the terminate command but I guess someone else wished to type fewer letters.  So, what  is the answer?  If you say “kill -9”, that is definitely wrong because that forces a process to end.  The question however is asking for the default command that ends a process. This involves signal processing. The default is not a command technically speaking but a signal, known as signal 15 and aka SIGTERM.

Hope you’ve enjoyed this bit of networking trivia.

This work is licensed under a Creative Commons License

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: