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 /kpov_judge/tasks/set_ip_static_dhcp | |
parent | 9963b74f777edf985540eac71b1ca095f88b8bca (diff) |
Move everything one level up
Diffstat (limited to 'kpov_judge/tasks/set_ip_static_dhcp')
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html | 73 | ||||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png | bin | 11706 -> 0 bytes | |||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png | bin | 187608 -> 0 bytes | |||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png | bin | 193147 -> 0 bytes | |||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png | bin | 189272 -> 0 bytes | |||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png | bin | 163954 -> 0 bytes | |||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png | bin | 175600 -> 0 bytes | |||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png | bin | 7062 -> 0 bytes | |||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html | 74 | ||||
-rw-r--r-- | kpov_judge/tasks/set_ip_static_dhcp/task.py | 127 |
10 files changed, 0 insertions, 274 deletions
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html b/kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html deleted file mode 100644 index 74dfeea..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html +++ /dev/null @@ -1,73 +0,0 @@ -<p> -<h2>Purpose of the assignment</h2> -Learn how to setup network interfaces in most modern Linux distributions (NetworkManager). -</p> -<p> -<h2>Quick instructions</h2> -Set a static IP in NetworkManager, set a static IP and DNS server in /etc/network/interfaces. You'll get both IP's when you execute script run_test.py. -</p> -<p> -<h2>Instructions</p> -<ol> -<li>From the directory with images of virtual computers, download the following:<br/> maliNetworkManager, maliBrezNetworkManager, SimpleArbiterDhcp.</li> - -<li>Set the network for virtual computers, so that SimpleArbiterDhcp's 1. nework interface is connected to the same network, as the only network interface for maliNetworkManager and maliBrezNetworkManager,<br/> - SimpleArbiterDhcp's 2. network interface will be connected to a NAT or a physical network, where the address and route (gateway) to the internet is obtained via DHCP.</li> - -<li>Start SimpleArbiterDhcp. Sign in as user "tester" with password "SedemKrogovPekla".</li> -<li> -<img alt="slika-04" src="https://lusy.fri.uni-lj.si/kpov-public-svn/kpov-public/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png" style="width: 800px; height: 600px;" /><br/> -Use command <pre>ping 193.2.1.66</pre> to check if SimpleArbiterDhcp is connected to internet. If you get ping reply, you're connected to the internet. Cancel the ping with combination CTRL+C.<br/> - If SimpleArbiterDhcp doesn't have internet access, change the network settings in Virtual box for 1. and 2. network interface, then restart the virtual computer. - -</li> -<li>Run the script run_test.py.</li> - -<li>Enter "03.predvaja" as assignment name.</li> - -<li>Read the maliNetworkManager's static IP . Leave SimpleArbiterDhcp running in the background until you have setup the maliNetworkManager.</li> - -<li>Start maliNetworkManager.</li> - -<li> -Sign in the GUI(graphical user interface) using username "student" and password "vaje".</li> -<li><img alt="ikona network manager" src="https://lusy.fri.uni-lj.si/kpov-public-svn/kpov-public/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png" style="width: 800px; height: 600px;" /><br/> -Right click on the icon for network settings.</br> - -<li> -<img alt="Menu NetworkManager" src="https://lusy.fri.uni-lj.si/kpov-public-svn/kpov-public/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png" style="width: 800px; height: 600px;" /><br/> -Choose "Edit Connections"</li> - -<li> -<img alt="Menu NetworkManager" src="https://lusy.fri.uni-lj.si/kpov-public-svn/kpov-public/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png" style="width: 800px; height: 600px;" /><br/> -Click "Edit"</li> - -<li> -<img alt="Menu NetworkManager" src="https://lusy.fri.uni-lj.si/kpov-public-svn/kpov-public/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png" style="width: 800px; height: 600px;" /><br/> -In tab "IPv4" change the "Method" to "Manual". Click "Add". Set the SimpleArbiterDhcp's static IP as static IP A.<br/> -Add Arnes DNS: 193.2.1.66 to DNS servers. -</li> -<li>Click "Save"</li> - -<li>Switch to SimpleArbiterDhcp. Click "Enter" or "OK".</li> - -<li>Read maliBrezNetworkManager's IP . Click "OK". Read the DNS server's address .</li> - -<li> Switch to maliBrezNetworkManager. Switch to first console using combination CTRL+ALT+F1. Sign in as root (su) with password "kaboom".</li> - -<li> Open the file /etc/network/interfaces. Edit the settings according to the information you got on SimpleArbiter. Entry for network interface should look something like this:<br/> -<pre> -allow-hotplug eth0 -iface eth0 inet static - 10.0.1.2 - netmask 255.255.255.128 - dns-nameservers 10.0.1.5 -</pre> -</li> - -<li> Save the settings. Use the command <pre>reboot</pre> to restart maliBrezNetworkManager. On boot the NetworkManager reads which network interfaces are configured in /etc/network/interfaces. After that NetworkManager doesn't manage these interfaces anymore.</li> - - -</li>Press OK on SimpleArbiterDhcp. If all went ok, you have completed this assignment.</li> -</ol> -</p> diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png Binary files differdeleted file mode 100644 index 754c200..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png +++ /dev/null diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png Binary files differdeleted file mode 100644 index 866a51d..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png +++ /dev/null diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png Binary files differdeleted file mode 100644 index d6ccf42..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png +++ /dev/null diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png Binary files differdeleted file mode 100644 index 10b5ec7..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png +++ /dev/null diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png Binary files differdeleted file mode 100644 index 0a87ae6..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png +++ /dev/null diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png Binary files differdeleted file mode 100644 index e71474a..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png +++ /dev/null diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png Binary files differdeleted file mode 100644 index d4bba87..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png +++ /dev/null diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html b/kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html deleted file mode 100644 index 6236245..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html +++ /dev/null @@ -1,74 +0,0 @@ -<p> -<h2>Namen vaje</h2> -Naučite se, kako se nastavljajo omrežni vmesniki v večini sodobnih Linux distribucij (NetworkManager). -</p> -<p> -<h2>Naloga na hitro</h2> -Nastavi statičen IP v NetworkManager-ju, nastavi statični IP in DNS strežnik v /etc/network/interfaces. Oba naslova računalnikov in DNS strežnikov dobite ob zagonu run_test.py. -</p> -<p> -<h2>Navodila</p> -<ol> -<li>Z imenika s slikami virtualnih računalnikov povlecite slike maliNetworkManager, maliBrezNetworkManager, SimpleArbiterGW</li> - -<li>Nastavite omrežja navideznih računalnikov tako, da bo<br/>1. omrežni vmesnik SimpleArbiterGW povezan na isto omrežje kot edini omrežni vmesnik maliNetworkManager in maliBrezNetworkManager,<br/> - 2. vmesnik SimpleArbiterGW bo povezan na NAT ali fizično omrežje, kjer prek DHCP dobi naslov in pot (prehod, gateway) do Interneta.</li> - -<li>Zaženite SimpleArbiterGW. Prijavite se kot uporabnik tester z geslom SedemKrogovPekla</li> -<li> -<img alt="slika-04" src="../images/04.png" style="width: 800px; height: 600px;" /><br/> -Z ukazom <pre>ping 8.8.8.8 </pre> preverite, ali je SimpleArbiterGW na Internetu. Če je, boste približno vsako sekundo dobili odziv. Ping prekinete -s kombinacijo tipk CTRL+C.<br/> - Če SimpleArbiterGW ne pride do Interneta, v VirtualBox zamenjajte nastavitve 1. in 2. omrežni vmesnik ter ponovno zaženite navidezni računalnik. -</li> -<li>Poženite run_test.py.</li> - -<li>Kot ime naloge vpišite preparation</li> - -<li>Preberite statični IP maliNetworkManager. Pustite SimpleArbiterGW da teče v ozadju, dokler niste nastavili maliNetworkManager</li> - -<li>Zaženite maliNetworkManager.</li> - -<li> -Prijavite se v grafično okolje z uporabniškim imenom student, geslom vaje</li> -<li><img alt="ikona network manager" src="../images/10.png" style="width: 800px; height: 600px;" /><br/> -Desno-kliknite na ikono za mrežne nastavitve.</br> - -<li> -<img alt="Menu NetworkManager" src="../images/11.png" style="width: 800px; height: 600px;" /><br/> -Izberite "Edit Connections".</li> - -<li> -<img alt="Menu NetworkManager" src="../images/12.png" style="width: 800px; height: 600px;" /><br/> -Kliknite "Edit"</li> - -<li> -<img alt="Menu NetworkManager" src="../images/13.png" style="width: 800px; height: 600px;" /><br/> -V zavihku "IPv4" spremenite "Method" na "Manual". Kliknite na "Add". Nastavite statični IP, ki ste ga prebrali na SimpleArbiterGW kot statični I.<br/> -V DNS servers dodajte naslov DNSja, ki van ha poda run_test.py. Kot gateway dodaj IP SimpleArbiterGW. -</li> -<li>Kliknite "Save".</li> - -<li>Preklopite na SimpleArbiterGW. Pritisnite "Enter" oz. "OK".</li> - -<li>Preberite IP maliBrezNetworkManager. Pritisnite "OK". Preberite naslov DNS strežnika.</li> - -<li> Preklopite na maliBrezNetworkManager. Preklopite na prvo konzolo s kombinacijo CTRL+ALT+F1. Prijavite se kot root z geslom kaboom.</li> - -<li> Odprite datoteko /etc/network/interfaces. Popravite nastavitve v skladu s podatki, ki ste jih dobili na SimpleArbiter. Vnos za omrežni vmesnik mora izgledati približno takole:<br/> -<pre> -allow-hotplug eth0 -iface eth0 inet static - address "Podan IP" - netmask 255.255.255.0 - dns-nameservers "Podan DNS" - getway "IP SimpleArbiterGW" -</pre> -</li> - -<li> Shranite nastavitve. Z ukazoma "ifdown eth0", in ifup eth0" posodobite NetworkManager ki prebere -kateri omrežni vmesniki so nastavljeni v /etc/network/interfaces. Za te vmesnike potem ne skrbi več.</li> - -</li>Na SimpleArbiterGW pritisnite OK. Če je šlo vse po sreči, ste opravili tokratno nalogo.</li> -</ol> -</p> diff --git a/kpov_judge/tasks/set_ip_static_dhcp/task.py b/kpov_judge/tasks/set_ip_static_dhcp/task.py deleted file mode 100644 index 0d11f43..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/task.py +++ /dev/null @@ -1,127 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si': '''\ -<p> -Ustvari tri navidezne računalnike. Za prvega uporabi sliko diska <em>simpleArbiterDhcpGW</em>, za drugega sliko diska -<em>maliNetworkManager</em>, za tretjega sliko diska <em>maliBrezNetworkManager</em>. Računalnike imenujmo enako kot slike diska. - -<p> -Na <em>maliBrezNetworkManager</em> poskrbi, da NetworkManager ne bo več skrbel za omrežni vmesnik, temveč bosta delovala ukaza <code>ifup</code> in <code>ifdown</code>. - -<p> -Na <em>maliNetworkManager</em> nastavi naslov IP <code>{{IP_NM}}</code> ter DNS <code>{{DNS_NM}}</code>. - -<p> -Na <em>maliBrezNetworkManager</em> nastavi naslov IP <code>{{IP_static}}</code> ter DNS <code>{{DNS_static}}</code>. -''', - 'en': '''\ -<p> -Create three virtual machines. Use <em>simpleArbiterDhcpGW</em> as the disk image for the first, <em>maliNetworkManager</em> as the disk image for the second, and <em>maliBrezNetworkManager</em> for the third. The virtual machine names can match the disks. - -<p> -Make sure that on <em> maliBrezNetworkManager</em> <code>ifup</code> and <code>ifdown</code> can be used to configure the network and that NetworkManager, while still installed, will not manage the network interface. The IP should be <code>{{IP_static}}</code> and the computer should use the server <code>{{DNS_static}}</code> for DNS. - -<p> -On <em>maliNetworkManager</em>, set the IP address to <code>{{IP_NM}}</code> and use <code>{{DNS_NM}}</code> for DNS. -''', -} - -computers = { - 'maliNetworkManager': { - 'disks': [ - { 'name': 'maliNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGW', - }, - ], - 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'IP_NM': {'descriptions': {'si': 'Naslov maliNetworkManager', 'en': 'IP address for maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager', 'en': 'DNS for maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager', 'en': 'IP address for maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager', 'en':'DNS for maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - import collections - - tests = ( - ('nmcli', 'nmcli -c no d'), - ('nslookup', 'nslookup www.arnes.si'), - ) - - results = collections.defaultdict(str) - for name, host in [('nm', IP_NM), ('static', IP_static)]: - host_results = kpov_util.ssh_test(host, 'student', 'vaje', tests) - for key, value in host_results.items(): - results[key+'-'+name] = value - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220'] - net = kpov_util.IPv4_subnet_gen(r, '10.94.96.0/19', 25) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = 0 - hints = [] - if results['ssh-nm'] is True: - score += 1 - else: - hints += ['mali ssh failed: ' + results['ssh-nm']] - if results['ssh-static'] is True: - score += 1 - else: - hints += ['malibrez ssh failed: ' + results['ssh-static']] - if params['DNS_NM'] in results['nslookup-nm']: - score += 2 - else: - hints += ['NM nslookup incorrect'] - if params['DNS_static'] in results['nslookup-static']: - score += 2 - else: - hints += ['static nslookup incorrect'] - if re.search(r'e(th0|np0s3|ns3) +ethernet +connected', results['nmcli-nm']): - score += 2 - else: - hints += ['nmcli incorrect'] - if re.search(r'e(th0|np0s3|ns3) +ethernet +unmanaged', results['nmcli-static']): - score += 2 - else: - hints += ['nmcli on malibrez incorrect'] - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcpGW'], global_params) |