9-amaliyot ishi Mavzu: ip mashrutizatorni loyihalash va dasturlash. Ishning maqsadi



Download 83,33 Kb.
Sana08.08.2021
Hajmi83,33 Kb.
#142339
Bog'liq
9-amaliyot Sharifboyev Orifjon 631-17



9-amaliyot ishi
Mavzu: IP mashrutizatorni loyihalash va dasturlash.
Ishning maqsadi: Phyton dasturlash tilidan, IP mashrutizatorni loyihalash va dasturlash.

Topshiriq:Talaba laboratoriya ishi uchun shaxsiy topshiriq oladi. Bu topshiriq bo‘yicha talaba IP mashrutizatorni loyihalash dasturini yaratadi.

Nazariy qism:

Router bir nechta mijozning unga ulanishiga va serverdan paketni ulangan mijozlarning biriga yo'naltirishga xizmat qilishi kerak.

Oldinga borishdan oldin, men pauza qilaman va sarlavhalar haqida bir oz muhokama qilaman. Routerlar trafikni qaerga yo'naltirishni sarlavhalar asosida belgilaydilar, bu yo'riqnoma tomonidan paketlarni manzilga muvaffaqiyatli etkazib berish uchun ishlatiladigan asl xabarga qo'shimcha ma'lumot.

Standart IP sarlavhasini ko'rib chiqing:



Bu IPv4 yoki IPv6 protokoli ekanligini anglatuvchi versiya, ushbu qabul qilingan paket aslida kattaroq xabarning bir qismi ekanligini va manzil asl xabarni bir qator paketlardan, sarlavhadan qayta tiklashi kerakligini bildiruvchi ko'p sonli ma'lumotlarni o'z ichiga oladi. ba'zi bir xatolarni tuzatish kodlarini bildiruvchi summa va boshqalar.



Bizning dasturimiz uchun biz faqat Manba manzilini (Manba IP-manzili) va Belgilangan manzilni (Destination IP-manzilni) o'z ichiga olgan juda oddiy IP sarlavhasini ko'rib chiqamiz. Xuddi shu tarzda, Ethernet sarlavhasi deb nomlangan yana bir sarlavha mavjud (MAC manzillari haqida ma'lumot to'plangan).

Bundan tashqari, simulyatsiya uchun men turli xil mijozlarga va serverlarga o'zboshimchalik bilan MAC-manzillar va IP-manzillar berdim, chunki men butun tarmoqni bitta tugunda ishlayapman. Agar iloji bo'lsa, siz mijoz yoki server sifatida ishlaydigan turli xil tugunlarga ega bo'lishingiz va shunga mos ravishda tarmog'ingizni qurishingiz mumkin.

Eng osoni, avval mijozlarni aniqlash - yo'riqnoma chaqirgan rozetkadan bir nechta paketni olish, yuqorida ko'rib chiqilgan paketlar tuzilmasi asosida ushbu paketni ajratish va tarkibni ko'rsatish.

Client 1


Below is the code for client 1.

import socket
import time
client1_ip = "92.10.10.15"
client1_mac = "32:04:0A:EF:19:CF"router = ("localhost", 8200)client1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)time.sleep(1)
client1.connect(router)while True:
received_message = client1.recv(1024) received_message = received_message.decode("utf-8") source_mac = received_message[0:17] destination_mac = received_message[17:34] source_ip = received_message[34:45] destination_ip = received_message[45:56] message = received_message[56:] print("\nPacket integrity:\ndestination MAC address matches client 1 MAC address: {mac}".format(mac=(client1_mac == destination_mac))) print("\ndestination IP address matches client 1 IP address: {mac}".format(mac=(client1_ip == destination_ip))) print("\nThe packed received:\n Source MAC address: {source_mac}, Destination MAC address: {destination_mac}".format(source_mac=source_mac, destination_mac=destination_mac))

print("\nSource IP address: {source_ip}, Destination IP address: {destination_ip}".format(source_ip=source_ip, destination_ip=destination_ip))

print("\nMessage: " + message)

Ushbu mijozni aniqlash uchun men client1_ip va client1_mac-ni o'rnatdim, yo'riqnoma rozetkasining spetsifikatsiyasini aniqladim (yo'riqnoma uchun kodda batafsil tavsiflanadi) va ushbu mijozni yo'riqchiga uladim. Keyin ushbu mijoz xabarni oldi, uni dekodladi va olingan paketni qismlarga ajratdi.

Routerning ishlashiga oid oddiy dasturimizda men IP va MAC manzillari uchun satrlardan foydalanganman. Odatda, siz 32 bit va 48 bitni ko'rasiz, lekin bu erda men raqamlarni satrlarga qo'lda kiritganim sababli, IP va MAC manzillari indekslangan belgilar bo'yicha oqilona (yoki ularning kattaligi ular qatoridagi belgilar soniga teng). Shunday qilib, MAC manzilida 17 ta belgi (shu jumladan, ikki nuqta) va IP-manzilda 11 ta nuqta (shu jumladan nuqta) mavjud.

Paketni ajratib bo'lgach, biz paketning butunligini tekshiramiz, agar paket haqiqatan ham ushbu mijoz uchun mo'ljallangan bo'lsa, client1_mac == destination_mac va client1_ip == destination_ip. Agar ular to'g'ri bo'lsa, yo'riqnoma yaxshi ishladi.

Shunga o'xshash yo'nalishlarda yana ikkita mijoz yarataman:

Client 2


import socket
import time
client2_ip = "92.10.10.20"
client2_mac = "10:AF:CB:EF:19:CF"router = ("localhost", 8200)client2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)time.sleep(1)
client2.connect(router)while True:
received_message = client2.recv(1024) received_message = received_message.decode("utf-8") source_mac = received_message[0:17] destination_mac = received_message[17:34] source_ip = received_message[34:45] destination_ip = received_message[45:56] message = received_message[56:] print("\nPacket integrity:\ndestination MAC address matches client 2 MAC address: {mac}".format(mac=(client2_mac == destination_mac))) print("\ndestination IP address matches client 2 IP address: {mac}".format(mac=(client2_ip == destination_ip))) print("\nThe packed received:\n Source MAC address: {source_mac}, Destination MAC address: {destination_mac}".format(source_mac=source_mac, destination_mac=destination_mac)) print("\nSource IP address: {source_ip}, Destination IP address: {destination_ip}".format(source_ip=source_ip, destination_ip=destination_ip))
print("\nMessage: " + message)

Client 3


import socket
import timeclient3_ip = "92.10.10.25"
client3_mac = "AF:04:67:EF:19:DA"router = ("localhost", 8200)
client3 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)time.sleep(1)
client3.connect(router)while True:
received_message = client3.recv(1024) received_message = received_message.decode("utf-8") source_mac = received_message[0:17] destination_mac = received_message[17:34] source_ip = received_message[34:45] destination_ip = received_message[45:56] message = received_message[56:] print("\nPacket integrity:\ndestination MAC address matches client 3 MAC address: {mac}".format(mac=(client3_mac == destination_mac)))

print("\ndestination IP address matches client 3 IP address: {mac}".format(mac=(client3_ip == destination_ip)))

print("\nThe packed received:\n Source MAC address: {source_mac}, Destination MAC address: {destination_mac}".format(source_mac=source_mac, destination_mac=destination_mac)) print("\nSource IP address: {source_ip}, Destination IP address: {destination_ip}".format(source_ip=source_ip, destination_ip=destination_ip)) print("\nMessage: " + message)

XULOSA

IP marshrutizatorni loyihalash va dasturlash.


Ushbu amaliy mashg’ulotni o’rganish davomida Pytone dasturlash tilini IP marshrutizatorini loyihalash va dasturlashni o’rgandik. Amaliy ish davomida har birimiz alohida shaxsiy topshiriq oldik va IP marshrutizatorni loyihalash dasturini yaratdik. Router bir nechta mijozning unga ulanishda va serverdan paketning unga ulangan mijozlarning biriga yo’naltirish uchun xizmat qiladi.
Download 83,33 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish