From 6dc6b6d972ee8ccbd331bb27215f954c53ecd337 Mon Sep 17 00:00:00 2001 From: "al0115@student.uni-lj.si" Date: Mon, 15 Dec 2014 21:58:38 +0000 Subject: nekkk git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@83 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- .../tasks/isc_dhcp_live_boot/howtos/si/index.html | 162 +++++++++++++++++++++ 1 file changed, 162 insertions(+) (limited to 'kpov_judge/tasks/isc_dhcp_live_boot/howtos/si') diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html index 7e3ffc7..e4cf33d 100644 --- a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html +++ b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html @@ -121,6 +121,168 @@ +

Postavitev BootableClient B

+

Odpremo VirtualBox ter izberemo New in pod Name napišemo BootableClient B ter pod Hard drive izberemo Do not add a virtual hard drive (saj si želimo računalnik brez diska),
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š Bootable Client B ter pritisnimo na
Settings->Network in prvi Adapter 1 spremenimo na Internal Network.
+ Poleg tega nastavimo še pod MAC Address 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
in bo ob zagonu dobil drugo datoteko kot ostali in sicer live-ISO

+ slika-26 +

Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom System

tako, da pod Boot Order obkljukamo samo Network.
+ Nastavitve shranimo z pritiskom na gumb OK

+ slika-27 +

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 live-ISO

+ slika-28 + + + + + + + + + 06 - preparation (isc_dhcp_live_boot) + + + +

06 - preparation (isc_dhcp_live_boot)

+

Table of contents

+ + + +

Purpose of this exercise

+

How to perform live boot using a DHCP server.

+ + +

We need VirtualBox and the following 4 virtual +machines: +

+

+ +

Schematics of our subnet

+ slika-01 +

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,
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. +

+ +

Setting up simpleArbiterGW

+

Download simpleArbiterGW.vdi +and then run VirtualBox. After the file is downloaded, choose the New +option in VirtualBoxu and set simpleArbiterGW in the Name +field.
Memory size should be set accordingly (1gb will suffice). +Spodaj +izberemo še "Use an existing virtual hard drive file" ter izberemo naš simpleArbiterGW.vdi in pritisnimo Create.

+
+ slika-02 +

We start our virtual machines simpleArbiterGW using the +following login +credentials; username: "root", password: "kaboom".

+ Prvo računalnik od NAT-a, kateri je vgrajen v VirtualBox dobi nek naslov (v našem primeru 10.0.2.15).
(Da to preverimo uporabimo ukaz ifconfig) Preko tega IP naslova in vmesnika eth0 smo povezani v internet.

+ slika-03 +

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,
preko katerega bomo komunicirali z DHCP Strežnikom ter ostalimi računalniki, ki bodo v našem Internal Network-u.

+ We add a new interface, by turning off the virtual machine, +select our machine in VirtualBox and select +računalnik, ter v VirtualBoxu Settings -> Network
+ Adapter 1 is already set to NAT, we set Adapter +2 to +Internal Network

+ slika-04 +

So, now we have two network interfaces!
In VirtuaBox +we can define multiple Internal Networks, however, for our need's two +will suffice. We save the settings and restart simpleArbiterGW.

+ Zdaj moramo oba omrežna vmesnika nastaviti tako, da bosta imela nek naslov. Uredimo datoteko interfaces v imeniku + /etc/network.

+ slika-05 +

Eth0 was already handled by and integrated DHCP, so eth0 had been assigned an IP).
+ We have to set up the other network interface. If we don't know it's name, we find it out using ifconfig -a.

+ slika-06 +

We can conclude the interface names is set to Eth1. + Now we would like to assign an IP naslov to Eth1.
+ Ifconfig could be used, but rebooting the machine would reset the settings. Which is not ideal :)
+ So configuring /etc/network/interfaces would be a better idea.

+ Izmislimo si eno naključno lokalno omrežje oz naslov lokalnega omrežja ter nastavimo eth1. +

+ slika-07 +

Shranimo konfiguracijsko datoteko. Moj računalnik še nima IP-ja na eth1 zato uporabim ukaz ifup eth1

+ slika-08
+

Now ew use the ifconfig command, to see whether and ip is assigned to eth1 interface

+ slika-09 +

We can see the IP is set. Now let's set up the DHCP +Server!

+ +

Setting up DHCP Server

+

We download simpleArbiterDhcp.vdi ter zaženemo VirtualBox. Ko je datoteka prenesena v VirtualBoxu izberemo New ter v polje Name vpišemo DHCP Server.
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.

+
+ slika-10 +

We run DHCP Server virtual machine and login using "root" ad username and "kaboom" as password.

+

At first, our machine has no assigned IP, since none was set! Let+s configure it in /etc/network/interfaces.
But which interface should we configure? Using ifconfig -a command, we see it's eth0interface.
+ Again we select our IP address.

+ slika-11 +

We save the configuration file. Our computer still has no IP address assigned to eth0, so using ifdown eth0 and then ifup eth0we provide one.

+ slika-12 +

Now let us use ifconfig command, to check whether there is an IP assigned to interface eth0

+ slika-13 +

We got it! We install DHCP server using apt-get install isc-dhcp-server

+ slika-14 +

We see a bunch of errors. Why? Bacause, we have not internet access!
+ We need to specify the Gateway for our inteface. Our Gateway bo seveda IP našega simpleArbiter navideznega računalnika.
To naredimo s pomočjo ukaza route add default gw 192.168.251.1 eth0

+ slika-15 +

Try pinging Google's DNS server at 8.8.8.8, to check if now have internet access.
+ We do this using the ping 8.8.8.8 command.

+ slika-16 +

Google's DNS server is responding. Great!
+ However, we still cannot run apt-get install isc-dhcp-server
+ Let's tempororly add another interface and set it to NAT, so we get internet access and install the DHCP server.

+ We add a new interface by turning off the virtual computer, , ter v VirtualBoxu označimo naš virtualni računalnik in pritisnemo na Settings -> Network
+ Adapter 1 imamo že nastavljeno na Internal Network, Adapter 2 pa nastavimo na NAT

+ slika-17 +

Zaženemo naš DHCP Server in v /etc/network/interfaces začasno na koncu dodamo vrstico iface eth1 inet dhcp,datoteko shranimo ter poženemo ukaz ifup eth1.
+ Sedaj imamo dostop do interneta in lahko namestimo naš DHCP strežnik z ukazom apt-get install isc-dhcp-server install
+ slika-18
+

Poglejmo kaj je v /var/log/syslog, to je datoteka kamor se shranjujejo sporočila kaj se dogaja v našem sistemu

+ slika-19
+

Očitno moramo nastaviti dhcp strežnik ter mu povedati tudi kam naj posluša!
+ Za nastavitve DHCP strežnika imamo /etc/dhcp/dhcpd.conf. Let's set it!
+ Prvo zakomentiramo option domain-name-servers zaradi tega da nebo napak da jih ne najde.

+ slika-20
+

Nato skonfiguriramo dhcp strežnik, da bo serviral ip-je na nekem podomrežju. Dodamo naslednje zapise:

+ slika-21 +

(subnet) Nastavimo podomrežje ter območje naslovov od koder naj jih DHCP strežnik dodeli, katero datoteko naj servira,
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
(ip od koder serviram, v našem primeru simpleArbiter), nastavim tudi gateway kateri je v našem primeru tudi simpleArbiter.

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:
(host special) Pod hardware ethernet 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 live-ISO zažene.

+

We save the settings and kill terthe process with ubijemo named dnsmasqusingkilall dnsmasq.

+ slika-22 +

Sledi restart našega DHCP strežnika, da bo deloval z novimi nastavitvami, to naredimo z ukazom service isc-dhcp-server restart
DHCP Strežnik je pripravljen! Pripravimo BootableClientA ter BootableClientB ter testirajmo!

+ + +

Postavitev BootableClient A

+

Odpremo VirtualBox ter izberemo New in pod Name napišemo BootableClient A ter pod Hard drive izberemo Do not add a virtual hard drive (saj si želimo računalnik brez diska),
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š Bootable Client A ter pritisnimo na
Settings->Network in prvi Adapter 1 spremenimo na Internal Network.

+ slika-23 +

Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom System

tako, da pod Boot Order obkljukamo samo Network.
+ Nastavitve shranimo z pritiskom na gumb OK

+ slika-24 +

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 A.0

+ slika-25 + + +

Postavitev BootableClient B

Odpremo VirtualBox ter izberemo New in pod Name napišemo BootableClient B ter pod Hard drive izberemo Do not add a virtual hard drive (saj si želimo računalnik brez diska),
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š Bootable Client B ter pritisnimo na
Settings->Network in prvi Adapter 1 spremenimo na Internal Network.
Poleg tega nastavimo še pod MAC Address 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
in bo ob zagonu dobil drugo datoteko kot ostali in sicer live-ISO

-- cgit v1.2.1