SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Wired	and	wireless	
example
T	S	PRADEEP	KUMAR	
VIT	University	–	Chennai	Campus	
http://www.pradeepkumar.org	
tspembedded@gmail.com	
www.facebook.com/tspradeep	
1
Wired	Example
2
Wired	Example….
• This	network	consists	of	4	nodes	(n0,	n1,	n2,	n3)	as	shown	in	
above	figure.		
• The	duplex	links	between	n0	and	n2,	and	n1	and	n2	have	2	
Mbps	of	bandwidth	and	10ms	of	delay.		
• The	duplex	link	between	n2	and	n3	has	1.7	Mbps	of	bandwidth	
and	20	ms	of	delay.		
• Each	node	uses	a	DropTail	queue,	of	which	the	maximum	size	is	
10.	
3
Wired	Example….
#Create	a	simulator	object	
set	ns	[new	Simulator]	
#Open	the	NAM	trace	file	
set	nf	[open	out.nam	w]	
$ns	namtrace-all	$nf	
#color	for	data	flow	
$ns	color	1	red	
$ns	color	2	blue		
#Create	four	nodes	
set	n0	[$ns	node]	
set	n1	[$ns	node]	
set	n2	[$ns	node]	
set	n3	[$ns	node]	
4
Wired	Example….
#Define	a	'finish'	procedure	
proc	finish	{}	{	
								global	ns	nf	
								$ns	flush-trace	
								#Close	the	NAM	trace	file	
								close	$nf	
								#Execute	NAM	on	the	trace	file	
								exec	nam	out.nam	&	
								exit	0	
}
5
Wired	Example….
#Create	links	between	the	nodes	
$ns	duplex-link	$n0	$n2	2Mb	10ms	DropTail	
$ns	duplex-link	$n1	$n2	2Mb	10ms	DropTail	
$ns	duplex-link	$n2	$n3	1.7Mb	20ms	DropTail	
#Set	Queue	Size	of	link	(n2-n3)	to	10	
$ns	queue-limit	$n2	$n3	10	
#Give	node	position	(for	NAM)	
$ns	duplex-link-op	$n0	$n2	orient	right-down	
$ns	duplex-link-op	$n1	$n2	orient	right-up	
$ns	duplex-link-op	$n2	$n3	orient	right	
#Monitor	the	queue	for	link	(n2-n3).	(for	NAM)	
$ns	duplex-link-op	$n2	$n3	queuePos	0.5	
6
Wired	Example….
#Setup	a	TCP	connection	
set	tcp	[new	Agent/TCP]	
$tcp	set	class_	2	
$ns	attach-agent	$n0	$tcp	
set	sink	[new	Agent/TCPSink]	
$ns	attach-agent	$n3	$sink	
$ns	connect	$tcp	$sink	
$tcp	set	fid_	1
7
Wired	Example….
#Setup	a	FTP	over	TCP	connection	
set	ftp	[new	Application/FTP]	
$ftp	attach-agent	$tcp	
$ftp	set	type_	FTP	
#Setup	a	UDP	connection	
set	udp	[new	Agent/UDP]	
$ns	attach-agent	$n1	$udp	
set	null	[new	Agent/Null]	
$ns	attach-agent	$n3	$null	
$ns	connect	$udp	$null	
$udp	set	fid_	2 8
Wired	Example….
#Setup	a	CBR	over	UDP	connection	
set	cbr	[new	Application/Traffic/CBR]	
$cbr	attach-agent	$udp	
$cbr	set	type_	CBR	
$cbr	set	packet_size_	1000	
$cbr	set	rate_	1mb	
$cbr	set	random_	false	
9
Wired	Example….
#Schedule	events	for	the	CBR	and	FTP	agents	
$ns	at	0.1	"$cbr	start"	
$ns	at	1.0	"$ftp	start"	
$ns	at	4.0	"$ftp	stop"	
$ns	at	4.5	"$cbr	stop"	
#Detach	tcp	and	sink	agents	(not	really	necessary)	
$ns	at	4.5	"$ns	detach-agent	$n0	$tcp	;	$ns	detach-agent	$n3	$sink"	
#Call	the	finish	procedure	after	5	seconds	of	simulation	time	
$ns	at	5.0	"finish"	
#Print	CBR	packet	size	and	interval	
puts	"CBR	packet	size	=	[$cbr	set	packet_size_]"	
puts	"CBR	interval	=	[$cbr	set	interval_]"	
#Run	the	simulation	
$ns	run	
10
Output
11

Contenu connexe

Tendances

Chapter 2 - Network Models
Chapter 2 - Network ModelsChapter 2 - Network Models
Chapter 2 - Network Models
Wayne Jones Jnr
 

Tendances (20)

Data link control
Data link controlData link control
Data link control
 
Routing table
Routing tableRouting table
Routing table
 
X.25
X.25X.25
X.25
 
Mobile transport layer
Mobile transport layerMobile transport layer
Mobile transport layer
 
WLAN
WLANWLAN
WLAN
 
Ns2
Ns2Ns2
Ns2
 
Building Topology in NS3
Building Topology in NS3Building Topology in NS3
Building Topology in NS3
 
Cs8591 Computer Networks
Cs8591 Computer NetworksCs8591 Computer Networks
Cs8591 Computer Networks
 
Network software
Network softwareNetwork software
Network software
 
Classless inter domain routing
Classless inter domain routingClassless inter domain routing
Classless inter domain routing
 
AODV routing protocol
AODV routing protocolAODV routing protocol
AODV routing protocol
 
Interconnection Network
Interconnection NetworkInterconnection Network
Interconnection Network
 
Internet Protocols
Internet ProtocolsInternet Protocols
Internet Protocols
 
Mobile Transport layer
Mobile Transport layerMobile Transport layer
Mobile Transport layer
 
Chapter 2 - Network Models
Chapter 2 - Network ModelsChapter 2 - Network Models
Chapter 2 - Network Models
 
IPv4 Addressing
 IPv4 Addressing   IPv4 Addressing
IPv4 Addressing
 
Guided and unguided media
Guided and unguided mediaGuided and unguided media
Guided and unguided media
 
Computer networks - Channelization
Computer networks - ChannelizationComputer networks - Channelization
Computer networks - Channelization
 
Network Simulation.pptx
Network Simulation.pptxNetwork Simulation.pptx
Network Simulation.pptx
 
Csma
CsmaCsma
Csma
 

Similaire à Wired and Wireless Examples in ns2

NS2-tutorial.ppt
NS2-tutorial.pptNS2-tutorial.ppt
NS2-tutorial.ppt
Wajath
 
Study of aloha protocol using ns2 network java proram
Study of aloha protocol using ns2 network java proramStudy of aloha protocol using ns2 network java proram
Study of aloha protocol using ns2 network java proram
Meenakshi Devi
 
study-of-network-simulator.pdf
study-of-network-simulator.pdfstudy-of-network-simulator.pdf
study-of-network-simulator.pdf
Jayaprasanna4
 

Similaire à Wired and Wireless Examples in ns2 (20)

Network Simulator Tutorial
Network Simulator TutorialNetwork Simulator Tutorial
Network Simulator Tutorial
 
Working with NS2
Working with NS2Working with NS2
Working with NS2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Cs757 ns2-tutorial-exercise
Cs757 ns2-tutorial-exerciseCs757 ns2-tutorial-exercise
Cs757 ns2-tutorial-exercise
 
Ns 2 Network Simulator An Introduction
Ns 2 Network Simulator An IntroductionNs 2 Network Simulator An Introduction
Ns 2 Network Simulator An Introduction
 
Ns2
Ns2Ns2
Ns2
 
NS2 (1).docx
NS2 (1).docxNS2 (1).docx
NS2 (1).docx
 
NS2-tutorial.ppt
NS2-tutorial.pptNS2-tutorial.ppt
NS2-tutorial.ppt
 
18CSL51 - Network Lab Manual.pdf
18CSL51 - Network Lab Manual.pdf18CSL51 - Network Lab Manual.pdf
18CSL51 - Network Lab Manual.pdf
 
NS2-tutorial.pdf
NS2-tutorial.pdfNS2-tutorial.pdf
NS2-tutorial.pdf
 
cscn1819.pdf
cscn1819.pdfcscn1819.pdf
cscn1819.pdf
 
Ns2pre
Ns2preNs2pre
Ns2pre
 
link-state-routing-3.pdf
link-state-routing-3.pdflink-state-routing-3.pdf
link-state-routing-3.pdf
 
Virtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc NetworksVirtual lab - Routing in Mobile Adhoc Networks
Virtual lab - Routing in Mobile Adhoc Networks
 
Ns2
Ns2Ns2
Ns2
 
Study of aloha protocol using ns2 network java proram
Study of aloha protocol using ns2 network java proramStudy of aloha protocol using ns2 network java proram
Study of aloha protocol using ns2 network java proram
 
Tut hemant ns2
Tut hemant ns2Tut hemant ns2
Tut hemant ns2
 
Session 1 introduction to ns2
Session 1   introduction to ns2Session 1   introduction to ns2
Session 1 introduction to ns2
 
study-of-network-simulator.pdf
study-of-network-simulator.pdfstudy-of-network-simulator.pdf
study-of-network-simulator.pdf
 
A genetic algorithm for constructing broadcast trees with cost and delay cons...
A genetic algorithm for constructing broadcast trees with cost and delay cons...A genetic algorithm for constructing broadcast trees with cost and delay cons...
A genetic algorithm for constructing broadcast trees with cost and delay cons...
 

Plus de Pradeep Kumar TS

Plus de Pradeep Kumar TS (20)

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and Footprint
 
Open book Examination
Open book ExaminationOpen book Examination
Open book Examination
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
 
Protothreads
ProtothreadsProtothreads
Protothreads
 
6LoWPAN
6LoWPAN 6LoWPAN
6LoWPAN
 
Software Defined Networks
Software Defined NetworksSoftware Defined Networks
Software Defined Networks
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication Protocols
 
IoT Applications
IoT ApplicationsIoT Applications
IoT Applications
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
 
Mannasim for NS2
Mannasim for NS2Mannasim for NS2
Mannasim for NS2
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
 
Installation of ns2
Installation of ns2Installation of ns2
Installation of ns2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3
 
Tracing and awk in ns2
Tracing and awk in ns2Tracing and awk in ns2
Tracing and awk in ns2
 

Dernier

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Dernier (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Wired and Wireless Examples in ns2