+91 94 448 29 228 --- E-Mail ID:networksimulators2@gmail.com

Ns2 Software defined Network

What is software defined networking?

Software defined networking (SDN) is an approach to use open protocols, such as OpenFlow, to apply globally aware software control at the edges of the network to access network switches and routers that typically would use closed and proprietary firmware.

Challenges Faced in Software Defined Networking.

  • Better utilize network resources
  • To support the dynamic movement, replication and allocation of virtual resources
  • Ease to achieve QoS and security of system configuration
  • To reduce complexity of the system
  • Have network functionality evolve more rapidly based on software development lifecycle.
  • To implement more effective security functionality
  • Reduce OPEX
  • More easily deploy and scale network functionality.
Software-Defined-Network-Architecture

Software-Defined-Network-Architecture

Sample code of Ns2 Software defined Network

This is code for how to provide security among the software define networking. The security is one of the most crucial topic in SDN.

void Security_packetAgent::recv(Packet* pkt, Handler*) 
{ 
   hdr_ip* hdrip = hdr_ip::access(pkt); 
   hdr_security_packet* hdr = hdr_security_packet::access(pkt); 
   if ((u_int32_t)hdrip->daddr() == IP_BROADCAST) 
  { 
    if (hdr->ret == 0) 
    { 
      Packet::free(pkt); 
      Packet* pktret = allocpkt(); 
      hdr_security_packet* hdrret = hdr_security_packet::access(pktret); 
      hdr_cmn* ch = HDR_CMN(pktret); 
      hdr_ip* ipret = hdr_ip::access(pktret);      
      hdrret->ret = 1; 
      ipret->daddr() = IP_BROADCAST; 
      ipret->dport() = ipret->sport(); 
      send(pktret, 0);    
    } 
    else 
    { 
      Packet::free(pkt); 
    } 
    return; 
  } 
  if (hdr->ret == 0) 
  { 
    double stime = hdr->send_time; 
    char original_data[128]; 
    char encrypted_data[128]; 
    strcpy(encrypted_data,hdr->data); 
    strcpy(original_data,hdr->data); 
    int rcv_seq = hdr->seq; 
    char out[105]; 
    unsigned int newhash; 
    char authenticate_result[50]; 
     decryption(original_data); 
     newhash=hashing(original_data,strlen(original_data)); 
     if(newhash==hdr->hashvalue) 
     { 
	strcpy(authenticate_result,"Message_Accepted"); 
     } 
     else 
     { 
	strcpy(authenticate_result,"MESSAGE_ERRROR-Integrity violation"); 
     } 
    sprintf(out, "%s recv %d %3.1f %s %s %d", name(), hdrip->src_.addr_ >> Address::instance().NodeShift_[1], 
			(Scheduler::instance().clock()-hdr->send_time) * 1000, encrypted_data, original_data,hdr->hashvalue); 
    Tcl& tcl = Tcl::instance(); 
    tcl.eval(out); 
    Packet::free(pkt); 
    Packet* pktret = allocpkt(); 
    hdr_security_packet* hdrret = hdr_security_packet::access(pktret); 
    hdrret->ret = 1; 
    hdrret->send_time = stime; 
    hdrret->rcv_time = Scheduler::instance().clock(); 
    hdrret->seq = rcv_seq; 
    strcpy(hdrret->data, authenticate_result); 
    send(pktret, 0); 
  } 
  else 
  { 
    char out[105]; 
    sprintf(out, "%s recv %d %3.1f %s _ %d", name(), hdrip->src_.addr_ >> Address::instance().NodeShift_[1], 
			(Scheduler::instance().clock()-hdr->send_time) * 1000, hdr->data, hdr->hashvalue); 
    Tcl& tcl = Tcl::instance(); 
    tcl.eval(out); 
    Packet::free(pkt); 
  } 
} 

Sample Output Video of Ns2 Software Defined Network


NS2 Member Accounts | |
© 2005 - 2018 Vanet Projects

© 2005 - 2018 Matlab Projects