So you maybe thought about testing this new administration tool but you don't have like 3 (working) computers lying around in your office or in your house or room.
Or you had an idea how to build up your new network and wanted to test some configs? Or maybe your prof gave you a networking-task where you have to build a networking setup but you really don't have all that hardware? Yeah, I eel that but I have a nice piece of software for you. Netkit. This article tries to give you a short introduction into networking with Netkit. The complicated stuff comes later, sorry.
Netkit is basically a program for virtual networking with linux hosts without having to buy some fancy hardware. The last release of the original netkit was an unstable release in 2016 but it got developed by another people because it is open source. So there are some other and newer versions: there is Netkit-ng (my favorite) and there is Kathará (which works with docker) and also a lot more if you just search enough. Netkit and Netkit-NG are based on debian-virtual machines and the user-mode-linux which enables the Linux-Kernel to run in userspace (correct me if I'm wrong). There are also a lot of so called labs you can download from the websites, these are pre-configured combinations of machines and machine-configurations. You can also build a lab yourself and upload it to the web (we will look into this in the next article).\
I'm sorry to say but it only works on Linux-based OS.
If you want to test your new network-configuration, your routing tables or test another configuration-management-tool like SALT or Ansible or finally get a grab on puppet but you only have one machine or at max two but not enough to really run the test. Or maybe you study computer science or a field in cs and your professor wants you to develope a network plan and maybe test it. Or you want to teach some easy networking without paying a lot of money for proper hardware.
In this article I'll only tell you how to install netkit and start your first machine, fore more please read the next article of this series.
My fave is Netkit-NG because it is rather new and some essential features are working, so what you have to do is download the core, the kernel and the filesystem which are parts of the program. The core are the commands, the kernel is the linux-kernel which is used and the filesystem is the debian-filesystem where your vms are based on.\
Then you have to insert it into a folder, unpack it with the commands, where "version" is the version you've downloaded:
tar -xjSf netkit-ng-core-32-version.tar.bz2 tar -xjSf netkit-ng-filesystem-i386-version.tar.bz2 tar -xjSf netkit-ng-kernel-i386-version.tar.bz2
So you've downloaded the files and unpacked them, now you have to add the paths to your PATH, so open your .bashrc (or .bash_profile) (the file is in your home-folder) and add the variable NETKIT_HOME with the path to your netkit-files to it, also add $NETKIT_HOME/man to your MANPATH and include $NETKIT_HOME/bin in your PATH. In my .bashrc it looks like this:
export NETKIT_HOME=/home/luca/programs/netkit-ng export MANPATH=:$NETKIT_HOME/man export PATH=$NETKIT_HOME/bin:$PATH
Since Netkit was developed 32-bit we have to get some dependencies, so you have to install these three packages: libc6:i386, libncurses5:i386 and libreadline6:i386. Also you need a terminal, Netkit works with them mainly but not any terminal, you need xTerm. Now, finally you are ready to start. Okay, lets test our config before starting because better safe than annoyed. So lets navigate into our netkit-folder and run the ´check-configuration.sh´. If everything is okay we can start.
After finishing this load of configuration, installation and so on let's start our first vm and get some nice and sweet internet and package updates in there.
To easily start a lonely vm just type
vstart pc1 where pc1 is just the name. But no one should be lonely and without a connection to the internet, so lets end this vm with
vhalt pc1 to start it again but this time we want the internet connection, so let's type
vstart pc1 --eth0=tap,10.0.0.1,10.0.0.2, now we have a tap interface.
The ip-addresses should not be in your subnet (the first three numbers should not be the same in your ip-adress ) but have to be in the the same subnet. The first one is called tap-address and the second guest-adress. Okay, now we have some sweet, nice, fresh internet but just running some apt-get-commands doesn't really work, we need space for that. So let's halt the vm again (
vhalt pc1) and add some simple RAM with this command
vstart vm --eth0=tap,10.0.0.1,10.0.0.2 -M 256 now you can update the packages on the vm with the
apt-get commands, if you want to save your updated and installed apps for eternity just add a -W to the command when you're starting the vm the next time.
Subnets are like smaller networks we will look into this more in the next article where we start our own subnet but basically it is just a network of machines in a bigger network of machines. In this case with subnet I meant the third number (the Xs in 10.0.XXX.1). For more info you can read the wikipedia-article, it helped me a lot: https://en.wikipedia.org/wiki/Subnetwork
Apt-get is the terminal-package-management-frontend for debian-based distros. In simple: debian-based distros all have the package-management-tool dpkg which manages the installed programs and all that stuff, the tools like apt-get, apt and aptitude (and some more) help to solve the dependencies and help you to install, update and remove programs from your machine via the terminal. Some important commands are:
sudo apt-get install <package> to install the package, ´sudo apt-get update´ to update your package-database (you have to do this every time you want to install a package or update packages), ´sudo apt-get upgrade´ for upgrading all your packages and
sudo apt-get remove <package> to remove said package.
Okay... enough stuff for today, the next time I want to give you an introduction into netkit labs so your lonely machine isn't that lonely anymore.
If you have questions just write me, I'm happy to help wherever I can. Also if you have suggestions and constructive criticism please let me know.