IPv6 Protocol Training Program

This material was created by the collective efforts of a teacher and a student. The first and fourth stages were developed by the student, the second and third by the teacher, and the fifth stage was the result of collaboration.

Stage one – event or incident

Once in my second year, I began full-time training in my specialty, communications technology. And one of the most important areas was IP addressing. But to my great regret, 95% of the time we were trained to work with the IPv4 protocol, creating networks, dividing them into subnets and studying the specifics of this protocol. This worried me, because such a focus on outdated technology has a detrimental effect on future specialists.

In my 3rd year, I went to study cybersecurity at Skills Battles, where I learned even more about IP addressing and finally worked fully with IPv6. After that, I got the idea to do something using the IPv6 protocol so that ordinary students would learn about IPv6 and become more savvy in it.

Stage two – why is this necessary?

I, as a teacher of the Computer Networks discipline, understood the need to study the IPv6 protocol. The IPv6 protocol is more consistent with modern realities. The IPv6 address format is 128 bits, which are represented by eight sixteen-bit hexadecimal blocks separated by colons.

Compared with IPv4, IPv6 has the following advantages:

  • routing becomes more efficient because packets are transmitted without the need for fragmentation;

  • built-in QoS technology, to ensure efficient data transfer in conditions of limited network capabilities;

  • The NAT network address conversion mechanism has been eliminated;

  • network administration is simplified thanks to address auto-configuration;

  • Processing costs are reduced due to improved header structure.

Everyone understands that the future lies with protocol version 6. But in the curriculum, more hours are allocated for studying version 4.

Students find it boring to read just theoretical material, and the speed of assimilation of the material is different for everyone. Therefore, it was decided to create a program to study the IPv6 protocol as part of the graduation project.

Stage three – problem statement

I, as the director of the diploma project, developed and was given the task to develop an application that contains lecture material, tests and practical assignments on the topic “IPv6 Protocol”.

The application should have user registration and authorization functionality, the ability to save student results and progress, as well as a page for the administrator. The administrator should be able to manage user accounts, view their results, and delete users if necessary.

Stage four – implementation

Since I had enough experience in working with the framework for developing web applications – Django, I chose it to implement my task.

I chose PostgreSQL as the database. Django makes it easy and fast to create applications, and I particularly like its routing system and implementation of the MVP (Model-View-Presenter) pattern. Initially, I had no preference in choosing a database, but after studying the market I came to PostgreSQL. She was selected to gain experience with the currently relevant database.

The final database looks like this

Database

Database

5 topics have been developed, each of which covers key aspects of the IPv6 protocol.

IPv6 Topics

IPv6 Topics

To make life more difficult for students and increase security, I created secure routing. Access to lectures, tests and assignments is possible only through POST requests, and the Django addressing system and csrf tokens allow you to do this.

For example, the system for generating and outputting tasks looks like this.

def exercise(request):    
if request.POST.get('number') is None:       
return redirect('/')    
if request.session.get('auth') and request.method == 'POST':        
form = dict(request.POST)        
num = int(form.get('number')[0])       
if num == 3:           
addresses = RecordingAddresses.objects.order_by('?')[:12]     
id_addresses = []            
f_addresses = []            
a_addresses = []         
i = 0           
for address in addresses:              
id_addresses.append(address.id)         
if i < len(addresses) / 2:                
f_addresses.append(address.full_record)      
else:                 
a_addresses.append(address.abbreviation)           
i += 1         
request.session["id_addresses"] = id_addresses     
return render(request, 'tasks/task3.html',             
{'auth': request.session.get('auth'), "f_addresses": f_addresses, 
"a_addresses": a_addresses})     
if num == 4:          
task_4_data = []           
task_texts = []            
for i in range(3):               
type_task = random.choice([True, False])  # True - 4 бита False - 5 битов    
if type_task:              
type_task_text = "подсети "               
else:                    
type_task_text = "интерфейса "             
addresses_names = 
['a136', 'b062', '7f8c', '974c', 'ff0d', 'cb8b', '8e51', 'afbc',   
'11ae', '153f', 'a39f', 'fc97', '0445', '1d4c', '6209', 'ab7a',   
'5dc3', '9692', 'd4f1', 'af91', '3c97', '4a0f', '5b60', 'b72b',  
'ed0c', '149c', '15dc', '1e69', '687d', 'ba80', '99b9', 'cc8a',   
'6358', 'f32e', 'aa29', '4c49', 'b88d', '970e', '3a78', 'f88c',   
'b89c', 'da45', '73b6', '180a', '9df3', '85e6', '7f34', '1608',  
'd8dd', '719c', '5138', '3f2c', 'a6e8', '22a9', '4eed', '2993', 
'f3f8', '5710', '4acc', '2a75', '50a6', '7d28', '8a33', 'fe9a',  
'e424', '7d97', '252b', '89f7', '5bd6', '1e4a', '734d', '6bd3',   
'1870', 'a633', 'b6b4', '15bf', '7494', '0c7d', '8d98', '2def',   
'0ee5', '378b', '8f7d', '6835', 'b0c1', 'f451', 'cc42', '2f39',  
'8d51', 'b269', '9729', 'eedc', 'ee80', 'bc4b', 'ce67', 'af69',  
'0054', '2329', '7361', '4cbb', 'c368', '7f27', 'a042', 'c5d0',  
'3057', 'ee51', 'f62c', '6b13', '1fd0', 'ca8a', '1d23', '3e33',  
'1030', '7d04', '61de', '3ae1', '960b', '229f', 'caab', '0000',   
'ca32', 'f177', '09f1', '5242', '2883', 'ca35', '2df6', 'bd86']     
random.shuffle(addresses_names)             
address_name = addresses_names[0] + ':' + addresses_names[1] + ':' + addresses_names[1]                
number_of_subnets = random.randint(17, 4080)     
task_text = "Произведите разбиение сети " + address_name + ":: на подсети с использованием идентификатора " + type_task_text + "и укажите " + str(            
number_of_subnets) + " подсеть."         
task_texts.append(task_text)              
task_4_data.append([type_task, address_name, number_of_subnets]) 
request.session["task_4_data"] = task_4_data        
return render(request, 'tasks/task4.html',            
{'auth': request.session.get('auth'), "tasks": task_texts})  
return render(request, 'tasks/task' + str(num) + '.html', {'auth': request.session.get('auth')})    
else:        
return redirect('/login')

Now let's move on to the tasks. They are present only in topics 2, 3 and 4.

In task 2 of the topic you need to fill out the title fields and indicate the dimensions.

This is how the form is processed

task = Task.objects.filter(task_number=str(num)).first()    
answers = json.loads(task.task_answer)  
for i in range(8):       
if str(form.get('formChoice' + str(i + 1))[0]) == str(answers['naming'][i]):  
result_task += 1     
if str(form.get('size' + str(i + 1))[0]) == str(answers['len'][i]): 
result_task += 1    
grade = calculation_result(16, result_task)if num == 3:    for i in range(12): 
address = RecordingAddresses.objects.filter(id=request.session["id_addresses"][i]).first()   
if i < 6 and str.strip(form['address'][i].lower()) == str.strip(address.abbreviation):       
result_task += 1   
if i >= 6 and str.strip(form['address'][i].lower()) == str.strip(address.full_record):         
result_task += 1  
grade = calculation_result(12, result_task)
task_answer = TaskAnswer(task_result=grade, task_id_id=Task.objects.filter(task_number=num).first().id,     
user_id_id=request.session['id'])task_answer.save()if grade > "2":  
user = User.objects.get(id=request.session['id'])   
user.theme_status = user.theme_status[:num - 1] + '1' + user.theme_status[num:]   
user.save(update_fields=["theme_status"])return render(request, 'result_task_page.html',         
{'result': grade, 'number': num})

In the task, 3 topics must be shortened and restored to 6 addresses.

This code is used to generate addresses:

addresses = RecordingAddresses.objects.order_by('?')[:12]
id_addresses = []
f_addresses = []
a_addresses = []
i = 0for address in addresses:   
id_addresses.append(address.id)    
if i < len(addresses) / 2:     
f_addresses.append(address.full_record) 
else:       
a_addresses.append(address.abbreviation)  
i += 1request.session["id_addresses"] = id_addressesreturn render(request, 'tasks/task3.html',     
{'auth': request.session.get('auth'), "f_addresses": f_addresses, "a_addresses": a_addresses})

And this code is used to check the correctness

for i in range(12):   
address = RecordingAddresses.objects.filter(id=request.session["id_addresses"][i]).first()   
if i < 6 and str.strip(form['address'][i].lower()) == str.strip(address.abbreviation):    
result_task += 1 
if i >= 6 and str.strip(form['address'][i].lower()) == str.strip(address.full_record):   
result_task += 1grade = calculation_result(12, result_task)

Task 4 of the topic requires dividing the network into subnets and indicating the latter

This code generates networks and the required number of subnets

task_4_data = []task_texts = []for i in range(3):    
type_task = random.choice([True, False])  # True - 4 бита False - 5 битов 
if type_task:        
type_task_text = "подсети "  
else:     
type_task_text = "интерфейса "    
addresses_names = ['a136', 'b062'] # Их больше    
random.shuffle(addresses_names) 
address_name = addresses_names[0] + ':' + addresses_names[1] + ':' + addresses_names[1]  
number_of_subnets = random.randint(17, 4080)  
task_text = "Произведите разбиение сети " + address_name + ":: на подсети с использованием идентификатора " + type_task_text + "и укажите " + str(        number_of_subnets) + " подсеть."   
task_texts.append(task_text) 
task_4_data.append([type_task, address_name, number_of_subnets])request.session["task_4_data"] = task_4_datareturn render(request, 'tasks/task4.html',     
{'auth': request.session.get('auth'), "tasks": task_texts})

And this code checks the work done

i = 0for task_data in request.session["task_4_data"]:  
number_of_subnets_hex = hex(int(task_data[2]))[2:]  # True - 4 бита False - 5 битов
subnet = ":0000:0"   
len_num_sub = len(number_of_subnets_hex)   
if task_data[0]:      
subnet = subnet[:len(subnet) - len_num_sub - 2] + str(number_of_subnets_hex) + ":0"  
else:      
subnet = (subnet[:len(subnet) - len_num_sub - 1] +   
str(number_of_subnets_hex[:len_num_sub - 1]) +         
":" + number_of_subnets_hex[len_num_sub - 1:len_num_sub])   
ans_address = task_data[1] + subnet + "000:0000:0000:0000"    
try:        
if ipaddress.IPv6Address(ans_address) == ipaddress.IPv6Address(form.get('address')[i]):   
result_task += 1  
except:    
print("Nop") 
i += 1grade = 2 + result_task

Stage five – testing

When the Web application was ready, we tested it with the help of student volunteers. Students did not identify any critical problems. According to their reviews, the program is interesting, the material is presented in an accessible form, and there is also an opportunity to test their knowledge and skills using tests and practical assignments.

The web application is available in the open Github repository https://github.com/GoshArt/DiplomIPv6/

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *