DHCP server installation and configuration linux Debian; ISC DHCP Server

The Protocol

The Protocol

DHCP server basic principles; installation and configuration; ISC Server on a Debian Linux system.

This post is part of a bigger Debian material that you can access here.

Content

  1. The DHCP protocol
  2. Precautions before we start
  3. Installation of ISC DHCP Sever.
  4. Configuration of the server.
  5. Checking the results

The DHCP protocol

 


The DHCP protocol was created to configure computers automatically just by connecting them to the network. That means that thanks to this protocol you dont need to do any thing to be able to connect to certain networks. you connect a new computer and the computer it self is able to talk to a server and get what it need to be able to connect and use the network resources that are available. but tel’s leave the smart guys to define what is the protocol.

“DHCP (Dynamic Host Configuration Protocol) is a communications protocol that lets network administrators centrally manage and automate the assignment of Internet Protocol (IP) addresses in an organization’s network. Using the Internet Protocol, each machine that can connect to the Internet needs a unique IP address, which is assigned when an Internet connection is created for a specific computer. Without DHCP, the IP address must be entered manually at each computer in an organization and a new IP address must be entered each time a computer moves to a new location on the network. [The protocol] lets a network administrator supervise and distribute IP addresses from a central point and automatically sends a new IP address when a computer is plugged into a different place in the network.”

Taken from: http://searchunifiedcommunications.techtarget.com/definition/DHCP on 2014-03-04.

As a mater of fact what happens between the Client PC that wants to connect to the network and the server is a cert of conversation of messages until the client gets and IP addess. That is valid for a certain period of time defined by the server; check out the first picture. The messages include but not only the following.

  1. DHCPDISCOVER (taken from wikipedia) It is a message that marks the beginning of an interaction between client and server. This message is sent by a client (host or device connected to a network) that is connected to a local subnet. It’s a broadcast message that uses 255.255.255.255 as destination IP address while the source IP address is 0.0.0.0
  2. DHCPOFFER It is message that is sent in response to DHCPDISCOVER by a server to the client. This message contains the network configuration settings for the client that sent the DHCPDISCOVER message.
  3. DHCPREQUEST This message is sent in response to DHCPOFFER indicating that the client has accepted the  network configuration sent in DHCPOFFER message from the server.
  4. DHCPACK This message is sent by the server in response to DHCPREQUEST recieved from the client. This message marks the end of the process that started with DHCPDISCOVER. The DHCPACK message is nothing but an acknowledgement by the DHCP server that authorizes the DHCP client to start using the network configuration it received from the DHCP server earlier.

In the other hand we will use today ISC’s DHCP server. ISC’s DHCP (isc-dhcp-server in Debian) software is the most widely used open source DHCP implementation on the Internet. The same software can be used for LAN too. It is a carrier and enterprise grade solution for any host configuration needs.

But before we start I have to give some advise about precautions that we need to make sure of.

Precautions before start.

After installing the necessary packages isolate the server fragment of network fron the rest of the computers. If you have an error in your configuration you can prevent computers from connecting. After you finish configuring, once you are sure that the configuration is working join the DHCP server to the network and monitor the behavior of the computers.And also make sure that you always backup your initial configuration file.

Installation of ISC DHCP Sever.

As usual, installation is very simple with apt. As root simply run
  • # apt­get install isc­dhcp­server
or
  • # aptitude install isc­dhcp­server

Sample output.

Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
isc-dhcp-server-ldap
The following NEW packages will be installed:
isc-dhcp-server
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 0 B/411 kB of archives.
After this operation, 938 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package isc-dhcp-server.
(Reading database ... 281728 files and directories currently installed.)
Unpacking isc-dhcp-server (from .../isc-dhcp-server_4.1.1-P1-15+squeeze8_amd64.deb) ...
Processing triggers for man-db ...
Setting up isc-dhcp-server (4.1.1-P1-15+squeeze8) ...
Generating /etc/default/isc-dhcp-server...
Starting ISC ... server: dhcpdcheck syslog for diagnostics. ... failed!
failed!
invoke-rc.d: initscript isc-dhcp-server, action "start" failed.

Configuration of the server.

The main configuration files are /etc/default/isc­-dhcp­-server. That stores the stating conditions and configurations for the software. And /etc/dhcp/dhcpd.conf that stores the actual configuration of the software.

Note: Remember to back up the original files as I advised before doing any work. To do that you can save the file on a different location or you can save it in the same place with a different name.

Edit isc-dhcp server default file

Edit isc-dhcp server default file

The first thing is to create the condition for the server to start. For that the only real requirement is to say the network interface to listen. Todo that first you should edit or create the file /etc/default/isc-dhcp-server with root permissions, either by running dpkg-reconfigure isc-dhcp-server or enter something like this into the file /etc/default/isc-dhcp-server:

INTERFACES="eth0"
Where Eth0 is the name of the only Ethernet interface that I have. If you have more that one then you need to decide if you are using only one or more than on for this service. In case  You can check out the picture for more information.
Homework A: research about the command dkpg.
After this we don’t really need to change any thing else, but for more advanced configurations you might need to modify this file again. Any way for normal organization requirements you do not really need to do it, so for now we leave like that. Now is the moment to create the actual configuration.
Note: As we are supposed to have backed up the original file. Now you can just create a new file from scratch, and I mean delete the original file (the one we have a back up already). And create a new file with the same name.
For a basic configuration on any real organization, you have to add/edit/create the following lines in /etc/dhcp/dhcpd.conf.
option domain­name "spices.org";
To specify the domain to use by the server and the clients. Also you should add this this line to the file:
 option domain­-name­-servers  213.191.92.86, 213.191.74.18;
This entry provides the IP addresses of two domain name servers (DNS), but one would be enough. You have to list here the DNS that work for your network, the addresses given here will most likely not work for you. So you should modify them to have your real DNS servers.
Now we are only missing with defining the network that we will use and the IP addresses that the server can use to give to the “customers”. Check it out:
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.10;
option routers pepper.spices.org;
}
This entry defines the LAN in the first line 192.168.1.0/255.255.255.0 is a /24 network. The IP addresses 192.168.1.1 to 192.168.1.255 are typical for an Intranets in many places. The second line defines the range of IP addresses to give to the clients 192.168.1.1 to 192.168.1.10. And lastly the gateway is defined in option routers, this name pepper.spices.org can be changed by any other name or IP address. And it will be the default gateway for the clients. Otherwise we are done with the configuration. Just to say that the ; is very important in the single lines and the {} defines a block of configuration parameters.
Now we just have to start the service and check that the service is working properly. To do that you just need to run the following command.
service isc-dhcp-server start
Or also you can use the old fashion method:
/etc/init.d/isc-dhcp-server start

Checking the results

Now, if it does not give an error we are likely to have finished configuring the server. But we need to double check that the configuration is working properly. For that I am going to introduce a few commands and concepts. Debian GNu Linux like a lot of Unix like systems has a lot of logs that record the things that happen on the system. But there is a really important file that stores the system logs. You can understand Kernel and other very important software’s logs. In Debian and many other Linux distributions you can find this info in the file /var/log/syslog. To check if the dhcp is working we should go to this file.
But if we open it with for instance with nano. We might be lost given the fact that this file records a lot of lines every hour and it might be hundreds of pages. Also nano and similar software show only the records (understand lines) that are in the file when you open it. So it does not update it self’s content dynamically. Then if the server is writing all the time and doing new jobs we will not be able to see it with nano unless we load again the page again and look for the new content. Which is fine for a small fine but not for hundreds of pages. So we need a new command that can show only the las part of the file and dynamically show it’s content as it is being created. Fortunately there is a really simple and nice command.the command is “tail”. and we can use if in this case in the following ways:
tail -f /var/log/syslog
and if we want to see the end of the file only statically we can use it this way:
tail -n100 /var/log/syslog
Where -n100 means the last 100 lines, so you can change this number to what ever you want.
Also we can use the “cat” command. What is does is that it shows the whole content of a file:
cat /var/log/syslog
Let me just show a sample of “tail -f” for a DHCP server that is working:
root@khs01sw10:~# tail -f /var/log/syslog 
Mar  5 09:31:05 khs01sw10 dhcpd: DHCPREQUEST for 10.175.1.164 from 00:0f:fe:c6:1f:76 (medimizer3) via eth0
Mar  5 09:31:05 khs01sw10 dhcpd: DHCPACK on 10.175.1.164 to 00:0f:fe:c6:1f:76 (medimizer3) via eth0
Mar  5 09:31:06 khs01sw10 dhcpd: DHCPREQUEST for 10.175.1.198 from 00:30:05:c0:99:22 (khs01wx0010) via eth0
Mar  5 09:31:06 khs01sw10 dhcpd: DHCPACK on 10.175.1.198 to 00:30:05:c0:99:22 (khs01wx0010) via eth0
Mar  5 09:31:07 khs01sw10 dhcpd: DHCPINFORM from 10.175.1.89 via eth0
Mar  5 09:31:07 khs01sw10 dhcpd: DHCPACK to 10.175.1.89 (d4:3d:7e:d3:ed:ba) via eth0
Mar  5 09:31:07 khs01sw10 dhcpd: DHCPINFORM from 10.175.1.97 via eth0
Mar  5 09:31:07 khs01sw10 dhcpd: DHCPACK to 10.175.1.97 (d4:3d:7e:d3:ee:8d) via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPREQUEST for 10.175.1.96 from 00:02:e3:32:c4:4b (khs01wx0188) via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPACK on 10.175.1.96 to 00:02:e3:32:c4:4b (khs01wx0188) via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPREQUEST for 10.175.1.184 from f0:27:65:35:45:73 (android-7f4c9b6f9482a823) via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPACK on 10.175.1.184 to f0:27:65:35:45:73 (android-7f4c9b6f9482a823) via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPINFORM from 10.175.1.221 via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPACK to 10.175.1.221 (74:de:2b:ce:25:f4) via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPREQUEST for 10.175.0.167 from 00:1e:79:28:5f:40 (Switch) via eth0
Mar  5 09:31:08 khs01sw10 dhcpd: DHCPACK on 10.175.0.167 to 00:1e:79:28:5f:40 (Switch) via eth0
^C
root@khs01sw10:~#
Homework B: How does the following command Works:  dhclient
In class we have seen a really simple configuration, but isc-dhcp-server is able to handle much more complex ones for different user requirements. Please bring different examples of configurations to the next class and try to explain a possible use case for that configuration.
Thank you for your time. That is it for today.

Debian; file system, superuser, commands, configuring and installing

Along this Debian class we will deal with the following. Debian file system, superuser, editing text files, executing commands in the shell, configuring, installing and uninstalling packages.

This post is part of a bigger Debian material that you can access here.

Debian File system, users and superusers; Introduction.

Debian GNU Linux uses the superuser paradigm. In computing, “the superuser is a special user account used for system administration. Depending on the operating system, the actual name of this account might be: root, administrator, admin or supervisor. In some cases the actual name is not significant, rather an authorization flag in the user’s profile determines if administrative functions can be performed. In operating systems which have the concept of a superuser, it is generally recommended that most application work be done using an ordinary account which does not have the ability to make system-wide changes.”

Taken from: http://en.wikipedia.org/wiki/Superuser on 2014-02-16

Debian Linux is of course a system with the superuser paradigm, by default the superuser name is root. But root might refer also to other parts of the system. Root is where every thing starts in Linux systems is like the alpha of the system. Is the “father

directory” (root directory represented by / ) in the file system. And root is also the “superuser”. to see the root directory you can execute the ls command from the fist class.
ls /
or
ls ­-la /
and to know if your current user is root you can use the whoami command also from the first class.
whoami
The root user is the privileged user of the system and is a lot more powerful than the Windows administrator; this user can even destroy the systems and it will not be even waned about it. The concept behind it is that this user should only be used when is strictly required. As you might already figure out you need to be extremely careful when working with this user. A lot of power comes with a lot of respectability. To continue with the root user now we will learn a command that helps to change your session to other users. ler say you are rafael and you want to change to miguel or to root. Well “su” is the command that you can use for that un debian and in most Linux systems. You can execute this command by it self:
su ­

Now it will prompt you for the root password and after you introduce it correctly it will change to the root user. Or if you want to change to a specific user you can use su, followed by the user name.

su class

To know the user you are in you can use the who am I command again.

whoami
As some of you might have noticed there is a small difference in the prompt between the root user and the non-privileged user. the non-privileged user appears in the shell with a $ and the root user with a # symbol. Check out this example:
abel@khs01wxl001:~$ whoami
abel
abel@khs01wxl001:~$ su
Password:
root@khs01wxl001:/home/abel# whoami
root
root@khs01wxl001:/home/abel# su abel
abel@khs01wxl001:~$ whoami
abel
abel@khs01wxl001:~$

The linux systems and Debian as one of them works like a cage for users. If you are abel and you execute su, then you login to root. But the session for abel does not end. After you execute su and change to root you can go back to your old session. To do that you just have to execute the command “exit” and it will take you back to the old user.

Before we continue with other content related to the file system and the super user. Let me introduce a few other commands and concepts.

System restart and shutdown; init run levels-command

  • init 0 – Shootsdown the computer. DEPRECATED in favour of “shutdown -h”
  • init 6 – Reboots the system.DEPRECATED in favour of shutdown e.g.: “shutdown -r +1”
Homework A:
  • What are the init run levels?
  • There are other init run levels from 1 to 5. What do they do?

Command to view current the network configuration; ifconfig.

“The ifconfig  is used to configure the kernel-resident network interfaces.  It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system  tuning  is needed.

If  no arguments are given, ifconfig displays the status of the currently active interfaces.  If a single interface argument is given, it displays the status of the given interface only; if a single -a  argument is  given,  it displays the status of all interfaces, even those that are down.  Otherwise, it configures an interface.”

Taken from ifconfig Debian official manual (man ifconfig)

Tor now we will use it just to view the network interface to view the interfaces configuration you just have to insert the command as root.

root@khs01wxl001:/home/abel# ifconfig 
eth0      Link encap:Ethernet  HWaddr 70:71:bc:b9:34:ad  
          inet addr:10.175.0.146  Bcast:10.175.1.255  Mask:255.255.254.0
          inet6 addr: fe80::7271:bcff:feb9:34ad/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:29874506 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1161761 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5595877026 (5.2 GiB)  TX bytes:213607775 (203.7 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:333529 errors:0 dropped:0 overruns:0 frame:0
          TX packets:333529 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:123740836 (118.0 MiB)  TX bytes:123740836 (118.0 MiB)

root@khs01wxl001:/home/abel#

Feel free to research about this very useful command.

Remote connections using ssh protocol.

“OpenSSH is a FREE version of the SSH connectivity tools that technical users of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that their password is transmitted across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH  provides secure tunneling capabilities and several authentication methods, and supports all SSH protocol versions”
Taken from: http://www.openssh.com/ on 2014-02-16.
In the other hand, the Debian Official CD version comes with the ssh client installed by default. (that means you can use it to connect to ssh servers). And the ssh server can also be installed from repository. here is as example of how to connect through ssh.
root@khs01wxl001:~# ssh root@10.175.0.1
root@10.175.0.1's password:
Linux khs01sw10 2.6.32­5­amd64 #1 SMP Mon Sep 23
22:14:43 UTC 2013 x86_64
(...)
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to
the extent
permitted by applicable law.
Last login: Mon Feb 17 15:50:11 2014 from 10.175.0.167
root@khs01sw10:~#
Here in the first line you basically say that you are going to use ssh to connect with root at the host 10.175.0.1 (ssh root@10.175.0.1). If your connection is fine, the remote host has a ssh server running and you are allowed to connect from your IP address then you will be prompted for the password. Then insert the password and press enter and thats is it. You should login be logged in to the remote system. Only then you can execute any command on the remote system, like for instance init 6 to restart the remote system or also you can perform any other task there.

Mount command

As an additional homework lets call it B -I leave you the mount mount command
# mount
Research about how can we use the mount command?
File system Linux vs Windows

File system Linux vs Windows

Organization of the root directory and HDDs in Linux.

To organize the file system most modern Linux distribution like Debian use the File system Hierarchy Standard. That is an agreement between some authorities of the Free software, some companies and individuals to improve the systems efficiency and interoperability. As per Wikipedia:
The Filesystem Hierarchy Standard (FHS) defines the directory structure and directory contents in Unix and Unix-like operating systems, maintained by the Linux Foundation. The current version is 2.3, announced on 29 January 2004.[1]
Taken from: http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
on 2014-02-16.

You can find more information about it here and here. but for now to continue let me just mention the main directories that we will use along

FHS

FHS

This classes. Please feel free to user the ls command and also the CD command from class 1 to understand this structure.

  • /etc – Configuration files for most of the
  • softwares eg: ssh, network, dhcp, etc.
  • /home – users folder exept for the root user
  • eg: class, abel, pedro, miguel, etc.
  • /var -variable data eg: databases, caches,
  • logs.

And secondly we will also work with:

  • /media- Is the mounting point for removable media.
  • /mnt- mounting point for temporary mounted file systems.
  • /boot- boot loader static files.
  • /bin – essential user command binaries

Also we will work with the root user’s folder. So I will leave a homework, for you to research about it.

Homework C:

  • Where is the root user folder?

Now to continue with the class lets first learn hot to edit with nano.

Editing files with nano.

“nano is a text editor for Unix-like computing systems or operating environments using a command line interface. It emulates the Pico text editor, part of the Pine email client, and also provides additional functionality. In contrast to Pico, nano is licensed under the GNU General Public License.”
Taken from: http://en.wikipedia.org/wiki/Nano_%28text_editor%29 on 2014-03-04
There are some other text editors like vi or vim both also for the shell and gedit or leafpad for the graphic interface. You can use the one you want or can. But in this classes I will assume you are using nano. Basics with nano:
  • To edit a file: $ nano /path/to/file.\
  • Nano internal commands:
    • CTRL + x: closes the file.
    • CTRL + o: saves.
    • CTRL + c: cursor position.
    • CTRL + k: cuts from nano.
    • CTRL + y: paste to nano from nano
    • CTRL + C cancels the current action if it’s not finished or says information about the cursor’s position.
Exersice 1: Create a text file called class1 in /home/class. Write some content and practice the commands from last slide.

The repository

“Commmonly refers to a storage location, often for safety or preservation. Many software publishers and other organizations

maintain servers on the Internet for this purpose, either free of charge or for a subscription fee. Repositories may be solely for particular programs, such as CPAN for the Perl programming language, or for an entire operating system. Operators of such repositories typically provide a package management system, tools intended to search for, install and otherwise manipulate software packages from the repositories. For example, many Linux distributions use Advanced Packaging Tool (APT), commonly found in Debian based distributions, or yum found in Red Hat based distributions. There are also multiple independent package management systems, such as pacman, used in Arch Linux and equo, found in Sabayon Linux.”
Taken from: http://en.wikipedia.org/wiki/Repository on 2014-02-16.
Now as the repository is formed by packages we have to define. What is a package?
“A package format is a type of archive containing files and additional metadata found on packages.While the archive file format itself is unchanged, package formats additionally specify the contents, such as requiring a manifest file or certain directory layout. The term is particularly used on Unix systems, and there are several formats available, both for Linux distributions and BSD systems, though the concept also includes pkg files on Mac OS X, MSI files on Windows, JAR files for Java, among others.”
Taken from: http://en.wikipedia.org/wiki/Linux_packages on 2014-03-04.
An other valid definition for package could be this one:
“In Linux distributions, a “package” refers to a compressed file archive containing all of the files that come with a particular application. The files are usually stored in the package according to their relative installation paths on your system. Most packages also contain installation instructions for the OS, as well as a list of any other packages that are dependencies (prerequisites required for installation.”
Taken from: http://www.internetblog.org.uk/post/1520/what-is-a-linux-package/ 2014-03-04.

Debian Package Management

apt-get – package manager
aptitude – higher level package manager.
  • aptitude install ssh
  • aptitude install mc
Homework C –
What us the diference between:
  • aptitude update
  • aptitude install
  • aptitude upgrade
How do you remove a packege?
How can you search for a package?
And that is it for today. On the next class we will discus about the package manager and we will install a DHCP server. be ready for it.

 

 

Network and DNS configuration Debian Linux – Class 4

Network and DNS client configuration; introduction

Network use of CPU resources

Network use of CPU resources

This post is part of a bigger Linux Debian administration material that you can access here.

Today we will deal with network and DNS configurations from command line. The graphical interface has different tools to configure the network and DNS, but this is a servers administrators post; so we will configure every thing from the command prompt. if you need more basic material explaining other aspects about Linux, Debian, basic commands etc, than you can go to the whole index of materials. We will only deal with IP version 4 (IPv4), but IPv6 is pretty similar. So you can learn IPv4 and then configure a network and DNS with IPv6 with just a few changes.

Content

  1. Network and DNS client configuration; introduction.
  2. Network Configuration
  3. The loopback Interface
  4. Creating the network configuration to use a DHCP server.
  5. Creating the network configuration to use a static IP address.
  6. DNS client configuration.

Now the main resources that I have used to create this material are the Debian network interfaces manual and the resolv.conf. You can access it by typing the following.

man interfaces
and
man resolv.conf

And the official’ Debian website material that you can find in the following link.

If you want to configure a network from the command prompt you have to know how to edit a file and some basic commands (Class 2 listed at the en of this page). In this material we will use nano for that purpose . Any way I will try to be as specific as I can and you can use any other editor of your preference. Also is advisable to have some knowledge about creating subnetworks and IP addresses. Lets start!

Network Configuration

The first thing that I am going to remind you off, also from Class 2 is a network command:

ifcofig: it lists your network interfaces; names, Mac Address (HWaddr), IP addresses (inet addr), Network mask (Mask), Broadcast (Bcast). For the Windows Network guys is similar to ipconfig /all. To test it you just need to run this in a root command prompt.

root@khs01sw10:~# ifconfig
 eth0      Link encap:Ethernet  HWaddr 08:00:27:a0:7e:72
 inet addr:10.175.0.1  Bcast:10.175.1.255  Mask:255.255.254.0
 inet6 addr: fe80::a00:27ff:fea0:7e72/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 RX packets:831736957 errors:0 dropped:0 overruns:0 frame:0
 TX packets:1006510543 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000
 RX bytes:673686597602 (627.4 GiB)  TX bytes:685797076123 (638.6 GiB)

lo        Link encap:Local Loopback
 inet addr:127.0.0.1  Mask:255.0.0.0
 inet6 addr: ::1/128 Scope:Host
 UP LOOPBACK RUNNING  MTU:16436  Metric:1
 RX packets:293263 errors:0 dropped:0 overruns:0 frame:0
 TX packets:293263 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:103963497 (99.1 MiB)  TX bytes:103963497 (99.1 MiB)
root@khs01sw10:~#

When you do ifconfig it shows a lot of text. Of course it depends on how many interfaces you have. For a computer with only one network interface (what we “normally” use as a workstation), it should show only 2 blocks of text. One corresponding to the Network interface. Normally this network interface is called eth0 for Ethernets and wlan0 for wireless connections. And an other one corresponding to the loop back interface.

The loopback Interface

“The loopback device is a special, virtual network interface that your computer uses to communicate with itself. It is used mainly for diagnostics and troubleshooting, and to connect to servers running on the local machine.”

Taken from: http://askubuntu.com/questions/247625/what-is-the-loopback-device-and-how-do-i-use-it on 2014-03-03.

Creating the network configuration to use a DHCP server.

Network Interface file back up.

Network Interface file back up.

Both of them, the loopback and the Ethernet interface have more or less the same information. Just that loopback is a lot simpler than eth0. But to summarize you need to know is that net ifconfig command shows the network configurations Currently running. It gives the network interfaces names, Mac Address (HWaddr), IP addresses (inet addr), Network mask (Mask), Broadcast (Bcast).

  • (Optional) First step. Lets backup the network interface content. To do that we have to edit the file /etc/network/interfaces.
root@khs01sw10:~# nano /etc/network/interfaces

It will show the content of a text file. the first action every time that you are going to change a configuration file is to backup the original. so using CTRL+o, we will save the file with a different name and then we will close it. After that just open again the file in /etc/network/interfaces. As we have a backup we can just delete every thing a create out own content.

Note: In case we make a mistake we can always go to our old configuration by creating renaming the backup file to interfaces. for that we can use the following command.

mv /etc/network/interfaces.back /etc/network/interfaces

And it will move the file /etc/network/interfaces.back with a different name to /etc/network/interfaces. Also if we still need to leave a copy we can use the command cp with the same arguments. To get more information about this commands you can use man cp and man mv.

cp /etc/network/interfaces.back /etc/network/interfaces

Now lets edit the file lets delete every thing in the file and lets create our own content.

  • Second open the file as I said with:
nano /etc/network/interfaces
  • Delete the content of the file. Al the text inside. for that you can just use Delete key, backspace or CTRL+k key to cut line by line.
  • write the following on the file:
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

“Auto Ethernet” and “Auto eth0”

Auto Ethernet means “Select an Ethernet interface automatically”

Auto eth0 means “autoconfigure the eth0 interface”.

taken from: https://wiki.debian.org/NetworkManager on 2014-03-03.

  • Save using CRTL+o again. and we are done with the withing in the network file.
  • Restart the network interface. This step is basically test the configuration file integrity and reload the configuration from the file to the actual interfaces.
root@khs01wxl001:/home/abel# service networking restart
[warn] Running /etc/init.d/networking restart is deprecated because it may not re-enable some interfaces ... (warning).
[....] Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/70:71:bc:b9:34:ad
Sending on   LPF/eth0/70:71:bc:b9:34:ad
Sending on   Socket/fallback
DHCPRELEASE on eth0 to 10.175.0.1 port 67
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/70:71:bc:b9:34:ad
Sending on   LPF/eth0/70:71:bc:b9:34:ad
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 10.175.0.1
DHCPACK from 10.175.0.1
bound to 10.175.0.146 -- renewal in 276 seconds.
ifup: interface eth0 already configured
done.
root@khs01wxl001:/home/abel#

If you receive this same warning do not worry, the warning is normal. It is just letting you know about of a configuration command that is deprecated and therefore is not supposed to be used any more.

 Creating the network configuration to use a static IP address.

To create an static IP address to access the network, the procedure basically is the same. The only difference is that you have to change the content of the configuration file to something something like this:

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.0.2.7
netmask 255.255.255.0
gateway 192.0.2.254

After restarting it is supposed to work just fine.

DNS client configuration

To connect to external resources using network names instead of IP addresses, the computer needs to use the DNS service. This service is very useful to translate from for instance php.net to the actual IP of the web server wherever this resource is located. In Linux systems all the DNS configuration for the client are located in a single file in etc or otherwise pointed from this file. The file is called resolv.conf.

The resolv.conf configuration file

“The configuration file resolv.conf at /etc/resolv.conf contains information that allows a computer connected to a network to resolve names into addresses. (Note: Do not confuse this configuration file with the program resolvconf, which unfortunately has a nearly identical name.)

The resolv.conf file typically contains the IP addresses of nameservers (DNS name resolvers) that will attempt to translate names into addresses for any node available on the network. There will be a line or lines that look like this:

nameserver 12.34.56.78
nameserver 12.34.56.79

In this example, the system is using nameservers at the IP addresses 12.34.56.78 and 12.34.56.79. Simply edit the file and enter the IP addresses of the nameservers you need to use after each nameserver. Add more nameserver lines if you have more nameservers. Don’t use this method if you have the resolvconf program installed.

The resolv.conf configuration file has many other options for defining how resolver looks up names. See man resolv.conf for details.”

Taken from: https://wiki.debian.org/NetworkConfiguration on 2014-03-03.

So basically you just have to open the file with nano or any other editor and change it to your prefered DNS.

root@khs01wxl001:/home/abel# nano /etc/resolv.conf

This configuration is named should contain something like unless you have a DNS configuration handler like resolvconf.

domain gabs.hospitals.moh.gov.bw
search gabs.hospitals.moh.gov.bw
nameserver 10.175.0.1

And that is basically it. Today we have configured the network and learned how to change the DNS configuration. i hope that this knowledge is useful some how for you, if you have any question or you see any error, please feel free to post it.

Debian GNU/Linux Introduction Class 1

Debian Linux Evolution.Introduction to GNU-Linux.  Linux Environment in Princess Marina Hospital; Servers, services and workstations.

This post is part of a bigger Debian material that you can access here.

Even when this GNU/Linux Debian classes are for Information Technology personnel if you are starting you might have a lot of question.

What is Debian? What is Linux? What is GNU? What is Debian GNU/Linux? what is a Distrubution? A Kernel? Are they all the same? Is Linus Torvalds the author of every thing?
Not intending to answer all of them I will just quote some clever guys from out there.
Content:

The Kernel

 

Kernel

Kernel

“A kernel is the central part of an operating system. It manages the tasks of the computer and the hardware -most notably memory and CPU time. There are two types of kernels:

  1. A microkernel, which only contains basic functionality;
  2. A monolithic kernel, which contains many drivers [Linux].
A computer user never interacts directly with the kernel. It runs behind the scenes and cannot be seen, except for the text logs that it prints.”
Taken from: http://simple.wikipedia.org/wiki/Kernel_%28computer_science%29 on 2014-02-12
Nice and simple, so the kernel is the middle man between me and the computer hardware.

Linux – GNU/Linux

  • “Many Linux users are familiar with Linux being called “GNU/Linux”. This means something special. “GNU” refers to the userland and “Linux” refers to the kernel. Now, you may be wondering if these two components can be swapped. Yes, they can.
  • For example, in the beginning of Linux’s history, the GNU community had no kernel at the time and Linux was just a kernel. So, they put the two projects together. Today, the GNU community has a kernel called “Hurd”.
  • They then swapped the Linux kernel with the Hurd kernel to make “GNU/Hurd” systems. For instance, Arch exists as “GNU/Linux” and “GNU/Hurd”.
  • Not only do various userland and kernel combinations exist, there are different Linux kernels. Also, Linux is not the only perating system with a module (obvious, right?).”
Taken from: http://www.linux.org/threads/the-linux-kernel-types-of-kernels.5409/ on 2014/02/11.
Evolution Of Linux

Evolution Of Linux

The fist bullet is very important where he says that a lot of Linux users are aware that the term GNU/Linux.That GNU is the part of the Operating System (OS) that does the direct work with the user (understand that user does not mean only someone who is using a computer). Then Linux refers to the kernel only, that is the part of the OS that interacts with the hardware.

So basically they have joined GNU and Linux and created GNU/Linux. Of course afterwards both projects have evolved and improved their different components. And an other incredible thing that happened was that when people saw that they could take the Software modify it and create their own new code and make it available again, more and more people started to cooperate to create their own versions of GNU/Linux or to contribute to existing ones. Check out the picture to get a rough idea of what I am talking about.

 

This next picture is a summary of only the most important GNU/Linux distributions created after the code was released for free. What happened at that time was that some distribution appeared and they evolved to our days becoming better and better and better. Also in important to remark that every time that someone does a good contribution this code is free (generally) and it is incorporated again in other distributions making every generally better or at least more updated with the latest free software.

Linux distribution time-line evolution

Linux distribution time-line evolution

The main branches on this graphic are Red Hat from 1994 with child distributions like Mandrake, PCLinux, CentOS, Mandriva, Fedora Core and some other important distributions. Also we have Suse Linux also from 1994 made by Novel Enterprices. An other of the important branches id Debian, it was started back on 1993, for more information read the following paragraph taken from Debian’s project website.

“The Debian Project was officially founded by Ian Murdock on August 16th, 1993. At that time, the whole concept of a “distribution” of Linux was new. Ian intended Debian to be a distribution which would be made openly, in the spirit of Linux and GNU … The creation of Debian was sponsored by the FSF’s GNU project…”

Taken from: https://www.debian.org/doc/manuals/project-history/ch-intro.en.html on 2014/02/28

Now from Debian we also have a whole lot of good derived distributions, like for instance Knopix,Dam Small Linux or the Ubuntu family that started on 2004.Otherwise along this classes we will be working with Debian mostly. But at the end if you know how to work with one of the distributions. You are very likely to be able to work with other distributions with small or no help.

Debian

“The Debian Project (…) is a free operating system. An operating system is the set of basic programs and utilities that make your computer run. At the core of an operating system is the kernel. The kernel is the most fundamental program on the computer and does all the basic housekeeping and lets you start other programs.
  • Debian systems currently use the Linux kernel or the FreeBSD kernel. Linux is a piece of software started by Linus Torvalds and
  • supported by thousands of programmers worldwide. FreeBSD is an operating system including a kernel and other software.
  • However, work is in progress to provide Debian for other kernels, primarily for the Hurd. The Hurd is free software produced by the GNU project.”
Taken from: http://www.debian.org/intro/about#what 2014/02/11.
To get more information about the GNU/Linux and Debian you can go to the official websites:
  • Debian Project: www.debian.org
  • Linux Project: www.linux.org
  • GNU project: www.gnu.org
Gnome

Gnome

An other of the Linux myths if that Linux has no graphic interface or very rudimentary ones, the true is that there are some very good projects with great future, although there is still a lot to be done. For instance we have Gnome Prject, check out the image, we can get more information about this project here. but Linux has a lot other graphic interfaces among them KDE the closest competitor to gnome or fresh one like LXDE and XFCE. But this classes are not for graphic fans but for Network administrators, so I will not talk to much about graphics any more along the course. We will use the Text Terminal mostly, the scary black Screen that many people are afraid of. The true is that this terminal is very pwoerful and you can perform a lot of activities nicely using it, and also most of the work is not like rocket sciences so we can learn it and that is what we will do along the classes.

Debian and Linux command prompt

We are going to start with real Linux. So if you do not have your Debian GNU/Linux workstation this is the moment to get it. the first thing that we will do is to change to a text terminal you can do that by pressing:

  • CTRL+ALT+(F1 to F6) Opens a Text terminal.

Now to switch back to the graphic terminal you can press:

  • Alt+F7 Opens the graphic terminal.

And you can also open a terminal from the graphic interface of your computer. by going to activities and typing terminal in the search box.

Linux Terminal

Linux Terminal

If you open the you text terminal (black screen) you have to login with a user, because it will prompt you immediately, there you are supposed to put your user and your password. As a curious detail in the Linux terminal when you type a password it does not show the dots that we might be used to in other  systems, so someone might think that is not typing but the terminal is really recording every key that you press. This was done that way for security reasons.

Once you are in you can type commands already, lets do for instance:

whoami.

It should return your user name.

root@khs01sw10:~# whoami 
root
root@khs01sw10:~#
Debian man command linux

Debian man command linux

So running commands is simple. But this is not it, if you do not know how to use a command you can use the commandman passing an other command as augment and it will tell you what it does.

man <CommandIDon’tKnow>

for instance:

root@khs01sw10:~# man whoami

And it will show you the Linux manual for the command. the manuals are always something like  the picture. Also if it is not enough you can go to Internet and research about ways of using any command. To get out of the manual you can just press q key and it will exit the manual.

That is what I had prepared for today, let me just add the homework that you can do using the manual and we will met in the next class.

Homework: Explain how to use this commands on a Debian environment.

Whoami
 man
 pwd
 ls -la
 passwd user
 cd
 mkdir
 rm

Thank you for your time.

.

Linux Server Classes (Introduction)

Linux Server Classes; About this group of materials.

Linux Versions with Tux

Linux Versions with Tux

I have started this post to bring Linux classes to any one in Gaborone, Botswana. Also you can access and use this materials any where else in the world. The only conditions is that you have to be willing to learn new and useful stuff from the free software movement. This Linux skill sharing was done for the ICT staff in Princess Marina Hospital in Gaborone, Botswana. The main objective was to socialize the Linux knowledge. These skill sharing classes are not part of any certified course. They are just the product of the personal experiences of a Linux and windows network administrator. Linux is currently being used at the hospital in most of the servers and a few workstations. But the course is thought as a General introduction to networking using GNU Linux Debian.

Notice:

 The online HTML materials are supposed to be self explainable enough to be used as a self-study and learning material with no assistance. If you have any doubt you can always post then and I will try to answer. SO YOU DO NOT NEED TO GO TO THE CLASSES TO LEARN OR EVEN BE IN BOTSWANA. You can just consult the HTML materials and post your specific questions in the class. Otherwise the materials are being create was we speak, so some of the classes might have some gaps. Feel free to post any error you find or any suggestion of a material to add.

Content

  1. About this material
  2. Content
  3. Course Classes Content
  4. The Linux Classes Content

Content of the classes

 

Along the classes you will learn about the main services on a network and how to install, configure and maintain them. GUN Linux Debian was the distribution selected. That was due to Debian’s popularity all over the world and it’s robustness for different server environments. Along the course we will deal with with a lot of useful staff.

 

  1. Introduction to Linux. The Debian operating system. GNU Linux Environment in Princess Marina Hospital. The server, services and workstations using Linux.
  2. How to execute Linux commands on the prompt. The edition of text file and the suse of configuration files. how to install software. The use of repositories and packages. use of the following commands: cat, ls, pwd, whoami, passwd, nano, mkdir, touch, rm, aptitude, apt-get. How to configure a network configuration.
  3. The DHCP service and specifically ISC DHCP Server. How to install it and basic configuration. More useful commands: service, tail, ps, grep, uname, make, make install, aptitude, purge.
  4. The DNS server and specifically Bind. How to install and basic configuration. How to create a Zone, reverse zone, forwarders, zone transfer, etc.
  5. The Web serverand specifically Apache 2. Installation and basic configuration. Virtual host, Apache module.
  6. Proxy server; squid. Installation and basic configuration. Acls: Authentication configuration basics, sarg, cache configuration.
  7. Linux start up and Linux crontab configuration. How to make a command or a software to execute when the system starts, how to create chronological/periodical tasks.
  8. Virtualization; Virtual Box. Installation and basic configuration, commands headless Virtual machines.
  9. Windows file sharing service; Samba Service, printing servers, introduction to integration with active directory.

Before we begin I have to add the main materials to start with this course: https://www.debian.org/CD/ installation images or any other preferred installation that you want. Also if you first want to know what is possible with Linux to set your beginner goal you can check out this article. also the main philosophy of this course is : “I can show you the door, you have to open it” that means that I will try to teach a lot of thing in every class but you have to put your own effort.

The Linux Classes:

 

8. Squid3; install and configure a proxy server part IView

Class TitleHTML self explainable ClassShorter slide presentation
1. Introduction to GNU/Linux Debian: Linux Evolution. Linux Environment, Servers, services and workstations.ViewPDF
2. Debian Basic Commands Debian file system, superuser, editing text files, executing commands in the shell, configuring, installing and uninstalling packages.ViewPDF
3. DHCP server basic principles; installation and configuration.ViewPDF
4. Network and DNS client configuration.ViewPDF
5. DNS server configuration.View
6. Apache 2 web server; install and configure a virtual hostView
7. Virtualbox; install and configure a virtual machineView
8. Squid; Introduction, part IView
9. Squid; working example a proxy server part IIView

In case one any question you feel free to leave your message here as a comment.

MS Dynamics Business intelligence Specialist wanted.

One of our customers wants a to get some MS Dynamics graphics, Maps with coordinates, etc. from their existing MS Dynamics system running. If you have what it takes, please send relevant experience, rates and references.
Please contact me with the information required and we will come back to you

Closing date: End of February.