diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-24 21:05:27 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-24 21:05:27 +0100 |
commit | 8081a5520a441b43a8a7a73f3a90c7aacfaa8e10 (patch) | |
tree | c7f49bd33ed19d53afc0ee9df8b2c82c200c5910 /tasks/isc_dhcp_live_boot | |
parent | 9963b74f777edf985540eac71b1ca095f88b8bca (diff) |
Move everything one level up
Diffstat (limited to 'tasks/isc_dhcp_live_boot')
33 files changed, 713 insertions, 0 deletions
diff --git a/tasks/isc_dhcp_live_boot/howtos/en/index.html b/tasks/isc_dhcp_live_boot/howtos/en/index.html new file mode 100644 index 0000000..63d2463 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/en/index.html @@ -0,0 +1,172 @@ +<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>06 - preparation (isc_dhcp_live_boot)</title>
+ </head>
+
+ <body>
+ <h1 style="color:blue">06 - preparation (isc_dhcp_live_boot)</h1>
+ <h2>Table of contents</h2>
+ <ul>
+ <li><a href="#namen">Purpose of this exercise</a></li>
+ <li><a href="#navidezniRacunalniki">Virtual machines, needed for the purpose of exercise</a></li>
+ <li><a
+href="#skicaPodomrezja">Schematics of our subnet</a></li>
+ <li><a href="#simpleArbiterGW">Setting up simpleArbiterGW</a></li>
+ <li><a href="#DHCP">Setting up DHCP Server</a></li>
+ <li><a href="#clientA">Setting BootableClient A</a></li>
+ <li><a href="#clientB">Setting up BootableClient B</a></li>
+ </ul>
+
+
+ <h2 id="namen">Purpose of this exercise</h2>
+ <p>How to perform live boot using a DHCP server.</p>
+
+ <h2 id="navidezniRacunalniki">Virtual machines needed to perform the task.</h2>
+ <p>We need VirtualBox and the following 4 virtual
+machines:
+ <ul>
+ <li><a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterGW.vdi">simpleArbiterGW</a></li>
+ <li><a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterDhcp.vdi">DHCP Server</a></li>
+ <li>Bootable Client A (diskless
+machine)</li>
+ <li>Bootable Client B (diskless
+machine)</li>
+ </ul>
+ </p>
+
+ <h2 id="skicaPodomrezja">Schematics of our subnet</h2>
+ <img style="width: 800px; height: 610px;" src="../images/01.png" alt="slika-01"></img>
+ <p>Our goal is to make BootableClient A get it's IP
+through DHCP server and boot up using file
+A, which is located on simpleArbiterGW,</br>If we run
+BootableClient B machines, we would like it to retrieve it's IP
+through DHCP server and boot from some live ISO which is also located on
+SimpleArbiterGW.
+ </p>
+
+ <h2 id="simpleArbiterGW">Setting up <mark>simpleArbiterGW</mark></h2>
+ <p>Download <a
+href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterGW.vdi">simpleArbiterGW.vdi</a>
+and then run VirtualBox. After the file is downloaded, choose the New
+option in VirtualBoxu and set simpleArbiterGW in the Name
+field.</br>Memory size, should be set accordingly (1gb will suffice). Then choose "Use an existing virtual hard drive file" and select simpleArbiterGW.vdi clicking Create.</p>
+ </br>
+ <img style="width: 800px; height: 464px;" src="../images/02.png" alt="slika-02"></img>
+ <p>We start our virtual machines simpleArbiterGW using the
+following login
+credentials; username: "root", password: "kaboom".</br></br>
+ At the start, the computer on NAt get's it's IP(in our case 10.0.2.15).</br>(to check this use<b>ifconfig</b>) We now use this address and eth0 interface to access the internet.<p>
+ <img style="width: 800px; height: 384px;" src="../images/03.png" alt="slika-03"></img>
+ <p>However, we would like this machine to have 2
+interfaces! One on NAT(we already have this one), and the other one on Internal Network,</br>throuh which we will communicate wiht the DHCP Server and other machines on our Internal Network.</br></br>
+ We add a new interface, by turning off the virtual machine,
+select our machine in VirtualBox and select
+računalnik, ter v VirtualBoxu <b>Settings -> Network</b></br>
+ <b>Adapter</b> 1 is already set to NAT, we set <b>Adapter
+2</b> to
+Internal Network</p>
+ <img style="width: 800px; height: 137px;" src="../images/04.png" alt="slika-04"></img>
+ <p>So, now we have two network interfaces!</br>In VirtuaBox
+we can define multiple Internal Networks, however, for our needs two
+will suffice. We save the settings and restart simpleArbiterGW.</br></br>
+ What we must do now, is to assign both interfaces IP addresses. We do this by setting the<b>interfaces</b>file
+ located at<b>/etc/network</b>.</p>
+ <img style="width: 800px; height: 229px;" src="../images/05.png" alt="slika-05"></img>
+ <p>Eth0 was already handled by and integrated DHCP, so eth0 had been assigned an IP).</br>
+ We have to set up the other network interface. If we don't know it's name, we find it out using <b>ifconfig -a</b>.</p>
+ <img style="width: 800px; height: 117px;" src="../images/06.png" alt="slika-06"></img>
+ <p>We can conclude the interface names is set to Eth1.
+ Now we would like to assign an IP naslov to Eth1.</br>
+ Ifconfig could be used, but rebooting the machine would reset the settings. Which is not ideal :)</br>
+ So configuring <b>/etc/network/interfaces would be a better idea.</b></br></br>
+ Let's make up a random local network or a local area network or local area network address and assign it to eth1.
+ </p>
+ <img style="width: 800px; height: 296px;" src="../images/07.png" alt="slika-07"></img>
+ <p>We save the config file. Our machine still has no IP on eth1 so we use the <b>ifup eth1</b> command</p>
+ <img style="width: 800px; height: 23px;" src="../images/08.png" alt="slika-08"></img></br>
+ <p>Now we use the <b>ifconfig</b> command, to see whether and ip is assigned to eth1 interface</p>
+ <img style="width: 800px; height: 389px;" src="../images/09.png" alt="slika-09"></img>
+ <p>We can see the IP is set. Now let's set up the DHCP
+Server!</p>
+
+ <h2 id="DHCP">Setting up <mark>DHCP Server</mark></h2>
+ <p>We download <a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterDhcp.vdi">simpleArbiterDhcp.vdi</a> and start VirtualBox. After the file had been dowloaded we select New in VirtualBoxu and unde rthe Name tag write DHCP Server.</br>We set the Memory size accordingly(1gb of memory should be sufficient). We also select "Use an existing virtual hard drive file" and select the simpleArbiterDhcp and press Create.</p>
+ </br>
+ <img style="width: 800px; height: 464px;" src="../images/10.png" alt="slika-10"></img>
+ <p>We run DHCP Server virtual machine and login using "root" ad username and "kaboom" as password.</br></br>
+ <p>At first, our machine has no assigned IP, since none was set! Let+s configure it in <b>/etc/network/interfaces</b>.</br>But which interface should we configure? Using <b>ifconfig -a</b> command, we see it's <b>eth0</b>interface.<br>
+ Again we select our IP address.</p>
+ <img style="width: 800px; height: 283px;" src="../images/11.png" alt="slika-11"></img>
+ <p>We save the configuration file. Our computer still has no IP address assigned to eth0, so using <b>ifdown eth0</b> and then <b>ifup eth0</b>we provide one.</p>
+ <img style="width: 800px; height: 25px;" src="../images/12.png" alt="slika-12"></img>
+ <p>Now let us use <b>ifconfig</b> command, to check whether there is an IP assigned to interface eth0</p>
+ <img style="width: 800px; height: 329px;" src="../images/13.png" alt="slika-13"></img>
+ <p>We got it! We install DHCP server using <b>apt-get install isc-dhcp-server</b></p>
+ <img style="width: 800px; height: 322px;" src="../images/14.png" alt="slika-14"></img>
+ <p>We see a bunch of errors. Why? Bacause, we have no internet access! <br>
+ We need to specify the Gateway for our inteface. Our Gateway will be set as IP of our simpleArbiter virtual machine.</br> We do this using the<b>route add default gw 192.168.251.1 eth0</b> command</p>
+ <img style="width: 800px; height: 43px;" src="../images/15.png" alt="slika-15"></img>
+ <p>Try pinging Google's DNS server at 8.8.8.8, to check if now have internet access.</br>
+ We do this using the <b>ping 8.8.8.8</b> command.</p>
+ <img style="width: 800px; height: 361px;" src="../images/16.png" alt="slika-16"></img>
+ <p>Google's DNS server is responding. Great! </br>
+ However, we still cannot run <b>apt-get install isc-dhcp-server</b></br>
+ Let's tempororly add another interface and set it to NAT, so we get internet access and install the DHCP server.</br></br>
+ We add a new interface by turning off the virtual computer, in VirtualBox we select our virtual machine and then select <b>Settings -> Network</b></br>
+ <b>Adapter 1</b> has already been set to Internal Network, we set <b>Adapter 2</b> to NAT</p>
+ <img style="width: 800px; height: 134px;" src="../images/17.png" alt="slika-17"></img>
+ <p>We run DHCP Server and in file<b>/etc/network/interfaces</b> at the end of the line add <b>iface eth1 inet dhcp</b>, then save the file and run <b>ifup eth1</b>.<br>
+ Now we have access to the internet and can install our DHCP server with <b>apt-get install isc-dhcp-server install</b> command</br>
+ <img style="width: 800px; height: 26px;" src="../images/18.png" alt="slika-18"></img></br>
+ <p>Let's see what's in<b>/var/log/syslog</b>, which is a file where our system information is stored in.</p>
+ <img style="width: 800px; height: 323px;" src="../images/19.png" alt="slika-19"></img></br>
+ <p>Looks like we need to set up a DHCP server and specify where it should listen! </br>
+ DHCP settings are stored in <b>/etc/dhcp/dhcpd.conf</b>. Let's set it! </br>
+ First let's comment out <b>option domain-name-servers</b> to avoid having errors.</p>
+ <img style="width: 800px; height: 26px;" src="../images/20.png" alt="slika-20"></img></br>
+ <p>Then we configure DHCP server, so it would serve IPs a a certain subnet. We add the following lines:</p>
+ <img style="width: 800px; height: 417px;" src="../images/21.png" alt="slika-21"></img>
+ <p><b>(subnet)</b> We set the subnet and the IP range, which the DHCP server should use, and which file it should serve.</p>Some PXEs are so unintelligent, that you should specify where they should get the files from and to do that you specify next-server </br>(IP from which it will be served from, in our case simpleArbiter), we also specify gateway, which, in our case is also simpleArbiter.</br></br>Since we would like, that in the case of BootableClient B another file to be served, we do it by defining a special host like this:</br><b>(host special)</b> Under <b>hardware ethernet</b> we specifiy MAC address of our BootableClient B, we assign it a static ip and where the file <b>live-ISO</b> is located.</p>
+ <p>We save the settings and kill the process named <b>dnsmasq</b>using<b>kilall dnsmasq</b>.</p>
+ <img style="width: 740px; height: 34px;" src="../images/22.png" alt="slika-22"></img>
+ <p>We restart our DHCP server, to apply the new settings. This is done using <b>service isc-dhcp-server restart</b></br> command. DHCP server is now ready! We supply BootableClientA and BootableClientB and test them!</p>
+
+
+ <h2 id="clientA">Setting up <mark>BootableClient A</mark></h2>
+ <p>We open VirtualBox and select <b>New</b>, for the
+<b>Name</b> field we specify
+BootableClient A and for the <b>Hard drive</b> we select <b>Do not add a
+virtual
+hard drive</b> (as we want diskless device), </br>and select Create.
+We want the computer to be on Internal network so vse select our
+<b>Bootable Client
+A</b> and select </br><b>Settings->Network</b> where we change Adapter
+1 to Internal Network.</p>
+ <img style="width: 800px; height: 678px;" src="../images/23.png" alt="slika-23"></img>
+ <p>We also want our computer to boot through the network, so
+under<b>Boot Order</b>tab select <b>Network</b>.</br>
+ We save the setting by clicking <b>OK</b></p>
+ <img style="width: 800px; height: 697px;" src="../images/24.png" alt="slika-24"></img>
+ <p>We run our BootableClient-a A and it get's it's
+IP(which is great), using the DHCP server and the simpleArbiter serves
+it exactly the file we specified. <b>A.0</b></p>
+ <img style="width: 800px; height: 494px;" src="../images/25.png" alt="slika-25"></img>
+
+
+
+ <h2 id="clientB">Setting up<mark>BootableClient
+B</mark></h2>
+ <p>We open virtual box and select <b>New</b> and under the <b>Name</b> tag write BootableClient B and under the <b>Hard drive</b>tab choose <b>Do not add a virtual hard drive</b> (since we want a diskless machine), </br>and then press the Create button, which will create a virtual machine. We want our machine to be connected to out Internal network so we select <b>Bootable Client B</b> and then select </br><b>Settings->Network</b> and set the Adapter 1 to Internal Network.</br>
+ Under <b>MAC Address</b> we specify the same MAC address that is specified in the (dhcpd.conf -> host special) file, since we want our machine to be an exception</br> and will be served a special file named<b>live-ISO</b></p>
+ <img style="width: 800px; height: 678px;" src="../images/26.png" alt="slika-26"></img>
+ <p>We want our machine to perform a netboot, so under the <b>System</b></p> <b>Boot Order</b> tag specify only <b>Network</b>.</br>
+ We save the setting by clicking the <b>OK</b> button</p>
+ <img style="width: 800px; height: 697px;" src="../images/27.png" alt="slika-27"></img>
+ <p>We run our BootableClient-a A and it get's it's IP address using DHCP server and simpleArbiter serves it the file we selected called <b>live-ISO</b></p>
+ <img style="width: 800px; height: 494px;" src="../images/28.png" alt="slika-28"></img>
+
+
+ </body>
+</html>
+
diff --git a/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html b/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html new file mode 100644 index 0000000..c83ed57 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html @@ -0,0 +1,172 @@ +<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>06 - preparation (isc_dhcp_live_boot)</title>
+ </head>
+
+ <body>
+ <h1 style="color:blue">06 - preparation (isc_dhcp_live_boot)</h1>
+ <h2>Table of contents</h2>
+ <ul>
+ <li><a href="#namen">Purpose of this exercise</a></li>
+ <li><a href="#navidezniRacunalniki">Virtual machines, needed for the purpose of exercise</a></li>
+ <li><a
+href="#skicaPodomrezja">Schematics of our subnet</a></li>
+ <li><a href="#simpleArbiterGW">Setting up simpleArbiterGW</a></li>
+ <li><a href="#DHCP">Setting up DHCP Server</a></li>
+ <li><a href="#clientA">Setting BootableClient A</a></li>
+ <li><a href="#clientB">Setting up BootableClient B</a></li>
+ </ul>
+
+
+ <h2 id="namen">Purpose of this exercise</h2>
+ <p>How to perform live boot using a DHCP server.</p>
+
+ <h2 id="navidezniRacunalniki">Virtual machines needed to perform the task.</h2>
+ <p>We need VirtualBox and the following 4 virtual
+machines:
+ <ul>
+ <li><a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterGW.vdi">simpleArbiterGW</a></li>
+ <li><a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterDhcp.vdi">DHCP Server</a></li>
+ <li>Bootable Client A (diskless
+machine)</li>
+ <li>Bootable Client B (diskless
+machine)</li>
+ </ul>
+ </p>
+
+ <h2 id="skicaPodomrezja">Schematics of our subnet</h2>
+ <img style="width: 800px; height: 610px;" src="../images/01.png" alt="slika-01"></img>
+ <p>Our goal is to make BootableClient A get it's IP
+through DHCP server and boot up using file
+A, which is located on simpleArbiterGW,</br>If we run
+BootableClient B machines, we would like it to retrieve it's IP
+through DHCP server and boot from some live ISO which is also located on
+SimpleArbiterGW.
+ </p>
+
+ <h2 id="simpleArbiterGW">Setting up <mark>simpleArbiterGW</mark></h2>
+ <p>Download <a
+href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterGW.vdi">simpleArbiterGW.vdi</a>
+and then run VirtualBox. After the file is downloaded, choose the New
+option in VirtualBoxu and set simpleArbiterGW in the Name
+field.</br>Memory size should be set accordingly (1gb will suffice). Then choose "Use an existing virtual hard drive file" and select simpleArbiterGW.vdi clicking Create.</p>
+ </br>
+ <img style="width: 800px; height: 464px;" src="../images/02.png" alt="slika-02"></img>
+ <p>We start our virtual machines simpleArbiterGW using the
+following login
+credentials; username: "root", password: "kaboom".</br></br>
+ At the start, the computer on NAt get's it's IP(in our case 10.0.2.15).</br>(to check this use<b>ifconfig</b>) We now use this address and eth0 interface to access the internet.<p>
+ <img style="width: 800px; height: 384px;" src="../images/03.png" alt="slika-03"></img>
+ <p>However, we would like this machine to have 2
+interfaces! One on NAT(we already have this one), and the other one on Internal Network,</br>throuh which we will communicate wiht the DHCP Server and other machines on our Internal Network.</br></br>
+ We add a new interface, by turning off the virtual machine,
+select our machine in VirtualBox and select
+računalnik, ter v VirtualBoxu <b>Settings -> Network</b></br>
+ <b>Adapter</b> 1 is already set to NAT, we set <b>Adapter
+2</b> to
+Internal Network</p>
+ <img style="width: 800px; height: 137px;" src="../images/04.png" alt="slika-04"></img>
+ <p>So, now we have two network interfaces!</br>In VirtuaBox
+we can define multiple Internal Networks, however, for our need's two
+will suffice. We save the settings and restart simpleArbiterGW.</br></br>
+ What we must do now, is to assign both interfaces IP addresses. We do this by setting the<b>interfaces</b>file
+ located at<b>/etc/network</b>.</p>
+ <img style="width: 800px; height: 229px;" src="../images/05.png" alt="slika-05"></img>
+ <p>Eth0 was already handled by and integrated DHCP, so eth0 had been assigned an IP).</br>
+ We have to set up the other network interface. If we don't know it's name, we find it out using <b>ifconfig -a</b>.</p>
+ <img style="width: 800px; height: 117px;" src="../images/06.png" alt="slika-06"></img>
+ <p>We can conclude the interface names is set to Eth1.
+ Now we would like to assign an IP naslov to Eth1.</br>
+ Ifconfig could be used, but rebooting the machine would reset the settings. Which is not ideal :)</br>
+ So configuring <b>/etc/network/interfaces would be a better idea.</b></br></br>
+ Let's make up a random local network or a local area network or local area network address and assign it to eth1.
+ </p>
+ <img style="width: 800px; height: 296px;" src="../images/07.png" alt="slika-07"></img>
+ <p>We save the config file. Our machine still has no IP on eth1 so we use the <b>ifup eth1</b> command</p>
+ <img style="width: 800px; height: 23px;" src="../images/08.png" alt="slika-08"></img></br>
+ <p>Now we use the <b>ifconfig</b> command, to see whether and ip is assigned to eth1 interface</p>
+ <img style="width: 800px; height: 389px;" src="../images/09.png" alt="slika-09"></img>
+ <p>We can see the IP is set. Now let's set up the DHCP
+Server!</p>
+
+ <h2 id="DHCP">Setting up <mark>DHCP Server</mark></h2>
+ <p>We download <a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterDhcp.vdi">simpleArbiterDhcp.vdi</a> ter zaženemo VirtualBox. Ko je datoteka prenesena v VirtualBoxu izberemo New ter v polje Name vpišemo DHCP Server.</br>Ustrezno nastavimo tudi Memory size (1gb pomnilnika nam bo zadostovalo). Spodaj izberemo še "Use an existing virtual hard drive file" ter izberemo naš simpleArbiterDhcp in pritisnimo Create.</p>
+ </br>
+ <img style="width: 800px; height: 464px;" src="../images/10.png" alt="slika-10"></img>
+ <p>We run DHCP Server virtual machine and login using "root" ad username and "kaboom" as password.</br></br>
+ <p>At first, our machine has no assigned IP, since none was set! Let+s configure it in <b>/etc/network/interfaces</b>.</br>But which interface should we configure? Using <b>ifconfig -a</b> command, we see it's <b>eth0</b>interface.<br>
+ Again we select our IP address.</p>
+ <img style="width: 800px; height: 283px;" src="../images/11.png" alt="slika-11"></img>
+ <p>We save the configuration file. Our computer still has no IP address assigned to eth0, so using <b>ifdown eth0</b> and then <b>ifup eth0</b>we provide one.</p>
+ <img style="width: 800px; height: 25px;" src="../images/12.png" alt="slika-12"></img>
+ <p>Now let us use <b>ifconfig</b> command, to check whether there is an IP assigned to interface eth0</p>
+ <img style="width: 800px; height: 329px;" src="../images/13.png" alt="slika-13"></img>
+ <p>We got it! We install DHCP server using <b>apt-get install isc-dhcp-server</b></p>
+ <img style="width: 800px; height: 322px;" src="../images/14.png" alt="slika-14"></img>
+ <p>We see a bunch of errors. Why? Bacause, we have no internet access! <br>
+ We need to specify the Gateway for our inteface. Our Gateway bo seveda IP našega simpleArbiter navideznega računalnika.</br> To naredimo s pomočjo ukaza <b>route add default gw 192.168.251.1 eth0</b></p>
+ <img style="width: 800px; height: 43px;" src="../images/15.png" alt="slika-15"></img>
+ <p>Try pinging Google's DNS server at 8.8.8.8, to check if now have internet access.</br>
+ We do this using the <b>ping 8.8.8.8</b> command.</p>
+ <img style="width: 800px; height: 361px;" src="../images/16.png" alt="slika-16"></img>
+ <p>Google's DNS server is responding. Great! </br>
+ However, we still cannot run <b>apt-get install isc-dhcp-server</b></br>
+ Let's tempororly add another interface and set it to NAT, so we get internet access and install the DHCP server.</br></br>
+ We add a new interface by turning off the virtual computer, in VirtualBox we select our virtual machine and then select <b>Settings -> Network</b></br>
+ <b>Adapter 1</b> has already been set to Internal Network, we set <b>Adapter 2</b> to NAT</p>
+ <img style="width: 800px; height: 134px;" src="../images/17.png" alt="slika-17"></img>
+ <p>We run DHCP Server and in file<b>/etc/network/interfaces</b> at the end of the line add <b>iface eth1 inet dhcp</b>, then save the file and run <b>ifup eth1</b>.<br>
+ Now we have access to the internet and can install our DHCP server with <b>apt-get install isc-dhcp-server install</b> command</br>
+ <img style="width: 800px; height: 26px;" src="../images/18.png" alt="slika-18"></img></br>
+ <p>Let's see what's in<b>/var/log/syslog</b>, which is a file where our system information is stored in.</p>
+ <img style="width: 800px; height: 323px;" src="../images/19.png" alt="slika-19"></img></br>
+ <p>Looks like we need to set up a DHCP server and specify where it should listen! </br>
+ DHCP settings are stored in <b>/etc/dhcp/dhcpd.conf</b>. Let's set it! </br>
+ First let's comment out <b>option domain-name-servers</b> to avoid having errors.</p>
+ <img style="width: 800px; height: 26px;" src="../images/20.png" alt="slika-20"></img></br>
+ <p>Then we configure DHCP server, so it would serve IPs a a certain subnet. We add the following lines:</p>
+ <img style="width: 800px; height: 417px;" src="../images/21.png" alt="slika-21"></img>
+ <p><b>(subnet)</b> We set the subnet and the IP range, which the DHCP server should use, and which file it should serve.</p>Some PXEs are so unintelligent, that you should specify where they should get the files from and to do that you specify next-server </br>(IP from which it will be served from, in our case simpleArbiter), we also specify gateway, which, in our case is also simpleArbiter.</br></br>Ker bi radi, da v primeru zagona navideznega računalnika BootableClient B serviramo drugo datoteko, to naredimo tako da definiramo nek dodaten host na sledeč način:</br><b>(host special)</b> Pod <b>hardware ethernet</b> zapišemo MAC naslov našega BootableClient B katerega bo imel, dodelimo mu nek statičen ip naslov ter povemo še iz kje se naj datoteka <b>live-ISO</b> zažene.</p>
+ <p>We save the settings and kill terthe process with ubijemo named <b>dnsmasq</b>using<b>kilall dnsmasq</b>.</p>
+ <img style="width: 740px; height: 34px;" src="../images/22.png" alt="slika-22"></img>
+ <p>Sledi restart našega DHCP strežnika, da bo deloval z novimi nastavitvami, to naredimo z ukazom <b>service isc-dhcp-server restart</b></br>DHCP server is now ready! We supply BootableClientA and BootableClientB and test them!</p>
+
+
+ <h2 id="clientA">Postavitev <mark>BootableClient A</mark></h2>
+ <p>We open VirtualBox and select <b>New</b>, for the y
+<b>Name</b> field we specify
+BootableClient A and for the <b>Hard drive</b> we select <b>Do not add a
+virtual
+hard drive</b> (as we want diskless device), </br>and select Create.
+We want the computer to be on Internal network so vse select our
+<b>Bootable Client
+A</b> and select </br><b>Settings->Network</b> where we change Adapter
+1 to Internal Network.</p>
+ <img style="width: 800px; height: 678px;" src="../images/23.png" alt="slika-23"></img>
+ <p>We also wan our computer to boot through network, so
+under<b>Boot Order</b>tab select <b>Network</b>.</br>
+ We save the setting by clicking <b>OK</b></p>
+ <img style="width: 800px; height: 697px;" src="../images/24.png" alt="slika-24"></img>
+ <p>We run our BootableClient-a A and it get's it's
+IP(which is great), using the DHCP server and the simpleArbiter serves
+it exactly the file we specified. <b>A.0</b></p>
+ <img style="width: 800px; height: 494px;" src="../images/25.png" alt="slika-25"></img>
+
+
+
+ <h2 id="clientB">Setting up<mark>BootableClient
+B</mark></h2>
+ <p>Odpremo VirtualBox ter izberemo <b>New</b> in pod <b>Name</b> napišemo BootableClient B ter pod <b>Hard drive</b> izberemo <b>Do not add a virtual hard drive</b> (saj si želimo računalnik brez diska), </br>in pritisnemo na gump Create, da se nam ustvari navidezni računalnik. Želimo, da bo računalnik priklopljen na Internal network zato označimo naš <b>Bootable Client B</b> ter pritisnimo na </br><b>Settings->Network</b> in prvi Adapter 1 spremenimo na Internal Network.</br>
+ Poleg tega nastavimo še pod <b>MAC Address</b> takšen MAC naslov, kot ga imamo v nastavitvah DHCP strežnika (dhcpd.conf -> host special), saj želimo da bo ta naš računalnik izjema</br> in bo ob zagonu dobil drugo datoteko kot ostali in sicer <b>live-ISO</b></p>
+ <img style="width: 800px; height: 678px;" src="../images/26.png" alt="slika-26"></img>
+ <p>Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom <b>System</b></p> tako, da pod <b>Boot Order</b> obkljukamo samo <b>Network</b>.</br>
+ Nastavitve shranimo z pritiskom na gumb <b>OK</b></p>
+ <img style="width: 800px; height: 697px;" src="../images/27.png" alt="slika-27"></img>
+ <p>Poženemo našega BootableClient-a A in odličnoo, dobi ip naslov s pomočjo DHCP strežnika in simpleArbiter mu servira točno to datoteko katero si želimo <b>live-ISO</b></p>
+ <img style="width: 800px; height: 494px;" src="../images/28.png" alt="slika-28"></img>
+
+
+ </body>
+</html>
+
diff --git a/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html.save b/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html.save new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html.save diff --git a/tasks/isc_dhcp_live_boot/howtos/images/01.png b/tasks/isc_dhcp_live_boot/howtos/images/01.png Binary files differnew file mode 100644 index 0000000..906135b --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/01.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/02.png b/tasks/isc_dhcp_live_boot/howtos/images/02.png Binary files differnew file mode 100644 index 0000000..545f630 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/02.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/03.png b/tasks/isc_dhcp_live_boot/howtos/images/03.png Binary files differnew file mode 100755 index 0000000..0b69590 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/03.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/04.png b/tasks/isc_dhcp_live_boot/howtos/images/04.png Binary files differnew file mode 100755 index 0000000..ce4dc18 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/04.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/05.png b/tasks/isc_dhcp_live_boot/howtos/images/05.png Binary files differnew file mode 100755 index 0000000..f343ec1 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/05.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/06.png b/tasks/isc_dhcp_live_boot/howtos/images/06.png Binary files differnew file mode 100755 index 0000000..b4fe8e1 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/06.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/07.png b/tasks/isc_dhcp_live_boot/howtos/images/07.png Binary files differnew file mode 100755 index 0000000..b6da6eb --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/07.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/08.png b/tasks/isc_dhcp_live_boot/howtos/images/08.png Binary files differnew file mode 100755 index 0000000..333fd7d --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/08.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/09.png b/tasks/isc_dhcp_live_boot/howtos/images/09.png Binary files differnew file mode 100755 index 0000000..c7cb8b8 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/09.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/10.png b/tasks/isc_dhcp_live_boot/howtos/images/10.png Binary files differnew file mode 100755 index 0000000..c7f9225 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/10.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/11.png b/tasks/isc_dhcp_live_boot/howtos/images/11.png Binary files differnew file mode 100755 index 0000000..e1192e9 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/11.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/12.png b/tasks/isc_dhcp_live_boot/howtos/images/12.png Binary files differnew file mode 100755 index 0000000..295b3c7 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/12.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/13.png b/tasks/isc_dhcp_live_boot/howtos/images/13.png Binary files differnew file mode 100755 index 0000000..8d3badc --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/13.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/14.png b/tasks/isc_dhcp_live_boot/howtos/images/14.png Binary files differnew file mode 100755 index 0000000..3009f41 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/14.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/15.png b/tasks/isc_dhcp_live_boot/howtos/images/15.png Binary files differnew file mode 100755 index 0000000..c4413e8 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/15.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/16.png b/tasks/isc_dhcp_live_boot/howtos/images/16.png Binary files differnew file mode 100755 index 0000000..a4de5a8 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/16.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/17.png b/tasks/isc_dhcp_live_boot/howtos/images/17.png Binary files differnew file mode 100755 index 0000000..0ab5c0f --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/17.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/18.png b/tasks/isc_dhcp_live_boot/howtos/images/18.png Binary files differnew file mode 100755 index 0000000..4e1e17a --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/18.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/19.png b/tasks/isc_dhcp_live_boot/howtos/images/19.png Binary files differnew file mode 100755 index 0000000..570f644 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/19.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/20.png b/tasks/isc_dhcp_live_boot/howtos/images/20.png Binary files differnew file mode 100755 index 0000000..ea67ce0 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/20.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/21.png b/tasks/isc_dhcp_live_boot/howtos/images/21.png Binary files differnew file mode 100755 index 0000000..428f92f --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/21.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/22.png b/tasks/isc_dhcp_live_boot/howtos/images/22.png Binary files differnew file mode 100755 index 0000000..7119fff --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/22.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/23.png b/tasks/isc_dhcp_live_boot/howtos/images/23.png Binary files differnew file mode 100755 index 0000000..68d0477 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/23.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/24.png b/tasks/isc_dhcp_live_boot/howtos/images/24.png Binary files differnew file mode 100755 index 0000000..4ab2dd2 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/24.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/25.png b/tasks/isc_dhcp_live_boot/howtos/images/25.png Binary files differnew file mode 100755 index 0000000..8823ac1 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/25.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/26.png b/tasks/isc_dhcp_live_boot/howtos/images/26.png Binary files differnew file mode 100755 index 0000000..09eb081 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/26.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/27.png b/tasks/isc_dhcp_live_boot/howtos/images/27.png Binary files differnew file mode 100755 index 0000000..9b867e1 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/27.png diff --git a/tasks/isc_dhcp_live_boot/howtos/images/28.png b/tasks/isc_dhcp_live_boot/howtos/images/28.png Binary files differnew file mode 100755 index 0000000..5844b8a --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/images/28.png diff --git a/tasks/isc_dhcp_live_boot/howtos/si/index.html b/tasks/isc_dhcp_live_boot/howtos/si/index.html new file mode 100644 index 0000000..d83b934 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/howtos/si/index.html @@ -0,0 +1,147 @@ +<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>06 - preparation (isc_dhcp_live_boot)</title>
+ </head>
+
+ <body>
+ <h1 style="color:blue">06 - preparation (isc_dhcp_live_boot)</h1>
+ <h2>Kazalo</h2>
+ <ul>
+ <li><a href="#namen">Namen vaje</a></li>
+ <li><a href="#navidezniRacunalniki">Navidezni računalniki, ki so potrebni za izvedbo naloge</a></li>
+ <li><a href="#skicaPodomrezja">Skica našega podomrežja</a></li>
+ <li><a href="#simpleArbiterGW">Postavitev simpleArbiterGW</a></li>
+ <li><a href="#DHCP">Postavitev DHCP Server</a></li>
+ <li><a href="#clientA">Postavitev BootableClient A</a></li>
+ <li><a href="#clientB">Postavitev BootableClient B</a></li>
+ </ul>
+
+
+ <h2 id="namen">Namen vaje</h2>
+ <p>Kako narediti live boot z DHCP strežnikom.</p>
+
+ <h2 id="navidezniRacunalniki">Navidezni računalniki, ki so potrebni za izvedbo naloge</h2>
+ <p>Potrebujemo program VirtualBox ter naslednje 4 navidezne računalnike:
+ <ul>
+ <li><a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterGW.vdi">simpleArbiterGW</a></li>
+ <li><a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterDhcp.vdi">DHCP Server</a></li>
+ <li>Bootable Client A (računalnik brez diska)</li>
+ <li>Bootable Client B (računalnik brez diska)</li>
+ </ul>
+ </p>
+
+ <h2 id="skicaPodomrezja">Skica našega podomrežja</h2>
+ <img style="width: 800px; height: 610px;" src="../images/01.png" alt="slika-01"></img>
+ <p>Naš cilj je, da računalnik BootableClient A preko DHCP strežnika pridobil IP naslov ter se zažene z datoteko A, ki se nahaja na simpleArbiterGW,</br>če pa zaženemo računalnik BootableClient B pa si želimo, da ta preko DHCP strežnika pridobi IP naslov ter se zažene z nekim live ISO, ki se prav tako nahaja na simpleArbiterGW.
+ </p>
+
+ <h2 id="simpleArbiterGW">Postavitev <mark>simpleArbiterGW</mark></h2>
+ <p>Prenesemo <a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterGW.vdi">simpleArbiterGW.vdi</a> ter zaženemo VirtualBox. Ko je datoteka prenesena v VirtualBoxu izberemo New ter v polje Name vpišemo simpleArbiterGW.</br>Ustrezno nastavimo tudi Memory size (1gb pomnilnika nam bo zadostovalo). Spodaj izberemo še "Use an existing virtual hard drive file" ter izberemo naš simpleArbiterGW.vdi in pritisnimo Create.</p>
+ </br>
+ <img style="width: 800px; height: 464px;" src="../images/02.png" alt="slika-02"></img>
+ <p>Nato zaženemo virtualni računalnik simpleArbiterGW ter se z uporabniškim imenom "root" ter geslom "kaboom" vpišemo v naš sistem.</br></br>
+ Prvo računalnik od NAT-a, kateri je vgrajen v VirtualBox dobi nek naslov (v našem primeru 10.0.2.15).</br>(Da to preverimo uporabimo ukaz <b>ifconfig</b>) Preko tega IP naslova in vmesnika eth0 smo povezani v internet.<p>
+ <img style="width: 800px; height: 384px;" src="../images/03.png" alt="slika-03"></img>
+ <p>Mi pa si želimo 2 omrežna vmesnika na tem računalniku! Enega bi radi imeli na NAT (tega že imamo) drugega pa na Internal Network,</br>preko katerega bomo komunicirali z DHCP Strežnikom ter ostalimi računalniki, ki bodo v našem Internal Network-u.</br></br>
+ Nov omrežni vmesnik dodamo tako, da ugasnemo naš virtualni računalnik, ter v VirtualBoxu označimo naš virtualni računalnik in pritisnemo na <b>Settings -> Network</b></br>
+ <b>Adapter</b> 1 imamo že nastavljeno na NAT, <b>Adapter 2</b> pa nastavimo na Internal Network</p>
+ <img style="width: 800px; height: 137px;" src="../images/04.png" alt="slika-04"></img>
+ <p>Tako, zdaj imamo nastavljena 2 vmesnika!</br>V VirtualBoxu lahko definiramo več Internal Networkov (notranjih omrežij) a za naše potrebe bo to dovolj. Shranimo nastavitve ter ponovno poženimo naš simpleArbiterGW.</br></br>
+ Zdaj moramo oba omrežna vmesnika nastaviti tako, da bosta imela nek naslov. Uredimo datoteko <b>interfaces</b> v imeniku
+ <b>/etc/network</b>.</p>
+ <img style="width: 800px; height: 229px;" src="../images/05.png" alt="slika-05"></img>
+ <p>Za eth0 je poskrbel že DHCP strežnik, ki je vgrajen v VirtualBox (na eth0 je določil nek IP).</br>
+ Mi moramo nastaviti še drugi mrežni vmesnik. Kako se imenuje iz glave ne vemo zato s pomočjo ukaza <b>ifconfig -a</b> pogledamo.</p>
+ <img style="width: 800px; height: 117px;" src="../images/06.png" alt="slika-06"></img>
+ <p>Ugotovimo da je ime vmesnika eth1.
+ Zdaj bi rad na eth1 nastavil en IP naslov.</br>
+ Lahko bi nastavil z ifconfig, a ko rebootaš računalnik se nastavitve ne ohranijo. To nebi radi!</br>
+ Pojdimo raje skonfigurirat nastavitve v <b>/etc/network/interfaces</b></br></br>
+ Izmislimo si eno naključno lokalno omrežje oz naslov lokalnega omrežja ter nastavimo eth1.
+ </p>
+ <img style="width: 800px; height: 296px;" src="../images/07.png" alt="slika-07"></img>
+ <p>Shranimo konfiguracijsko datoteko. Moj računalnik še nima IP-ja na eth1 zato uporabim ukaz <b>ifup eth1</b></p>
+ <img style="width: 800px; height: 23px;" src="../images/08.png" alt="slika-08"></img></br>
+ <p>Sedaj uporabimo ukaz <b>ifconfig</b>, da vidimo če imamo slučajno ip na vmesniku eth1</p>
+ <img style="width: 800px; height: 389px;" src="../images/09.png" alt="slika-09"></img>
+ <p>Vidim, da ip imam. Super! Gremo postavit DHCP Server!</p>
+
+ <h2 id="DHCP">Postavitev <mark>DHCP Server</mark></h2>
+ <p>Prenesemo <a href="http://www.polz.si/media/uploads/kpov/virtualke/simpleArbiterDhcp.vdi">simpleArbiterDhcp.vdi</a> ter zaženemo VirtualBox. Ko je datoteka prenesena v VirtualBoxu izberemo New ter v polje Name vpišemo DHCP Server.</br>Ustrezno nastavimo tudi Memory size (1gb pomnilnika nam bo zadostovalo). Spodaj izberemo še "Use an existing virtual hard drive file" ter izberemo naš simpleArbiterDhcp in pritisnimo Create.<br>Ustrezno nastavimo tudi nastavitve mreže iz NAT na Internal Network</p>
+ </br>
+ <img style="width: 800px; height: 464px;" src="../images/10.png" alt="slika-10"></img>
+ <p>Nato zaženemo virtualni računalnik DHCP Server ter se z uporabniškim imenom "root" ter geslom "kaboom" vpišemo v naš sistem.</br></br>
+ <p>Sprva naš računalnik nima nobenega ip-ja saj mu ga nismo nastavili! Pojdimo skonfigurirat nastavitve v <b>/etc/network/interfaces</b>.</br>Ampak kateri vmesnik sploh konfiguriramo? Z ukazom <b>ifconfig -a</b> ugotovimo da je to <b>eth0</b>.<br>
+ Spet si izberemo nek svoj statičen ip naslov.</p>
+ <img style="width: 800px; height: 283px;" src="../images/11.png" alt="slika-11"></img>
+ <p>Shranimo konfiguracijsko datoteko. Moj računalnik še nima IP-ja na eth0 zato uporabim ukaz <b>ifdown eth0</b> ter nato še <b>ifup eth0</b></p>
+ <img style="width: 800px; height: 25px;" src="../images/12.png" alt="slika-12"></img>
+ <p>Sedaj uporabimo ukaz <b>ifconfig</b>, da vidimo če imamo slučajno ip na vmesniku eth0</p>
+ <img style="width: 800px; height: 329px;" src="../images/13.png" alt="slika-13"></img>
+ <p>Hura imamo! Namestimo naš DHCP strežnik z ukazom <b>apt-get install isc-dhcp-server</b></p>
+ <img style="width: 800px; height: 322px;" src="../images/14.png" alt="slika-14"></img>
+ <p>Vidimo, da dobimo cel kup napak. Ampak zakaj? Zato, ker nimamo dostopa do interneta! <br>
+ Vmesniku eth0 moramo seveda povedati Gateway. Naš Gateway bo seveda IP našega simpleArbiter navideznega računalnika.</br> To naredimo s pomočjo ukaza <b>route add default gw 192.168.251.1 eth0</b></p>
+ <img style="width: 800px; height: 43px;" src="../images/15.png" alt="slika-15"></img>
+ <p>Probajmo ping-ati Googlov DNS strežnik, da ugotovimo če imamo sedaj internet.</br>
+ To naredimo z ukazom <b>ping 8.8.8.8</b>.</p>
+ <img style="width: 800px; height: 361px;" src="../images/16.png" alt="slika-16"></img>
+ <p>Googlov DNS strežnik se odziva, super! </br>
+ Ampak <b>apt-get install isc-dhcp-server</b> še vedno ne moremo naložiti.</br>
+ Začasno dodajmo še en mrežni vmesnik ter ga nastavimo na NAT, nato bomo dobili dostop do interneta ter lahko namestimo naš DHCP strežnik.</br></br>
+ Nov omrežni vmesnik dodamo tako, da ugasnemo naš virtualni računalnik, ter v VirtualBoxu označimo naš virtualni računalnik in pritisnemo na <b>Settings -> Network</b></br>
+ <b>Adapter 1</b> imamo že nastavljeno na Internal Network, <b>Adapter 2</b> pa nastavimo na NAT</p>
+ <img style="width: 800px; height: 134px;" src="../images/17.png" alt="slika-17"></img>
+ <p>Zaženemo naš DHCP Server in v <b>/etc/network/interfaces</b> začasno na koncu dodamo vrstico <b>iface eth1 inet dhcp</b>,datoteko shranimo ter poženemo ukaz <b>ifup eth1</b>.<br>
+ Sedaj imamo dostop do interneta in lahko namestimo naš DHCP strežnik z ukazom <b>apt-get install isc-dhcp-server install</b></br>
+ <img style="width: 800px; height: 26px;" src="../images/18.png" alt="slika-18"></img></br>
+ <p>Poglejmo kaj je v <b>/var/log/syslog</b>, to je datoteka kamor se shranjujejo sporočila kaj se dogaja v našem sistemu</p>
+ <img style="width: 800px; height: 323px;" src="../images/19.png" alt="slika-19"></img></br>
+ <p>Očitno moramo nastaviti dhcp strežnik ter mu povedati tudi kam naj posluša! </br>
+ Za nastavitve DHCP strežnika imamo <b>/etc/dhcp/dhcpd.conf</b>. Nastavimo jo! </br>
+ Prvo zakomentiramo <b>option domain-name-servers</b> zaradi tega da nebo napak da jih ne najde.</p>
+ <img style="width: 800px; height: 26px;" src="../images/20.png" alt="slika-20"></img></br>
+ <p>Nato skonfiguriramo dhcp strežnik, da bo serviral ip-je na nekem podomrežju. Dodamo naslednje zapise:</p>
+ <img style="width: 800px; height: 417px;" src="../images/21.png" alt="slika-21"></img>
+ <p><b>(subnet)</b> Nastavimo podomrežje ter območje naslovov od koder naj jih DHCP strežnik dodeli, katero datoteko naj servira,</br> poleg tega so eni PXE tako neumni, da če jim ti serviraš filename nevejo iz katerega serverja ga dobim, zato napišem še next-server </br>(ip od koder serviram, v našem primeru simpleArbiter), nastavim tudi gateway kateri je v našem primeru tudi simpleArbiter.</br></br>Ker bi radi, da v primeru zagona navideznega računalnika BootableClient B serviramo drugo datoteko, to naredimo tako da definiramo nek dodaten host na sledeč način:</br><b>(host special)</b> Pod <b>hardware ethernet</b> zapišemo MAC naslov našega BootableClient B katerega bo imel, dodelimo mu nek statičen ip naslov ter povemo še iz kje se naj datoteka <b>live-ISO</b> zažene.</p>
+ <p>Spremembe shranimo, ter ubijemo proces z imenom <b>dnsmasq</b> z ukazom <b>kilall dnsmasq</b>.</p>
+ <img style="width: 740px; height: 34px;" src="../images/22.png" alt="slika-22"></img>
+ <p>Sledi restart našega DHCP strežnika, da bo deloval z novimi nastavitvami, to naredimo z ukazom <b>service isc-dhcp-server restart</b></br>DHCP Strežnik je pripravljen! Pripravimo BootableClientA ter BootableClientB ter testirajmo!</p>
+
+
+ <h2 id="clientA">Postavitev <mark>BootableClient A</mark></h2>
+ <p>Odpremo VirtualBox ter izberemo <b>New</b> in pod <b>Name</b> napišemo BootableClient A ter pod <b>Hard drive</b> izberemo <b>Do not add a virtual hard drive</b> (saj si želimo računalnik brez diska), </br>in pritisnemo na gump Create, da se nam ustvari navidezni računalnik. Želimo, da bo računalnik priklopljen na Internal network zato označimo naš <b>Bootable Client A</b> ter pritisnimo na </br><b>Settings->Network</b> in prvi Adapter 1 spremenimo na Internal Network.</p>
+ <img style="width: 800px; height: 678px;" src="../images/23.png" alt="slika-23"></img>
+ <p>Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom <b>System</b></p> tako, da pod <b>Boot Order</b> obkljukamo samo <b>Network</b>.</br>
+ Nastavitve shranimo z pritiskom na gumb <b>OK</b></p>
+ <img style="width: 800px; height: 697px;" src="../images/24.png" alt="slika-24"></img>
+ <p>Poženemo našega BootableClient-a A in odličnoo, dobi ip naslov s pomočjo DHCP strežnika in simpleArbiter mu servira točno to datoteko katero si želimo <b>A.0</b></p>
+ <img style="width: 800px; height: 494px;" src="../images/25.png" alt="slika-25"></img>
+
+
+
+ <h2 id="clientB">Postavitev <mark>BootableClient B</mark></h2>
+ <p>Odpremo VirtualBox ter izberemo <b>New</b> in pod <b>Name</b> napišemo BootableClient B ter pod <b>Hard drive</b> izberemo <b>Do not add a virtual hard drive</b> (saj si želimo računalnik brez diska), </br>in pritisnemo na gump Create, da se nam ustvari navidezni računalnik. Želimo, da bo računalnik priklopljen na Internal network zato označimo naš <b>Bootable Client B</b> ter pritisnimo na </br><b>Settings->Network</b> in prvi Adapter 1 spremenimo na Internal Network.</br>
+ Poleg tega nastavimo še pod <b>MAC Address</b> takšen MAC naslov, kot ga imamo v nastavitvah DHCP strežnika (dhcpd.conf -> host special), saj želimo da bo ta naš računalnik izjema</br> in bo ob zagonu dobil drugo datoteko kot ostali in sicer <b>live-ISO</b></p>
+ <img style="width: 800px; height: 678px;" src="../images/26.png" alt="slika-26"></img>
+ <p>Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom <b>System</b></p> tako, da pod <b>Boot Order</b> obkljukamo samo <b>Network</b>.</br>
+ Nastavitve shranimo z pritiskom na gumb <b>OK</b></p>
+ <img style="width: 800px; height: 697px;" src="../images/27.png" alt="slika-27"></img>
+ <p>Poženemo našega BootableClient-a A in odličnoo, dobi ip naslov s pomočjo DHCP strežnika in simpleArbiter mu servira točno to datoteko katero si želimo <b>live-ISO</b></p>
+ <img style="width: 800px; height: 494px;" src="../images/28.png" alt="slika-28"></img>
+<h2 id="tftpInPxe">Postavitev <mark>TFTP strežnika in zagonskih datotek</mark></h2>
+
+<p>Na SimpleArbiter namestimo TFTP strežnik z ukazom <b>apt-get install tftpd-hpa</b> in spremenimo IP v <b>"/etc/default/tftpd-hpa"</b> pod TFTP_ADDRES na "192.168.251.1".
+<br>Nato z ukazom <b>apt-get install syslinux</b> namestimo syslinux in skopiramo zagonsko datoteko iz "/usr/lib/syslinux/pxelinux.0" na "/srv/tftp/A.0.<br> Namestimo še NFS server z ukazom "apt-get install nfs-kernel-server" in v "/etc/exports" dodamo lokacijo mape, kjer se nahaja naša zagonska datoteka A.0, ter omogočimo branje ("/srv/tftp * (ro)").
+<br>V imeniku /srv/tftp ustvarimo mapo "pxelinux.cfg" in v njej ustvarimo datoteko z imenom default. Vanjo vpišemo :
+<br>DEFAULT vesamenu.c32
+<br>PROMPT 0
+<br>MENU TITLE isc-dhcp-live
+<br>LABEL iso
+<br> menu label Run
+<br> kernel vmlinuz
+<br> APPEND boot=casper netboot=nfs nfsroot=192.168.251.1:/srv/tftp/boot/ initrd=initrd.gz</p>
+ </body>
+</html>
+
diff --git a/tasks/isc_dhcp_live_boot/task.py b/tasks/isc_dhcp_live_boot/task.py new file mode 100644 index 0000000..c1adc47 --- /dev/null +++ b/tasks/isc_dhcp_live_boot/task.py @@ -0,0 +1,222 @@ +# TODO: dokoncaj! +# kpov_util should be imported by add_assignment.py + +instructions = { + 'si': '''\ +<p> +Postavi štiri navidezne računalnike: <em>simpleArbiter</em>, <em>DHCP_server</em>, <em>BootableClientA</em> in <em>BootableClientB</em>. + +<p> +Na <em>DHCP_server</em> postavi strežnik DHCP s pomočjo ISC dhcp 3 na naslovu <code>{{IP_DHCP}}</code>. <em>SimpleArbiter</em> naj dobi <code>{{IP_GW}}</code>. <em>DHCP_server</em> naj ga uporabi kot privzeti prehod (angl. <em lang="en">gateway</em>). + +<p> +Če se zaganja <em>BootableClientB</em>, naj se sistem zažene v datoteko z imenom <code>{{BOOT_FNAME}}</code>. Če se zaganja katerikoli drug, naj se sistem zažene z živega USB, ki ga predstavlja slika diska <code>bootable_usb</code>, ime datoteke z zagonskim nalagalnikom pa naj bo kakršno koli razen <code>{{BOOT_FNAME}}</code>. + +<p> +Živi USB priklopite na na <em>DHCP_server</em> in z njega poberite datoteke, potrebne za zagon. Datoteke z nastavitvami za PXELinux, ki jih najdete na živem USB, <em>morajo</em> biti dostopne na korenskem imeniku strežnika TFTP. + +<p> +Tako <em>BootableClientA</em> kot <em>BootableClientB</em> naj bosta brez diskov. +''', + 'en': '''\ +<p> +Set up four virtual machines: <em>simpleArbiter</em>, <em>DHCP_server</em>, <em>BootableClientA</em> and <em>BootableClientB</em>. + +<p> +On <em>DHCP_server</em>, set up a DHCP server using ISC dhcp 3. Set the IP address of this server to <code>{{IP_DHCP}}</code>. If <em>SimpleArbiter</em> requests an IP, have the DHCP server serve it <code>{{IP_GW}}</code>. <em>DHCP_server</em> should use <em>SimpleArbiter</em> as the gateway. + +<p> +If <em>BootableClientB</em> tries to boot over the network, have the DHCP server tell it to boot from the file <code>{{BOOT_FNAME}}</code>. If any other system tries to boot over the network, have it boot from a live USB drive represented by the disk image <code>bootable_usb</code> and have the bootloader filename be different from <code>{{BOOT_FNAME}}</code>. + +<p> +Connect the live USB to DHCP_server and copy the files neccessarry for it to boot. The PXELinux configuration files must be the same as the ones found on the live USB and <em>must</em> be accessible on the TFTP server root. + +<p> +Both <em>BootableCLientA</em> and <em>BootableClientB</em> should be diskless. +''', +} + +computers = { + 'DHCPServer': { + 'disks': [ + { 'name': 'student-DHCPServer', + }, + { 'name': 'bootable_usb', + 'options':{'readonly': False}, + 'parts': [ {'dev': 'sdb1', 'path':'/mnt'} ], + }, + ], + 'network_interfaces': [{'network': 'net1'}], + 'flavor': 'm1.tiny', + 'config_drive': False + }, + 'BootableClientA': { + 'disks': [ + ], + 'network_interfaces': [{'network': 'net1'}], + 'flavor': 'm1.tiny', + 'config_drive': False + }, + 'BootableClientB': { + 'disks': [ + ], + 'network_interfaces': [{'network': 'net1'}], + 'flavor': 'm1.tiny', + 'config_drive': False + }, + 'SimpleArbiter': { + 'disks': [ + { 'name': 'simpleArbiterGW', + }, + ], + 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], + 'flavor': 'm1.tiny', + 'config_drive': False + } +} + +networks = { 'net1': {'public': False}, 'test-net': {'public': True} } + +params_meta = { + 'IP_DHCP': {'descriptions': {'si': 'IP DHCP streznika'}, 'w': False, 'public': True, 'type':'IP', 'generated': True}, + 'IP_GW': {'descriptions': {'si': 'IP SimpleArbiterja'}, 'w': False, 'public': True, 'type':'IP', 'generated': True}, + 'MAC_BOOT': {'descriptions': {'si': 'MAC racunalnika, ki se zazene z ISO'}, 'w': True, 'public': True, 'type':'MAC', 'generated': False}, + # 'IP_BOOT': {'descriptions': {'si': 'IP racunalnika, ki se zazene z ISO'}, 'w': True, 'public': True, 'type':'IP', 'generated': False}, + 'TFTP_STRING': {'descriptions': {'si': 'vsebina'}, 'w': False, 'public': False, 'type':'short', 'generated': True}, + 'BOOT_FNAME': {'descriptions': {'si': 'Ime datoteke'}, 'w': False, 'public': True, 'type': 'filename', 'generated': True}, +} + +def task(IP_DHCP, IP_GW, MAC_BOOT, BOOT_FNAME): + # check the IP + # TODO (polz): Do not use tabs instead of spaces! + import pexpect + import re + import tftpy + import io + import time + results={} + # TODO (polz): Please use pexpect instead of os.system, it's much nicer. + # Also, test your functions. This function was obviously never run. + # + # check whether the fname served by the dhcp server is + # correct + # you should check the DHCP response from the server. + # You can use dhcpdump to get some packets, dhcping to create a + # DHCP Request. You may also use any other tool. + # If you choose to use dhcping, do not forget to set the hw address + # and ip arguments. You can simply feed it MAC_BOOT and IP_BOOT. + # dhcping -h MAC_BOOT -c IP_BOOT -V -r + # could work (but you should test it) + ip_str = pexpect.run('ip addr show') + eth_re_str = r"ether (([0-9a-f]{{2}}:){{5}}[0-9a-f]{{2}})(.*)\r\n(.*){}(.*)\s(\w*)\r\n" + ip_re = re.search(eth_re_str.format(IP_GW), ip_str) + mac_SA = ip_re.group(1) + eth_dev_SA = ip_re.group(6) + dhcpdump = pexpect.spawn("sudo dhcpdump -i {}".format(eth_dev_SA)) + time.sleep(2) + results['dhcping_other'] = pexpect.run('sudo dhcping -s {} -h {} -c {}'.format( + IP_DHCP, MAC_BOOT, IP_GW)) + dhcpdump.expect('---------------------------------------------------------------------------') + results['dhcpdump_other_req'] = dhcpdump.before + dhcpdump.expect('---------------------------------------------------------------------------') + results['dhcpdump_other_reply'] = dhcpdump.before + dhcpdump.expect('---------------------------------------------------------------------------') + results['dhcpdump_other_release'] = dhcpdump.before + results['dhcping_SA'] = pexpect.run('sudo dhcping -s {} -h {} -c {}'.format( + IP_DHCP, mac_SA, IP_GW)) + dhcpdump.expect('---------------------------------------------------------------------------') + results['dhcpdump_SA_req'] = dhcpdump.before + dhcpdump.expect('---------------------------------------------------------------------------') + results['dhcpdump_SA_reply'] = dhcpdump.before + dhcpdump.expect('---------------------------------------------------------------------------') + results['dhcpdump_SA_release'] = dhcpdump.before + dhcpdump.sendintr() + tftp_client = pexpect.spawn('tftp {}'.format(IP_DHCP)) + tftp_client.expect(r'tftp>') + tftp_client.sendline('get pxelinux.cfg/default /dev/stdout') + tftp_client.expect(r'tftp>') + results['tftp_string'] = tftp_client.before + # check whether the fname served by the dhcp server is correct + # connect to the service in the special ISO + # check the MAC of the server on IP_BOOT + return results + +def gen_params(user_id, params_meta): + params = dict() + r = random.Random(user_id) + net = kpov_util.IPv4_subnet_gen(r, '10.64.0.0/10', 24) + params['IP_DHCP'], params['IP_GW'] = kpov_util.IPv4_addr_gen(r, net, 2) + params['BOOT_FNAME'] = kpov_util.fname_gen(r) + params['TFTP_STRING'] = kpov_util.alnum_gen(r, 45) + return params + +def task_check(results, params): + import re + score = 0 + hints = [] + #TO FINISH SCORING WE REQUIRE DICT KEYS AND FUNCTIONS gen_params AND task TO BE FINISHED + #POINTS FOR EACH TASK MAY BE ADJUSTED IN THE FUTURE + if results['dhcping_other'].find(params['IP_DHCP']) >= 0: + score += 1 + else: + hints += ["DHCP wrong"] + if results['dhcping_SA'].find(params['IP_DHCP']) >= 0: + score += 1 + else: + hints += ["DHCP wrong"] + p = re.search(r"FNAME:(.*)\.\r", + results['dhcpdump_other_reply']) + if p is not None: + other_fname = p.group(1).strip() + else: + other_fname = '' + if other_fname == params['BOOT_FNAME']: + score += 3 + else: + hints += ["special fname wrong:" + other_fname] + p = re.search(r"FNAME:(.*)\.\r", + results['dhcpdump_SA_reply']) + if p is not None: + sa_fname = p.group(1).strip() + else: + sa_fname = '' + if sa_fname != params['BOOT_FNAME']: + score += 3 + else: + hints += ["fname wrong:" + sa_fname] + try: + special_tftp = "# " + params['TFTP_STRING'] + tftp_end = results['tftp_string'].split('\r\r\n')[-1] + assert tftp_end[:len(special_tftp)] == special_tftp + score += 2 + except: + hints += ["tftp wrong"] + return score, hints + +def prepare_disks(templates, task_params, global_params): + d = templates['student-DHCPServer'] + s = """# {}""".format(task_params['TFTP_STRING']) + d = templates['bootable_usb'] + d.write_append('/mnt/syslinux.cfg', s) + d = templates['simpleArbiterGW'] + s = """auto lo +iface lo inet loopback + +auto ens3 +iface ens3 inet dhcp + +auto enp0s3 +iface enp0s3 inet dhcp + +auto ens4 +iface ens4 inet static + address {IP_GW} + netmask 255.192.0.0 + +auto enp0s8 +iface enp0s8 inet static + address {IP_GW} + netmask 255.192.0.0 +""".format(IP_GW = task_params['IP_GW']) + d.write("/etc/network/interfaces", s) + write_default_config(templates['simpleArbiterGW'], global_params) |