NS2 Chapter 5.  A node is an OTcl class, but most of its components are TclObjects.  All node contain at least the following components ◦ An address.

Slides:



Advertisements
Similar presentations
1 Multicast in ns-2 報告者 : 陳沐恩. 2 Multicast 簡介 3 Multicast Routing set ns [new Simulator] $ns multicast Or set ns [new Simulator – multicast on] set mproto.
Advertisements

Delivery and Forwarding of
1 Chapter 22 Network layer Delivery, Forwarding and Routing.
1 ns-2 Tutorial, part 2 Dave Anderson, Xiaowei Yang (Modified from Polly Huang’s slides)
1 NS Fundamentals (contd..) Padma Haldar USC/ISI.
Network Simulation One tool to simulation network protocols for the Internet is the network simulator (NS) The simulation environment needs to be set-
How to Add a New Protocol in NS2 Xu Leiming CSCW Lab. at CS Dept., Tsinghua Univ. June 1, 2001.
Introduction to NS. Information Main website Documentation, mailing list archive, tutorial Location of Source codes –C++ files.
資 管 Lee Lesson 12 IPv6 Mobility. 資 管 Lee Lesson Objectives Components of IPv6 mobility IPv6 mobility messages and options IPv6 mobility data structures.
CSCI 465 D ata Communications and Networks Lecture 20 Martin van Bommel CSCI 465 Data Communications & Networks 1.
Chapter 9 Local Area Network Technology
NS2 Chapter 5. Node A node is an OTcl class, but most of its components are TclObjects. All node contain at least the following components An address.
1 Chapter 5 Nodes and Packet Forward Reporters:m 林青 m 曾慶昌.
Packet Headers Format and Trace 蕭博鴻 Here comes your footer Outline  Introduction  Packet Module  Packet Header  Packet Header Mapping to.
CNA 2008 Project 1 TA: 徐志偉 Office: EA Grading policy: Total (100%) Report (20%) Socket Programming: (80%) –Basic (60%) –Advanced (20%)
William Stallings Data and Computer Communications 7 th Edition (Selected slides used for lectures at Bina Nusantara University) Internetworking.
CSCI 4550/8556 Computer Networks Comer, Chapter 19: Binding Protocol Addresses (ARP)
Delivery, Forwarding, and Routing
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
Chapter 9 Classification And Forwarding. Outline.
COE 342: Data & Computer Communications (T042) Dr. Marwan Abu-Amara Chapter 2: Protocols and Architecture.
© N. Ganesan, All rights reserved. Chapter IP Routing.
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
Data Structures Using C++ 2E
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
LAN Overview (part 2) CSE 3213 Fall April 2017.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
CEN Network Fundamentals Chapter 19 Binding Protocol Addresses (ARP) To insert your company logo on this slide From the Insert Menu Select “Picture”
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
22.1 Chapter 22 Network Layer: Delivery, Forwarding, and Routing Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
IPv6 Mobility Milo Liu SW2 R&D ZyXEL Communications, Inc.
ATM SWITCHING. SWITCHING A Switch is a network element that transfer packet from Input port to output port. A Switch is a network element that transfer.
Delivery, Forwarding, and Routing of IP Packets
Internetworking Internet: A network among networks, or a network of networks Allows accommodation of multiple network technologies Universal Service Routers.
Data Structures (1st Exam). 1.[5] Suppose there are only two constructors for a class, one that passes in a single integer parameter called amount, for.
Chapter 15 The Addressing Structure in NS. The Default Address Format 32 lower bits for port-id, 1 higher bit for mcast and the rest 32 higher bits for.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
Understanding IPv6 Slide: 1 Lesson 12 IPv6 Mobility.
Chapter 13: Structures. In this chapter you will learn about: – Single structures – Arrays of structures – Structures as function arguments – Linked lists.
1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Dynamic Host Configuration Protocol (DHCP)
The University of Bolton School of Games Computing & Creative Technologies LCT2516 Network Architecture CCNA Exploration LAN Switching and Wireless Chapter.
CSIT 220 (Blum)1 ARP Based on Computer Networks and Internets (Comer)
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 16 Connecting LANs, Backbone Networks, and Virtual LANs.
RIP Routing Protocol. 2 Routing Recall: There are two parts to routing IP packets: 1. How to pass a packet from an input interface to the output interface.
Ch7: Link and Buffer Management. 2 Portrait of A Mobile Node Node ARP Propagation and antenna models MobileNode LL MAC PHY LL CHANNEL LL MAC PHY Classifier:
22.1 Network Layer Delivery, Forwarding, and Routing.
J. Halpern (Ericsson), C. Pignataro (Cisco)
Virtual Local Area Networks In Security By Mark Reed.
1 CMPT 471 Networking II OSPF © Janice Regan,
(Modified from Polly Huang’s and last year’s original)
Behrouz A. Forouzan TCP/IP Protocol Suite, 3rd Ed.
NS2_Trace and Monitoring support 報告者:羅士捷
Instructor & Todd Lammle
Self Healing and Dynamic Construction Framework:
ARP and RARP Objectives Chapter 7 Upon completion you will be able to:
Forwarding and Routing IP Packets
Chapter 6 – Routing.
BOOTP and DHCP Objectives
Single-Area OSPF (Open Shortest Path First Protocol)
Virtual LANs.
(How the routers’ tables are filled in)
Chapter 2: Static Routing
Chapter 6 - Arrays Outline 6.1 Introduction 6.2 Arrays
Setting Up Firewall using Netfilter and Iptables
Delivery, Forwarding, and Routing of IP Packets
Delivery and Forwarding of
Speaker: Liu Yu-Jiun Date: 2009/4/15
Delivery, Forwarding, and Routing of IP Packets
Ch 17 - Binding Protocol Addresses
Presentation transcript:

NS2 Chapter 5

 A node is an OTcl class, but most of its components are TclObjects.  All node contain at least the following components ◦ An address or an id (id_) monotonically increasing by 1 (from initial value 0) ◦ A list of neighbors (neighbor_) ◦ A list of agents (agent_) ◦ A node type identifier (nodetype_) ◦ A routing module

Figure 5.1 : Structure of a Unicast Node a label variable instead of a real object

Figure 5.2 : Internal Structure of a Multicast Node In order to enable multicast simulation, we need to set ns [new Simulator -multicast on]

 Control functions  Address and port number management, unicast routing functions  Agent management  Adding neighbors

 $node entry is the first element which will handle packets arriving at that node  $node reset will reset all agents at the node

 $node id returns the node number  $node agent [port] returns the handle of the agent at the specified port  alloc-port returns the next available port number  add-route and add-routes, are used by unicast routing to add routes to populate the classifier_ (TclObject is the entry of dmux_)  delete-routes{} takes the id, a list of TclObjects, and a reference to the simulator’s nullagent

 init-routing{} sets the instance variable multiPath_ to be equal to the class variable of the same name  intf-changed{} is invoked by the network dynamics code if a link incident on the node changes state

 Procedure attach{} will add the agent to its list of agents_, [assign a port number to the agent and set its source address, set the target of the agent to be its (i.e., the node’s) entry{}, and add a pointer to the port demultiplexer at the node (dmux_) to the agent at the corresponding slot in the dmux_ classifier.)]  detach{} will remove the agent from agents_

 Each node keeps a list of its adjacent neighbors in its instance variable, neighbor_.  Add-neighbor{} adds a neighbor  Neighbors{} returns this list

 Simulator::node-config{} accommodates flexible and modular construction of different node definitions within the same base Node class ◦ $ns_ node-config -adhocRouting dsdv ◦ $ns_ node-config -reset  The config command can be broken down into separate lines ◦ $ns_ node-config -addressingType hier ◦ $ns_ node-config -macTrace ON

Table 5.1: Available options for node configuration

5.4.1 Address Classifiers Multicast Classifiers Multipath Classifier hash Classifier Replicator

 When a node receives a packet, classifier examines the packet’s fields, usually its destination address, and on occasion, its source address  A classifier provides a way to match a packet against some logical criteria and retrieve a reference to another simulation object based on the match results

class Classifier : public NsObject { public: ~Classifier(); void recv(Packet*, Handler* h = 0); protected: Classifier(); void install(int slot, NsObject*); void clear(int slot); virtual int command(int argc, const char*const* argv); virtual int classify(Packet *const) = 0; void alloc(int); NsObject** slot_; /* table that maps slot number to a NsObject */ int nslot_; int maxslot_; };

 When a classifier recv()’s a packet, it hands it to the classify() method. This is defined differently in each type of classifier derived from the base class  The usual format is for the classify() method to determine and return a slot index into the table of slots

 An address classifier is used in supporting unicast packet forwarding  It applies a bitwise shift and mask operation to a packet’s destination address to produce a slot number  The slot number is returned from the classify() method

 The multicast classifier classifies packets according to both source and destination (group) addresses  It maintains a (chained hash) table mapping source/group pairs to slot numbers

 This object is devised to support equal cost multipath forwarding, where the node has multiple equal cost routes to the same destination, and would like to use all of them simultaneously  This object does not look at any field in the packet. With every succeeding packet, it simply returns the next filled slot in round robin fashion

 This object is used to classify a packet as a member of a particular flow  Hash classifiers use a hash table internally to assign packets to flows

 Replicator does not use the classify function  Simply uses the classifier as a table of n slots; it overloads the recv() method to produce n copies of a packet, that are delivered to all n objects referenced in the table  Replicator replicates a packet, one for each entry in its table, and delivers the copies to each of the nodes listed in the table. The last entry in the table gets the “original” packet

n0n1 Addr Classifier Port Classifier classifier_ dmux_ entry_ Node entry Unicast Node Multicast Classifier classifier_ dmux_ entry_ Node entry Multicast Node multiclassifier_

5.5.1 Routing Module Node Interface

 Routing agent ◦ Exchange routing packet with neighbors  Routing logic ◦ Uses the information gathered by routing agents (or the global topology database in the case of static routing) to perform the actual route computation  Classifiers ◦ Use the computed routing table to perform packet forwarding

Figure 5.3: Interaction among node, routing, mobile

 Declare the C++ part of your routing module  Decide which one you’ll inherit, which one you’ll override, and put the interfaces of your own module.em in OTcl

Part 1 問題 Part 2 Hint

建立上圖的拓樸,節點 0 與節點 3 間做 TCP(FTP) 和 UDP 的傳輸, 由 0 到 3 的傳送,以 nam 顯示出。 2. 顯示出節點 2 的 link id 3. 在 node2 裡加入一個 replicator classifier 並顯示出。

Problem 1 -- 參考 /tcl/ex/simple.tcl Problem 2 -- 使用內建指令 info or Simulator instproc node-to-link {ne1 ne2} { ???? return ????? } Problem 3 -- 利用指令 installNext or install 找到所要加的 classifier 後,使用指令去做新增動作