51
NS-3 를 를를를 Proxy Mobile IPv6 를를를를를 를를 를 를를 2011 년년 년년년년년년 년년년년 를를를를를를를를를 를를를를를를 - 를를를 를를 [email protected] 를를를를를 를를를를를를를 를를를를를 - 를를를 를를를를 [email protected]

NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Embed Size (px)

Citation preview

Page 1: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

NS-3 를 이용한 Proxy Mobile IPv6

시뮬레이션 구현 및 예제

2011 년도 한국통신학회 단기강좌

한국기술교육대학교 컴퓨터공학부 - 한연희 교수[email protected]

고려대학교 융합소프트웨어 전문대학원 - 최현영 연구교수

[email protected]

Page 2: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPV6 INTRODUCTION

Page 3: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Goal This protocol is for providing mobility support to any IPv6 host

within a restricted and topologically localized portion of the network and without requiring the host to participate in any mobility related signaling.

Goal of PMIPv6

PMIPv6 Scenario(being extended)

registration

PMIPv6 in NS-33

Page 4: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 Overview [IETF RFC 5213, August 2008]

LMM (Localized Mobility Management)

Domain

MAG

LMA

Proxy Binding Update/Ack. (PBU/PBA)

Control messages exchanged by MAG to LMA to establish a binding between

MN-HoA and Proxy-CoA

Home Network

Proxy Care of Address (Proxy-CoA)The address of MAG

That will be the tunnel end-point

IP Tunnel IP-in-IP tunnel between LMA and MAG

MAG

LMA: Localized Mobility AgentMAG: Mobile Access Gateway

LMA Address (LMAA)

MN’ Home Address (MN-HoA) MN continues to use it as long as

it roams within a same domain

That will be the tunnel entry-point

MN’s Home Network (Topological Anchor Point)

MN’s Home Network Prefix (MN-HNP)CAFE:2:/64

movement

PMIPv6 in NS-34

Page 5: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 OverviewNew entities

LMA (Local Mobility Anchor) Home Agent for the mobile node in the PMIPv6 domain Assigns MN's home prefix and manages the MN's reachability state

MAG (Mobile Access Gateway) Manages the mobility related signaling for a mobile node Tracking the MN’s attachment to the link and for signaling the MN's

LMA

<MN ID# - Home Network Prefix - Tunnel ID#>

<MN ID# - Home Network Prefix - Tunnel ID#>

<Home Network Prefix – Link-specific (MAC) Address>

LMA

MAG

PBU

PBAck

MAG

PBU

PBAck

6-to-4 Tunne

l

4-to-4 Tunne

l

6-to-6 Tunne

l

4-to-6 Tunne

l

PMIPv6 in NS-35

Page 6: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 Operation Flow

MN MAG AAA&Policy Store LMA CN

MN Attachment AAA Query with MN-ID

AAA Reply with Profile

PBU with MN-ID, Home Network Prefix option(null), Timestamp option

PBA with MN-ID, Home Network Prefix option(HNP)

RA (Router Advertisement)

[MN-HoA:CN](data)[Proxy-CoA:LMAA][MN-HoA:CN](data)

[MN-HoA:CN](data)

Tunnel Setup

PBU: Proxy Binding UpdatePBA: Proxy Binding Ack.

DHCP ServerDHCP Request

DHCP Response

DHCP Request

DHCP Response

Optional

PMIPv6 in NS-36

Page 7: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 Features

Proxy Registration LMA needs to understand the Proxy Registration RFC 3775 MIPv6 BU/BAck. Reuse

PBU (Proxy Binding Update)

PBAck. (Proxy Binding Ack.)

PMIPv6 in NS-37

Page 8: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 Features

Home in Any Place MAG sends the RA (Router Advertisement) messages advertising

MN’s home network prefix and other parameters MAG will emulate the home link on its access link.

MN always obtain its “home network prefix”, any where in the network.

It will ensure that MN believes it is at its home.

RA Unicast RA should be UNICASTed to an MN It will contain MN’s Home Network Prefix

Per-MN Prefix

M:1 Tunnel LMA-MAG tunnel is a shared tunnel among many MNs. One tunnel is associated to multiple MNs’ Binding Caches.

PMIPv6 in NS-38

Page 9: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 Features

LMA’s Prefix-based Routing LMA will add prefix routes to MN’s home network prefix over

the tunnel.

MAG establishes IPv6 in IPv6 tunnel with LMARouting State for a MN stored in MAG

Routing State for a MN stored in LMA

Source-based Routing

PMIPv6 in NS-39

Page 10: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 Features

Any MN is just a IPv6 host Any MN is just a IPv6 host with its protocol operation

consistent with the base IPv6 specification. All aspects of Neighbor Discovery Protocol will not change.

LLA: Link Local Address (e.g., MAC Address)

PMIPv6 in NS-310

Page 11: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

LMA

LMA

Proxy Mobile IPv6 over LTE Vertical handover scenario

PMIPv6 in 3GPP LTE/EPC

PMIPv6 in NS-311

Page 12: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPV6 IMPLEMENTATION IN NS-3

H. Y. Choi, S.-G. Min, Y.-H. Han, J. Park and H. Kim "Implementation and Evaluation of Proxy Mobile IPv6 in NS-3 Network Simulator," The 5th International Conference on Ubiquitous Information Technologies & Applications (CUTE 2010), pp. 1-5, Dec. 2010

H.-Y. Choi, S.-G. Min and Y.-H. Han, "PMIPv6-based Flow Mobility Simulation in NS-3," The 5th International Conference on Innovative Mobile and Internet Services in Ubiquitous Computing, pp. 475-480, June 2011.

T. M. Trung, Y.-H. Han, H.-Y. Choi, Y.-G. Hong, "A Design of Network-based Flow Mobility based on Proxy Mobile IPv6," IEEE INFOCOM Workshop on Mobility Management in the Networks of the Future World, pp. 1-5, April 2011.

Page 13: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 ImplementationOverview

Based on NS-3 3.8 Implements common part of Mobile IPv6

Mobility header, BU(Binding Update)/BA(Binding Ack.) handler

Link layer support: Wifi, WiMax

IPv6

MIPv6 functionality PMIPv6

PMIPv6 in NS-313

Page 14: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Class Diagram

PMIPv6 in NS-314

Page 15: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Major ClassesPMIPv6 Agent

Pmipv6Mag, Pmipv6Lma – PBU/PBA processing BindingUpdateList, BindingCache – Manage binding information

Mobility header process Ipv6MobilityL4Protocol – Mobility header handler Ipv6MobilityDemux Ipv6MobilityBindingUpdate – BU handler Ipv6MobilityBindingAck – BA handler

Tunneling TunnelNetDevice – IPv6-in-IPv6 creator (Encapsulator) Ipv6TunnelL4Protocol – IPv6-in-IPv6 handler (Decapsulator)

Routing Ipv6StaticSourceRouting – Source address based routing

Helper MagHelper/ LmaHelper – Create and aggregate objects

Application UnicastRadvd – MAC Unicast of RA in Wifi network

PMIPv6 in NS-315

Page 16: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Header Classes

PMIPv6 in NS-316

Page 17: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Header Classes (cont’d)Major classes

Ipv6MobilityHeader – Common parts of mobility header Ipv6MobilityBindingUpdateHeader – BU header Ipv6MobilityBindingAckHeader – BA header MobilityOptionField – Manage mobility header options

and calculate 8-octets-based padding Ipv6MobilityOptionHeader – Common parts of mobility

option header Ipv6MobilityOptionMobileNodeIdentifierHeader, … –

Mobility option header

PMIPv6 in NS-317

Page 18: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Header Classes (cont’d)Header implementation example

class Ipv6MobilityHeader : public Header{private: uint8_t m_payload_proto; uint8_t m_header_len; uint8_t m_mh_type; uint8_t m_reserved; uint16_t m_checksum;};

uint32_t Ipv6MobilityHeader::Deserialize (Buffer::Iterator start){ Buffer::Iterator i = start;

m_payload_proto = i.ReadU8(); m_header_len = i.ReadU8(); m_mh_type = i.ReadU8(); m_reserved = i.ReadU8(); m_checksum = i.ReadNtohU16();

return GetSerializedSize ();}

void Ipv6MobilityHeader::Serialize (Buffer::Iterator start) const{ Buffer::Iterator i = start;

i.WriteU8 (m_payload_proto); i.WriteU8 (m_header_len); i.WriteU8 (m_mh_type); i.WriteU8 (m_reserved); i.WriteU16 (0);}

uint32_t Ipv6MobilityHeader::GetSerializedSize () const{ return 6;}

void Ipv6MobilityHeader::Print (std::ostream& os) const{ os << "( payload_proto = " << (uint32_t)GetPayloadProto() << " header_len = " << (uint32_t)GetHeaderLen() << " mh_type = " << (uint32_t)GetMhType() << " checksum = " << (uint32_t)GetChecksum() <<")";}

PMIPv6 in NS-318

Page 19: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

BindingUpdateList & BindingCache

PMIPv6 in NS-319

Page 20: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process

PMIPv6 in NS-320

Page 21: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process (cont’d)(1) – MN attachment event trigger

Create binding update list

(2) – Sending PBU(3)~(5) – IPv6 packet transmission between nodes

PBU packet will be arrived at the LMA

(6) – Received by mobility header handler(7)~(9) – Demultiplexing mobility header based on MhType field in the packet(10) – Received by PBU handler

Create/Update binding cache Setup tunneling & routing

PMIPv6 in NS-321

Page 22: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process (cont’d)(11) – Sending PBA(12)~(14) – IPv6 packet transmission between nodes

PBA packet will be arrived at the MAG

(15) – Received by mobility header handler(16)~(18) – Demultiplexing(19) – Received by PBA handler

Update binding update list Setup tunneling & routing

PMIPv6 in NS-322

Page 23: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process Codes(1) – MN attachment event trigger

void NqapWifiMac::TxOk (const WifiMacHeader &hdr){ NS_LOG_FUNCTION (this); if (hdr.IsAssocResp () && m_stationManager->IsWaitAssocTxOk (hdr.GetAddr1 ())) { NS_LOG_DEBUG ("associated with sta="<<hdr.GetAddr1 ()); m_stationManager->RecordGotAssocTxOk (hdr.GetAddr1 ());

//Proxy Mobile IPv6 (RFC5213) Implementation in NS3 // CHY { if(!m_newNodeCallback.IsNull()) { m_newNodeCallback(hdr.GetAddr1(), Mac48Address::ConvertFrom(GetAddress()), 4 /* WIFI */); } //} }}

<src/devices/wifi/nqap-wifi-mac.cc>

Ptr<WifiMac> mac = wDev->GetMac();

mac->SetNewNodeCallback (MakeCallback(&Pmipv6Mag::HandleNewNode, this));

<src/internet-stack/pmipv6-agent.cc>

PMIPv6 in NS-323

Page 24: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process Codes (cont’d)

(2) – Sending PBUvoid Pmipv6Mag::HandleNewNode(Mac48Address from, Mac48Address to, uint8_t att){ BindingUpdateList::Entry *bule = m_buList.Lookup(pf->GetMnIdentifier()); if ( bule == 0 ) {

bule = m_buList.Add(pf->GetMnIdentifier()); } bule->SetAccessTechnologyType(att); bule->SetMnLinkIdentifier(pf->GetMnLinkIdentifier()); bule->SetLmaAddress(pf->GetLmaAddress()); bule->SetIfIndex (ifindex); //preset header information bule->SetLastBindingUpdateSequence(GetSequence()); bule->SetLastBindingUpdateTime(MicroSeconds(Simulator::Now().GetMicroSeconds()));

<src/internet-stack/pmipv6-agent.cc>

Ptr<Packet> p = BuildPBU(bule); //save packet bule->SetPBUPacket(p); //reset (for the first registration) bule->ResetRetryCount(); //send PBU SendMessage(p->Copy(), bule->GetLmaAddress(), 64);

PMIPv6 in NS-324

Page 25: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process Codes (cont’d)

(6) – Received by mobility header handlerenum Ipv6L4Protocol::RxStatus_e Ipv6MobilityL4Protocol::Receive (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface){ NS_LOG_FUNCTION (this << packet << src << dst << interface); Ptr<Packet> p = packet->Copy (); Ptr<Ipv6MobilityDemux> ipv6MobilityDemux = GetObject<Ipv6MobilityDemux>(); Ptr<Ipv6Mobility> ipv6Mobility = 0; Ipv6MobilityHeader mh; p->PeekHeader (mh); ipv6Mobility = ipv6MobilityDemux -> GetMobility ( mh.GetMhType() ); if(ipv6Mobility) { ipv6Mobility -> Process (p, src, dst, interface); }

return Ipv6L4Protocol::RX_OK;}

<src/internet-stack/ipv6-mobility-l4-protocol.cc>

PMIPv6 in NS-325

Page 26: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process Codes (cont’d)

(7)~(9) – Demultiplexing mobility header based on MhType field in the packet

Ptr<Ipv6Mobility> Ipv6MobilityDemux::GetMobility (int mobilityNumber){ for (Ipv6MobilityList_t::iterator i = m_mobilities.begin (); i != m_mobilities.end (); ++i) { if ((*i)->GetMobilityNumber () == mobilityNumber) { return *i; } } return 0;}

<src/internet-stack/ipv6-mobility-demux.cc>

class Ipv6MobilityBindingUpdate : public Ipv6Mobility{public: static const uint8_t MOB_NUMBER = 5;

uint8_t Ipv6MobilityBindingUpdate::GetMobilityNumber () const{ return MOB_NUMBER;}

<src/internet-stack/ipv6-mobility.h,cc>

PMIPv6 in NS-326

Page 27: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process Codes (cont’d)

(7)~(9) – Demultiplexing mobility header based on MhType field in the packet

uint8_t Ipv6MobilityBindingUpdate::Process (Ptr<Packet> p, Ipv6Address src, Ipv6Address dst, Ptr<Ipv6Interface> interface){ NS_LOG_FUNCTION_NOARGS(); Ptr<Packet> packet = p->Copy(); Ipv6MobilityBindingUpdateHeader buh; Ipv6MobilityOptionBundle bundle;

/* Proxy Mobile Ipv6 process routine */ packet->RemoveHeader(buh);

if(buh.GetFlagP()) { Ptr<Pmipv6Agent> pmip6 = GetNode()->GetObject<Pmipv6Agent>(); if( pmip6 ) { Simulator::ScheduleNow( &Pmipv6Agent::HandlePBU, pmip6, p, src, dst, interface);

return 0; } }

<src/internet-stack/ipv6-mobility.cc>

PMIPv6 in NS-327

Page 28: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process Codes (cont’d)

(10) – Received by PBU handler/ (11) – Sending PBA

<src/internet-stack/pmipv6-agent.cc>

uint8_t Pmipv6Lma::HandlePBU(Ptr<Packet> packet, Ipv6Address src, Ipv6Address dst, Ptr<Ipv6Interface> interface){

Ptr<Ipv6Mobility> ipv6Mobility = ipv6MobilityDemux->GetMobility(pbu.GetMhType()); NS_ASSERT( ipv6Mobility ); uint8_t length = ((pbu.GetHeaderLen() + 1 )<<3) - pbu.GetOptionsOffset(); ipv6Mobility->ProcessOptions ( packet, pbu.GetOptionsOffset(), length, bundle);

if( pbu.GetLifetime() > 0) { bce = m_bCache.Add(mnId); bce->SetProxyCoa(src); bce->SetMnLinkIdentifier(mnLinkId); bce->SetAccessTechnologyType(bundle.GetAccessTechnologyType()); bce->SetHandoffIndicator(bundle.GetHandoffIndicator()); bce->SetMagLinkAddress(bundle.GetMagLinkAddress()); bce->SetLastBindingUpdateTime(bundle.GetTimestamp()); bce->SetReachableTime(Seconds(pbu.GetLifetime())); bce->SetLastBindingUpdateSequence(pbu.GetSequence());

PMIPv6 in NS-328

Page 29: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Codes (cont’d)(10) – Received by PBU handler/ (11) – Sending PBA

<src/internet-stack/pmipv6-agent.cc>

//create tunnel SetupTunnelAndRouting (bce); bce->MarkReachable(); //start lifetime timer bce->StartReachableTimer(); }}

errStatus = Ipv6MobilityHeader::BA_STATUS_BINDING_UPDATE_ACCEPTED;

//send PBAPtr<Packet> pktPba;if ( bce != 0 ) { pktPba = BuildPBA(bce, errStatus); }else { pktPba = BuildPBA(pbu, bundle, errStatus); }

SendMessage ( pktPba, src, 64);

PMIPv6 in NS-329

Page 30: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Binding Update Process Codes (cont’d)

(19) – Received by PBA handler

<src/internet-stack/pmipv6-agent.cc>

uint8_t Pmipv6Mag::HandlePBA(Ptr<Packet> packet, Ipv6Address src, Ipv6Address dst, Ptr<Ipv6Interface> interface)

BindingUpdateList::Entry *bule = m_buList.Lookup(bundle.GetMnIdentifier());

switch (pba.GetStatus()) { case Ipv6MobilityHeader::BA_STATUS_BINDING_UPDATE_ACCEPTED: bule->StopRetransTimer(); bule->SetPBUPacket(0);

//update information bule->SetHomeNetworkPrefixes(bundle.GetHomeNetworkPrefixes()); bule->SetReachableTime(Seconds(pba.GetLifetime()));

if( pba.GetLifetime() > 0 ) { //register radvd interface SetupRadvdInterface(bule); //create tunnel & setup routing SetupTunnelAndRouting(bule); } bule->MarkReachable(); //Setup lifetime bule->StartRefreshTimer(); bule->StartReachableTimer();

PMIPv6 in NS-330

Page 31: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Data Process

PMIPv6 in NS-331

Page 32: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Data Process (cont’d)(1)~(2) – IPv6 packet arrival

Data packet from source node, either CN or MN

(3)~(4) – Incoming packet process in IPv6 Query to routing module (3)’~(4)’ – Subsequent routing query (default) (3)”~(4)” – Source based routing query only in MAG

Source based routing is higher priority than static routing

(5) – Forwarding the packet to the MAG via tunnel device

IPv6-in-IPv6 Encapsulation performed

(6) – Sending encapsulated packet

PMIPv6 in NS-332

Page 33: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Data Process (cont’d)(7)~(9) – IPv6 packet transmission between nodes(10)~(11) – Incoming packet process in IPv6

Query to routing module

(12) – Received by IPv6-in-IPv6 packet handler Decapsulation performed

(13) – Sending decapsulated packet(14) – Sending Data Packet to the destination node, either CN or MN

PMIPv6 in NS-333

Page 34: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Data Process Codes(0) – Tunnel Device and Routing Setup

bool Pmipv6Mag::SetupTunnelAndRouting(BindingUpdateList::Entry *bule)

//create tunnel Ptr<Ipv6TunnelL4Protocol> th = GetNode()->GetObject<Ipv6TunnelL4Protocol>(); NS_ASSERT(th); uint16_t tunnelIf = th->AddTunnel(bule->GetLmaAddress()); bule->SetTunnelIfIndex (tunnelIf);

<src/internet-stack/pmipv6-agent.cc>

PMIPv6 in NS-334

Page 35: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Data Process Codes (cont’d)(0) – Tunnel Device and Routing Setup

<src/internet-stack/pmipv6-agent.cc>

//routing setup by static routing protocol Ipv6StaticRoutingHelper staticRoutingHelper; Ipv6StaticSourceRoutingHelper sourceRoutingHelper; Ptr<Ipv6> ipv6 = GetNode()->GetObject<Ipv6>(); Ptr<Ipv6StaticRouting> staticRouting = staticRoutingHelper.GetStaticRouting(ipv6); Ptr<Ipv6StaticSourceRouting> sourceRouting = sourceRoutingHelper.GetStaticSourceRouting(ipv6); NS_ASSERT(staticRouting && sourceRouting); std::list<Ipv6Address> hnpList = bule->GetHomeNetworkPrefixes(); for ( std::list<Ipv6Address>::iterator i = hnpList.begin(); i != hnpList.end(); i++ ) { NS_LOG_LOGIC ("Add Route to " << (*i) << "/64 via " << (uint32_t)bule->GetIfIndex()); staticRouting->AddNetworkRouteTo((*i), Ipv6Prefix(64), bule->GetIfIndex());

NS_LOG_LOGIC ("Add Source Route from " << (*i) << "/64 via " << (uint32_t)bule->GetTunnelIfIndex()); sourceRouting->AddNetworkRouteFrom((*i), Ipv6Prefix(64), bule->GetTunnelIfIndex()); }

PMIPv6 in NS-335

Page 36: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Data Process Codes (cont’d)(5) – Forwarding the packet to the MAG via tunnel device/ (6) – Sending encapsulated packet

<src/devices/tunnel-net-device.cc>

boolTunnelNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)

Ptr<Ipv6L3Protocol> ipv6 = GetNode()->GetObject<Ipv6L3Protocol>(); NS_ASSERT (ipv6 != 0 && ipv6->GetRoutingProtocol () != 0); NS_ASSERT ( !m_remoteAddress.IsAny() ); Ipv6Address src = m_localAddress; Ipv6Address dst = m_remoteAddress; SocketIpTtlTag tag; uint8_t ttl = 64;

tag.SetTtl (ttl); packet->AddPacketTag (tag); ipv6->Send (packet, src, dst, 41 /* IPv6-in-IPv6 */, 0);

PMIPv6 in NS-336

Page 37: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Data Process Codes (cont’d)(12) – Received by IPv6-in-IPv6 packet handler/ (13) – Sending decapsulated packet

<src/internet-stack/ipv6-tunnel-l4-protocol.cc>

const uint8_t Ipv6TunnelL4Protocol::PROT_NUMBER = 41; /* IPV6-in-IPv6 */

enum Ipv6L4Protocol::RxStatus_e Ipv6TunnelL4Protocol::Receive (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)

Ptr<Packet> p = packet->Copy(); Ipv6Header innerHeader; p->RemoveHeader(innerHeader); Ipv6Address source = innerHeader.GetSourceAddress(); Ipv6Address destination = innerHeader.GetDestinationAddress();

SocketIpTtlTag tag;

tag.SetTtl (innerHeader.GetHopLimit() - 1); p->AddPacketTag (tag); ipv6->Send(p, source, destination, innerHeader.GetNextHeader(), 0);

PMIPv6 in NS-337

Page 38: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

HelpersMagHelper

Install(node) Create PMIPv6 related objects and aggregate into Node Register callback for MN attachment trigger to WifiMac in node

Install(node, addr, Ptr<Node> ap_node) Create PMIPv6 related objects and aggregate into Node Register callback for MN attachment trigger to WifiMac in ap_node

SetProfileHelper(Pmip6ProfileHelper) Set profile helper

LmaHelper Install(node)

Create PMIPv6 related objects and aggregate into Node SetProfileHelper(Pmip6ProfileHelper)

Set profile helper SetPrefixPoolBase(prefix, prefix_len)

Set Prefix Pool information

PMIPv6 in NS-338

Page 39: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

PMIPv6 Simulation Scenario

PMIPv6 in NS-339

Page 40: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Create nodes

Install IPv4/IPv6 networking stack

Simulation Script

backbone.Create(3); aps.Create(2); cn.Create(1); sta.Create(1);

lma.Add(backbone.Get(0)); mags.Add(backbone.Get(1)); mags.Add(backbone.Get(2)); outerNet.Add(lma); outerNet.Add(cn); mag1Net.Add(mags.Get(0)); mag1Net.Add(aps.Get(0));

mag2Net.Add(mags.Get(1)); mag2Net.Add(aps.Get(1));

InternetStackHelper internet; internet.Install (backbone); internet.Install (aps); internet.Install (cn); internet.Install (sta);

PMIPv6 in NS-340

Page 41: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Attach devices & Assign IPv6 Addresses

Simulation Script (cont’d)

//Link between CN and LMA is 50Mbps and 10ms delay csma1.SetChannelAttribute ("DataRate", DataRateValue (DataRate(50000000))); csma1.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(10))); csma1.SetDeviceAttribute ("Mtu", UintegerValue (1400)); outerDevs = csma1.Install(outerNet); iifc = AssignIpv6Address(outerDevs.Get(0), Ipv6Address("3ffe:2::1"), 64); outerIfs.Add(iifc); iifc = AssignIpv6Address(outerDevs.Get(1), Ipv6Address("3ffe:2::2"), 64); outerIfs.Add(iifc); outerIfs.SetRouter(0, true);

//All Link is 50Mbps and 2ms delay csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(50000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds(2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1400));

backboneDevs = csma.Install(backbone); iifc = AssignIpv6Address(backboneDevs.Get(0), Ipv6Address("3ffe:1::1"), 64); backboneIfs.Add(iifc); iifc = AssignIpv6Address(backboneDevs.Get(1), Ipv6Address("3ffe:1::2"), 64); backboneIfs.Add(iifc); iifc = AssignIpv6Address(backboneDevs.Get(2), Ipv6Address("3ffe:1::3"), 64); backboneIfs.Add(iifc); backboneIfs.SetRouter(0, true);

PMIPv6 in NS-341

Page 42: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Setup mobility

Simulation Script (cont’d)

MobilityHelper mobility; Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();

positionAlloc->Add (Vector (-100.0, 0.0, 0.0)); //MAG1AP positionAlloc->Add (Vector (100.0, 0.0, 0.0)); //MAG2AP

mobility.SetPositionAllocator (positionAlloc); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");

mobility.Install (aps);

Ptr<ListPositionAllocator> staPositionAlloc = CreateObject<ListPositionAllocator> ();

staPositionAlloc->Add (Vector (-100.0, 100.0, 0.0)); //STA

mobility.SetPositionAllocator (staPositionAlloc);

mobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel");

mobility.Install(sta);

Ptr<ConstantVelocityMobilityModel> cvm = sta.Get(0)-

>GetObject<ConstantVelocityMobilityModel>();

cvm->SetVelocity(Vector (20.0, 0, 0)); //move to left to right 20.0m/s

PMIPv6 in NS-342

Page 43: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Setup Wifi

Simulation Script (cont’d)

Ssid ssid = Ssid("MAG");

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();

wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);

WifiHelper wifi = WifiHelper::Default ();

NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();

wifiPhy.SetChannel (wifiChannel.Create ());

wifiMac.SetType ("ns3::NqapWifiMac",

"Ssid", SsidValue (ssid),

"BeaconGeneration", BooleanValue (true),

"BeaconInterval", TimeValue (MilliSeconds(100)));

mag1ApDev = wifi.Install (wifiPhy, wifiMac, mag1Net.Get(1));

//WLAN interface

wifiMac.SetType ("ns3::NqstaWifiMac",

"Ssid", SsidValue (ssid),

"ActiveProbing", BooleanValue (false));

staDevs.Add( wifi.Install (wifiPhy, wifiMac, sta));

PMIPv6 in NS-343

Page 44: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Setup PMIPv6

Simulation Script (cont’d)

//attach PMIPv6 agents

Pmip6ProfileHelper *profile = new Pmip6ProfileHelper();

//adding profile for each station

profile->AddProfile(Identifier("[email protected]"),

Identifier(Mac48Address::ConvertFrom(staDevs.Get(0)->GetAddress())),

backboneIfs.GetAddress(0, 1),

std::list<Ipv6Address>());

Pmip6LmaHelper lmahelper;

lmahelper.SetPrefixPoolBase(Ipv6Address("3ffe:1:4::"), 48);

lmahelper.SetProfileHelper(profile);

lmahelper.Install(lma.Get(0));

Pmip6MagHelper maghelper;

maghelper.SetProfileHelper(profile);

maghelper.Install (mags.Get(0), mag1Ifs.GetAddress(0, 0), aps.Get(0));

maghelper.Install (mags.Get(1), mag2Ifs.GetAddress(0, 0), aps.Get(1));

PMIPv6 in NS-344

Page 45: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Setup Traffic

Simulation Script (cont’d)

Udp6ServerHelper udpServer(6000);

ApplicationContainer apps = udpServer.Install (sta.Get (0));

apps.Start (Seconds (1.0));

apps.Stop (Seconds (10.0));

uint32_t packetSize = 1024;

uint32_t maxPacketCount = 0xffffffff;

Time interPacketInterval = MilliSeconds(10);

Udp6ClientHelper udpClient(Ipv6Address("3ffe:1:4:1:200:ff:fe00:c"), 6000);

udpClient.SetAttribute ("Interval", TimeValue (interPacketInterval));

udpClient.SetAttribute ("PacketSize", UintegerValue (packetSize));

udpClient.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));

apps = udpClient.Install (cn.Get (0));

apps.Start (Seconds (1.5));

apps.Stop (Seconds (10.0));

PMIPv6 in NS-345

Page 46: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Simulation ResultsPCAP Trace of Binding Update in the LMA

PMIPv6 in NS-346

Page 47: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Simulation Results (cont’d)PCAP Trace of Handover in the MN

PMIPv6 in NS-347

Page 48: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Simulation Results (cont’d)PCAP Trace of Tunneling in the LMA

PMIPv6 in NS-348

Page 49: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Simulation Results (cont’d)PCAP Trace of Tunneling after handover in the LMA

PMIPv6 in NS-349

Page 50: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Simulation Results (cont’d)Handover Latency

350

360

370

380

390

5.2 5.25 5.3 5.35 5.4 5.45 5.5 5.55 5.6

Seq

uenc

e

Time(s)

5.3849s 5.42389s

PMIPv6 in NS-350

Page 51: NS-3 를 이용한 Proxy Mobile IPv6 시뮬레이션 구현 및 예제 2011 년도 한국통신학회 단기강좌 한국기술교육대학교 컴퓨터공학부 - 한연희 교수

Thank you- Q&A -