PMIPv6 Implementation on NS-3 - LINK@KoreaTech

Download Report

Transcript PMIPv6 Implementation on NS-3 - LINK@KoreaTech

NS-3를 이용한 Proxy Mobile IPv6
시뮬레이션 구현 및 예제
한국기술교육대학교 컴퓨터공학부 - 한연희 교수
[email protected]
고려대학교 융합소프트웨어 전문대학원 - 최현영 연구교수
[email protected]
2011년도 한국통신학회 단기강좌
PMIPV6 INTRODUCTION
Goal of PMIPv6
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.
registration
3
PMIPv6 Scenario
(being extended)
PMIPv6 in NS-3
PMIPv6 Overview [IETF RFC 5213, August 2008]
LMA: Localized Mobility Agent
MAG: Mobile Access Gateway
IP Tunnel
IP-in-IP tunnel between LMA and MAG
LMA
Home Network
MN’s Home Network
(Topological Anchor Point)
MAG
LMA Address (LMAA)
That will be the tunnel entry-point
movement
MN’s Home Network Prefix (MN-HNP)
CAFE:2:/64
MN’ Home Address (MN-HoA)
MN continues to use it as long as
it roams within a same domain
4
MAG
LMM
(Localized Mobility Management)
Domain
Proxy Binding Update/Ack.
(PBU/PBA)
Control messages exchanged by MAG
to LMA to establish a binding between
MN-HoA and Proxy-CoA
Proxy Care of Address (Proxy-CoA)
The address of MAG
That will be the tunnel end-point
PMIPv6 in NS-3
PMIPv6 Overview
New 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
LMA
<MN ID# - Home Network Prefix - Tunnel ID#>
6-to-6 4-to-6 PBU
Tunnel Tunnel
PBU
PBAck
6-to-4 4-to-4
Tunnel Tunnel
PBAck
<MN ID# - Home Network Prefix - Tunnel ID#>
MAG
5
MAG
<Home Network Prefix – Link-specific (MAC) Address>
PMIPv6 in NS-3
PMIPv6 Operation Flow
PBU: Proxy Binding Update
PBA: Proxy Binding Ack.
MN
MAG
MN Attachment
AAA&Policy Store
LMA
CN
AAA Query with MN-ID
AAA Reply with Profile
PBU with MN-ID,
Home Network Prefix option(null), Timestamp option
RA
(Router Advertisement)
PBA with MN-ID,
Home Network Prefix option(HNP)
Tunnel Setup
Optional
DHCP Request
DHCP Server
DHCP Request
DHCP Response
DHCP Response
[Proxy-CoA:LMAA][MN-HoA:CN](data)
[MN-HoA:CN](data)
[MN-HoA:CN](data)
6
PMIPv6 in NS-3
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.)
7
PMIPv6 in NS-3
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


8
LMA-MAG tunnel is a shared tunnel among many MNs.
One tunnel is associated to multiple MNs’ Binding Caches.
PMIPv6 in NS-3
PMIPv6 Features
LMA’s Prefix-based Routing

LMA will add prefix routes to MN’s home network prefix over the tunnel.
Routing State for a MN
stored in LMA
MAG establishes IPv6 in IPv6 tunnel with LMA
Routing State for a MN
stored in MAG
Source-based Routing
9
PMIPv6 in NS-3
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)
10
PMIPv6 in NS-3
PMIPv6 in 3GPP LTE/EPC
Proxy Mobile IPv6 over LTE

Vertical handover scenario
LMA
LMA
11
PMIPv6 in NS-3
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 NS3," 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.
PMIPv6 Implementation
Overview


Based on NS-3 3.8
Implements common part of Mobile IPv6
 Mobility header, BU(Binding Update)/BA(Binding Ack.) handler
MIPv6 functionality
PMIPv6
IPv6

13
Link layer support: Wifi, WiMax
PMIPv6 in NS-3
Class Diagram
14
PMIPv6 in NS-3
Major Classes
PMIPv6 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
15

UnicastRadvd – MAC Unicast of RA in Wifi network
PMIPv6 in NS-3
Header Classes
16
PMIPv6 in NS-3
Header Classes (cont’d)
Major classes






17
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-3
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 ();
}
18
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() <<")";
}
uint32_t Ipv6MobilityHeader::GetSerializedSize () const
{
return 6;
}
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);
}
PMIPv6 in NS-3
BindingUpdateList & BindingCache
19
PMIPv6 in NS-3
Binding Update Process
20
PMIPv6 in NS-3
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


21
Create/Update binding cache
Setup tunneling & routing
PMIPv6 in NS-3
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


22
Update binding update list
Setup tunneling & routing
PMIPv6 in NS-3
Binding Update Process Codes
(1) – MN attachment event trigger
Ptr<WifiMac> mac = wDev->GetMac();
mac->SetNewNodeCallback (MakeCallback(&Pmipv6Mag::HandleNewNode, this));
<src/internet-stack/pmipv6-agent.cc>
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>
23
PMIPv6 in NS-3
Binding Update Process Codes (cont’d)
(2) – Sending PBU
void 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()));
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);
<src/internet-stack/pmipv6-agent.cc>
24
PMIPv6 in NS-3
Binding Update Process Codes (cont’d)
(6) – Received by mobility header handler
enum 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>
25
PMIPv6 in NS-3
Binding Update Process Codes (cont’d)
(7)~(9) – Demultiplexing mobility header based on
MhType field in the packet
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>
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>
26
PMIPv6 in NS-3
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>
27
PMIPv6 in NS-3
Binding Update Process Codes (cont’d)
(10) – Received by PBU handler/ (11) – Sending PBA
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());
<src/internet-stack/pmipv6-agent.cc>
28
PMIPv6 in NS-3
Binding Update Codes (cont’d)
(10) – Received by PBU handler/ (11) – Sending PBA
//create tunnel
SetupTunnelAndRouting (bce);
bce->MarkReachable();
//start lifetime timer
bce->StartReachableTimer();
}
}
errStatus = Ipv6MobilityHeader::BA_STATUS_BINDING_UPDATE_ACCEPTED;
//send PBA
Ptr<Packet> pktPba;
if ( bce != 0 )
{
pktPba = BuildPBA(bce, errStatus);
}
else
{
pktPba = BuildPBA(pbu, bundle, errStatus);
}
SendMessage ( pktPba, src, 64);
<src/internet-stack/pmipv6-agent.cc>
29
PMIPv6 in NS-3
Binding Update Process Codes (cont’d)
(19) – Received by PBA handler
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();
<src/internet-stack/pmipv6-agent.cc>
30
PMIPv6 in NS-3
Data Process
31
PMIPv6 in NS-3
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
32
PMIPv6 in NS-3
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
33
PMIPv6 in NS-3
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>
34
PMIPv6 in NS-3
Data Process Codes (cont’d)
(0) – Tunnel Device and Routing Setup
//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());
}
<src/internet-stack/pmipv6-agent.cc>
35
PMIPv6 in NS-3
Data Process Codes (cont’d)
(5) – Forwarding the packet to the MAG via tunnel device/
(6) – Sending encapsulated packet
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);
<src/devices/tunnel-net-device.cc>
36
PMIPv6 in NS-3
Data Process Codes (cont’d)
(12) – Received by IPv6-in-IPv6 packet handler/ (13) –
Sending decapsulated packet
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);
<src/internet-stack/ipv6-tunnel-l4-protocol.cc>
37
PMIPv6 in NS-3
Helpers
MagHelper

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

38
SetPrefixPoolBase(prefix, prefix_len)
 Set Prefix Pool information
PMIPv6 in NS-3
PMIPv6 Simulation Scenario
39
PMIPv6 in NS-3
Simulation Script
Create nodes
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));
Install IPv4/IPv6 networking stack
InternetStackHelper internet;
internet.Install (backbone);
internet.Install (aps);
internet.Install (cn);
internet.Install (sta);
40
PMIPv6 in NS-3
Simulation Script (cont’d)
Attach devices & Assign IPv6 Addresses
//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);
41
PMIPv6 in NS-3
Simulation Script (cont’d)
Setup mobility
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
42
PMIPv6 in NS-3
Simulation Script (cont’d)
Setup Wifi
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));
43
PMIPv6 in NS-3
Simulation Script (cont’d)
Setup PMIPv6
//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));
44
PMIPv6 in NS-3
Simulation Script (cont’d)
Setup Traffic
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));
45
PMIPv6 in NS-3
Simulation Results
PCAP Trace of Binding Update in the LMA
46
PMIPv6 in NS-3
Simulation Results (cont’d)
PCAP Trace of Handover in the MN
47
PMIPv6 in NS-3
Simulation Results (cont’d)
PCAP Trace of Tunneling in the LMA
48
PMIPv6 in NS-3
Simulation Results (cont’d)
PCAP Trace of Tunneling after handover in the LMA
49
PMIPv6 in NS-3
Simulation Results (cont’d)
Handover Latency
390
380
Sequence
5.3849s
5.42389s
370
360
350
5.2
5.25
5.3
5.35
5.4
5.45
5.5
5.55
5.6
Time(s)
50
PMIPv6 in NS-3
Thank you
- Q&A -