Skip to content

Commit

Permalink
Lte IPv6 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
manoj24rana committed Sep 1, 2017
1 parent 7740327 commit 1c739c0
Show file tree
Hide file tree
Showing 29 changed files with 1,838 additions and 164 deletions.
Binary file added src/lte/bindings/callbacks_list.pyc
Binary file not shown.
Binary file added src/lte/bindings/modulegen__gcc_LP64.pyc
Binary file not shown.
Binary file added src/lte/bindings/modulegen_customizations.pyc
Binary file not shown.
Binary file modified src/lte/doc/source/figures/epc-data-flow-dl.dia
Binary file not shown.
Binary file modified src/lte/doc/source/figures/epc-data-flow-ul.dia
Binary file not shown.
31 changes: 21 additions & 10 deletions src/lte/doc/source/lte-design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ in Figure :ref:`fig-epc-topology`.

The following design choices have been made for the EPC model:

#. The only Packet Data Network (PDN) type supported is IPv4.
#. The Packet Data Network (PDN) type supported is both IPv4 and IPv6.
#. The SGW and PGW functional entities are implemented within a single
node, which is hence referred to as the SGW/PGW node.
#. The scenarios with inter-SGW mobility are not of interests. Hence, a
Expand Down Expand Up @@ -3097,9 +3097,18 @@ there are two different layers of
IP networking. The first one is the end-to-end layer, which provides end-to-end
connectivity to the users; this layers involves the UEs, the PGW and
the remote host (including eventual internet routers and hosts in
between), but does not involve the eNB. By default, UEs are assigned a public IPv4 address in the 7.0.0.0/8
network, and the PGW gets the address 7.0.0.1, which is used by all
UEs as the gateway to reach the internet.
between), but does not involve the eNB. In this version of LTE, the EPC
supports both IPv4 and IPv6 type users. The 3GPP unique 64 bit IPv6 prefix
allocation process for each UE and PGW is followed here. Each EPC is assigned
an unique 16 bit IPv4 and a 48 bit IPv6 network address from the pool of
7.0.0.0/8 and 7777:f00d::/32 respectively. In the end-to-end IP connection
between UE and PGW, all addresses are configured using these prefixes.
These default values could also be changed from user script by setting
the attribute, defined in the helper classes. It increases the readability
of the user defined topology. As the first 16 bit (ipv4 type) or, 48 bit (ipv6
type) prefixes differs from one EPC to another, the routing path towards
different EPC network from internet also becomes unique and easy to set up.
The PGW's address is used by all UEs as the gateway to reach the internet.

The second layer of IP networking is the EPC local area network. This
involves all eNB nodes and the SGW/PGW node. This network is
Expand All @@ -3125,17 +3134,19 @@ end-to-end flow of data packets.

To begin with, we consider the case of the downlink, which is depicted
in Figure :ref:`fig-epc-data-flow-dl`.
Downlink Ipv4 packets are generated from a generic remote host, and
Downlink Ipv4/Ipv6 packets are generated from a generic remote host, and
addressed to one of the UE device. Internet routing will take care of
forwarding the packet to the generic NetDevice of the SGW/PGW node
which is connected to the internet (this is the Gi interface according
to 3GPP terminology). The SGW/PGW has a VirtualNetDevice which is
assigned the gateway IP address of the UE subnet; hence, static
assigned the base IPv4 address of the EPC network; hence, static
routing rules will cause the incoming packet from the internet to be
routed through this VirtualNetDevice. Such device starts the
GTP/UDP/IP tunneling procedure, by forwarding the packet to a
dedicated application in the SGW/PGW node which is called
EpcSgwPgwApplication. This application does the following operations:
routed through this VirtualNetDevice. In case of IPv6 address as destination,
a manual route towards the VirtualNetDevice is inserted in the routing table,
containg the 48 bit IPv6 prefix from which all the IPv6 addresses of the UEs
and PGW are configured. Such device starts the GTP/UDP/IP tunneling procedure,
by forwarding the packet to a dedicated application in the SGW/PGW node which
is called EpcSgwPgwApplication. This application does the following operations:

#. it determines the eNB node to which the UE is attached, by looking
at the IP destination address (which is the address of the UE);
Expand Down
19 changes: 7 additions & 12 deletions src/lte/doc/source/lte-user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,9 @@ Evolved Packet Core (EPC)

We now explain how to write a simulation program that allows to
simulate the EPC in addition to the LTE radio access network. The use
of EPC allows to use IPv4 networking with LTE devices. In other words,
of EPC allows to use IPv4 and IPv6 networking with LTE devices. In other words,
you will be able to use the regular ns-3 applications and sockets over
IPv4 over LTE, and also to connect an LTE network to any other IPv4
IPv4 and IPv6 over LTE, and also to connect an LTE network to any other IPv4 and IPv6
network you might have in your simulation.

First of all, in addition to ``LteHelper`` that we already introduced
Expand Down Expand Up @@ -817,9 +817,9 @@ It is to be noted that the ``EpcHelper`` will also automatically
create the PGW node and configure it so that it can properly handle
traffic from/to the LTE radio access network. Still,
you need to add some explicit code to connect the PGW to other
IPv4 networks (e.g., the internet). Here is a very simple example about
how to connect a single remote host to the PGW via a point-to-point
link::
IPv4/IPv6 networks (e.g., the internet, another EPC). Here is a very
simple example about how to connect a single remote host (IPv4 type)
to the PGW via a point-to-point link::

Ptr<Node> pgw = epcHelper->GetPgwNode ();

Expand All @@ -841,16 +841,11 @@ link::
Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
// interface 0 is localhost, 1 is the p2p device
Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);

It's important to specify routes so that the remote host can reach LTE
UEs. One way of doing this is by exploiting the fact that the
``PointToPointEpcHelper`` will by default assign to LTE UEs an IP address in the
7.0.0.0 network. With this in mind, it suffices to do::

Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
remoteHostStaticRouting->AddNetworkRouteTo (epcHelper->GetEpcIpv4NetworkAddress (), Ipv4Mask ("255.255.0.0"), 1);

Now, you should go on and create LTE eNBs and UEs as explained in the
previous sections. You can of course configure other LTE aspects such
Expand Down Expand Up @@ -1043,7 +1038,7 @@ It is typically invoked before the simulation begins::

``LteHelper::InstallEnbDevice`` and ``LteHelper::InstallUeDevice`` functions
must have been called before attaching. In an EPC-enabled simulation, it is also
required to have IPv4 properly pre-installed in the UE.
required to have IPv4/IPv6 properly pre-installed in the UE.

This method is very simple, but requires you to know exactly which UE belongs to
to which eNodeB before the simulation begins. This can be difficult when the UE
Expand Down
194 changes: 194 additions & 0 deletions src/lte/examples/lena-ipv6-addr-conf.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2017 Jadavpur University, India
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Manoj Kumar Rana <manoj24.rana@gmail.com>
*/

#include "ns3/lte-helper.h"
#include "ns3/epc-helper.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/ipv6-static-routing.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/applications-module.h"
#include "ns3/point-to-point-helper.h"
#include "ns3/config-store.h"

using namespace ns3;

/**
* Sample simulation script for LTE+EPC. It instantiates several eNodeB,
* attaches one UE per eNodeB starts a flow for each UE to and from a remote host.
* It configures IPv6 addresses for UEs by setting the 48 bit prefix attribute in epc helper
*/

NS_LOG_COMPONENT_DEFINE ("EpcFirstExampleForIpv6");

int
main (int argc, char *argv[])
{
CommandLine cmd;
cmd.Parse (argc, argv);

//Set 32 bit prefix value
Config::SetDefault ("ns3::PointToPointEpcHelper::BaseIpv6Prefix", Ipv6AddressValue (Ipv6Address ("8888:f00d:432a::")));

Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
lteHelper->SetEpcHelper (epcHelper);

Ptr<Node> pgw = epcHelper->GetPgwNode ();

// Create a single RemoteHost
NodeContainer remoteHostContainer;
remoteHostContainer.Create (1);
Ptr<Node> remoteHost = remoteHostContainer.Get (0);
InternetStackHelper internet;
internet.Install (remoteHostContainer);

// Create the Internet
PointToPointHelper p2ph;
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);

NodeContainer ueNodes;
NodeContainer enbNodes;
enbNodes.Create (2);
ueNodes.Create (2);

// Install Mobility Model
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
for (uint16_t i = 0; i < 2; i++)
{
positionAlloc->Add (Vector (60.0 * i, 0, 0));
}
MobilityHelper mobility;
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.SetPositionAllocator (positionAlloc);
mobility.Install (enbNodes);
mobility.Install (ueNodes);

// Install the IP stack on the UEs
internet.Install (ueNodes);

// Install LTE Devices to the nodes
NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
NetDeviceContainer ueLteDevs1 = lteHelper->InstallUeDevice (NodeContainer(ueNodes.Get (0)));
NetDeviceContainer ueLteDevs2 = lteHelper->InstallUeDevice (NodeContainer(ueNodes.Get (1)));

Ipv6InterfaceContainer ueIpIface;

for (NetDeviceContainer::Iterator it = ueLteDevs1.Begin (); it != ueLteDevs1.End (); ++it)
(*it)->SetAddress (Mac48Address::Allocate ());

for (NetDeviceContainer::Iterator it = ueLteDevs2.Begin (); it != ueLteDevs2.End (); ++it)
(*it)->SetAddress (Mac48Address::Allocate ());


Ipv6AddressHelper ipv6h;
ipv6h.SetBase (Ipv6Address ("6001:db80::"), Ipv6Prefix (64));
Ipv6InterfaceContainer internetIpIfaces = ipv6h.Assign (internetDevices);

internetIpIfaces.SetForwarding (0, true);
internetIpIfaces.SetDefaultRouteInAllNodes (0);


// Assign IP address to the first UE
ueIpIface = epcHelper->AssignUeIpv6Address (NetDeviceContainer (ueLteDevs1));


Ipv6StaticRoutingHelper ipv6RoutingHelper;
Ptr<Ipv6StaticRouting> remoteHostStaticRouting = ipv6RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv6> ());
remoteHostStaticRouting->AddNetworkRouteTo (epcHelper->GetEpcIpv6NetworkAddress (), Ipv6Prefix (48), internetIpIfaces.GetAddress (0, 1), 1, 0);


// Assign IP address to the second UE
ueIpIface.Add (epcHelper->AssignUeIpv6Address (NetDeviceContainer (ueLteDevs2)));



for (uint32_t u = 0; u < ueNodes.GetN (); ++u)
{
Ptr<Node> ueNode = ueNodes.Get (u);
// Set the default gateway for the UEs
Ptr<Ipv6StaticRouting> ueStaticRouting = ipv6RoutingHelper.GetStaticRouting (ueNode->GetObject<Ipv6> ());
ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress6 (), 1);
}

// Attach one UE per eNodeB
lteHelper->Attach (ueLteDevs1.Get (0), enbLteDevs.Get (0));
lteHelper->Attach (ueLteDevs2.Get (0), enbLteDevs.Get (1));


// interface 0 is localhost, 1 is the p2p device
Ipv6Address remoteHostAddr = internetIpIfaces.GetAddress (1, 1);


// Install and start applications on UEs and remote host

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps = echoServer.Install (remoteHost);

serverApps.Start (Seconds (4.0));
serverApps.Stop (Seconds (50.0));


UdpEchoClientHelper echoClient1 (remoteHostAddr, 9);
UdpEchoClientHelper echoClient2 (remoteHostAddr, 9);

echoClient1.SetAttribute ("MaxPackets", UintegerValue (1000));
echoClient1.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient1.SetAttribute ("PacketSize", UintegerValue (1024));

echoClient2.SetAttribute ("MaxPackets", UintegerValue (1000));
echoClient2.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient2.SetAttribute ("PacketSize", UintegerValue (1024));

ApplicationContainer clientApps1 = echoClient1.Install (ueNodes.Get(0));
ApplicationContainer clientApps2 = echoClient2.Install (ueNodes.Get(1));


clientApps1.Start (Seconds (4.0));
clientApps1.Stop (Seconds (50.0));

clientApps2.Start (Seconds (4.5));
clientApps2.Stop (Seconds (50.0));


LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_ALL);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_ALL);

internet.EnablePcapIpv6 ("lena9", ueNodes.Get (0));
internet.EnablePcapIpv6 ("lena10", ueNodes.Get (1));
internet.EnablePcapIpv6 ("lena11", remoteHostContainer.Get (0));
internet.EnablePcapIpv6 ("lena12", pgw);


Simulator::Stop (Seconds (50));
Simulator::Run ();

Simulator::Destroy ();
return 0;

}

Loading

0 comments on commit 1c739c0

Please sign in to comment.