ns-3 Tutorial, Release ns-3.16
UdpEchoServerApplication. As you might expect, these applications compose a client/server application set
used to generate and echo simulated network packets
4.1.3 Channel
In the real world, one can connect a computer to a network. Often the media over which data flows in these networks
are called channels. When you connect your Ethernet cable to the plug in the wall, you are connecting your computer
to an Ethernet communication channel. In the simulated world of ns-3, one connects a Node to an object representing a
communication channel. Here the basic communication subnetwork abstraction is called the channel and is represented
in C++ by the class Channel.
The Channel class provides methods for managing communication subnetwork objects and connecting nodes to
them. Channels may also be specialized by developers in the object oriented programming sense. A Channel spe-
cialization may model something as simple as a wire. The specialized Channel can also model things as complicated
as a large Ethernet switch, or three-dimensional space full of obstructions in the case of wireless networks.
We will use specialized versions of the Channel called CsmaChannel, PointToPointChannel and
WifiChannel in this tutorial. The CsmaChannel, for example, models a version of a communication subnetwork
that implements a carrier sense multiple access communication medium. This gives us Ethernet-like functionality.
4.1.4 Net Device
It used to be the case that if you wanted to connect a computers to a network, you had to buy a specific kind of network
cable and a hardware device called (in PC terminology) a peripheral card that needed to be installed in your computer.
If the peripheral card implemented some networking function, they were called Network Interface Cards, or NICs.
Today most computers come with the network interface hardware built in and users don’t see these building blocks.
A NIC will not work without a software driver to control the hardware. In Unix (or Linux), a piece of peripheral hard-
ware is classified as a device. Devices are controlled using device drivers, and network devices (NICs) are controlled
using network device drivers collectively known as net devices. In Unix and Linux you refer to these net devices by
names such as eth0.
In ns-3 the net device abstraction covers both the software driver and the simulated hardware. A net device is “in-
stalled” in a Node in order to enable the Node to communicate with other Nodes in the simulation via Channels.
Just as in a real computer, a Node may be connected to more than one Channel via multiple NetDevices.
The net device abstraction is represented in C++ by the class NetDevice. The NetDevice class provides
methods for managing connections to Node and Channel objects; and may be specialized by developers in
the object-oriented programming sense. We will use the several specialized versions of the NetDevice called
CsmaNetDevice, PointToPointNetDevice, and WifiNetDevice in this tutorial. Just as an Ethernet NIC
is designed to work with an Ethernet network, the CsmaNetDevice is designed to work with a CsmaChannel; the
PointToPointNetDevice is designed to work with a PointToPointChannel and a WifiNetNevice is
designed to work with a WifiChannel.
4.1.5 Topology Helpers
In a real network, you will find host computers with added (or built-in) NICs. In ns-3 we would say that you will
find Nodes with attached NetDevices. In a large simulated network you will need to arrange many connections
between Nodes, NetDevices and Channels.
Since connecting NetDevices to Nodes, NetDevices to Channels, assigning IP addresses, etc., are such
common tasks in ns-3, we provide what we call topology helpers to make this as easy as possible. For example, it may
take many distinct ns-3 core operations to create a NetDevice, add a MAC address, install that net device on a Node,
configure the node’s protocol stack, and then connect the NetDevice to a Channel. Even more operations would
16 Chapter 4. Conceptual Overview