Upload
others
View
65
Download
0
Embed Size (px)
Citation preview
NETWORK STREAMING SYSTEM USING IPV6 AND MULTICAST
Yücel Güven 037726
Undergraduate Project Report submitted in partial fulfillment of
the requirements for the degree of Bachelor of Science (B.S.)
in
Electrical and Electronic Engineering Department Eastern Mediterranean University
June 2006
ii
Approval of the Electrical and Electronic Engineering Department ______________________________ Prof. Dr. Derviş Z. Deniz Chairman This is to certify that we have read this thesis and that in our opinion it is fully adequate, in cope and quality, as an Undergraduate Project. _________________________________ ______________________________
…….…………………….. Asst. Prof. Dr. Erhan A. İnce Co-Supervisor Supervisor
Members of the examining committee Name Signature 1. …….…………………………….. 2. …….…………………………….. 3. …….…………………………….. 4. …….…………………………….. 5. …….…………………………….. 6. …….…………………………….. Date: …….……………………………..
iii
ABSTRACT
NETWORK STREAMING SYSTEM USING IPV6 AND MULTICAST
by
Yücel Güven
Electrical and Electronic Engineering Department Eastern Mediterranean University
Supervisor: Asst. Prof. Dr. Erhan A. İNCE
Keywords: IPv6, IPv6 networks, IPv6 socket programming, multicast, audio programming. This report is about the streaming of data packets (or datagrams) using the new Internet communication protocol: IPv6. This new protocol will be the replacement for the old protocol IPv4 which is used in today’s Internet. The purpose of this project is to build a simple IPv6 network and then to develop voice/data streaming client and server programs that will run over this small test-network. Linux as operating system and C as a programming language have been used in coding the client and server programs since it is suitable and easy to write network based socket programs under this operating system. Sending and receiving datagrams were quite successful.
iv
Acknowledgements
I want to express my most heartfelt gratitude and appreciation to my advisor,
Asst. Prof. Dr. Erhan A. İnce, who has been a constant source of inspiration for me
professionally. His addiction for always looking for excellence in researching and solving
technical problems has helped me become a much more well-rounded person. Besides
guiding my project, he has allowed me to recognize and address some of my weaknesses,
and develop into a more effective engineer. I also thank Mr. Armen Sarica for providing
me the necessary equipments, laboratory working conditions and PCs.
v
Table of Contents
ABSTRACT.....................................................................................................................III
ACKNOWLEDGEMENTS ........................................................................................... IV
TABLE OF CONTENTS ................................................................................................ V
LIST OF FIGURES ........................................................................................................VI
LIST OF TABLES ........................................................................................................ VII
1. INTRODUCTION......................................................................................................... 1
2. IPV6 PROTOCOL........................................................................................................ 2
2.1 HEADERS................................................................................................................... 2
2.2 CHANGE OF SOFTWARE APPLICATIONS .................................................................. 3
3. MULTICASTING......................................................................................................... 4
3.1 WHAT IS MULTICASTING? ....................................................................................... 4
3.2 IPV6 MULTICAST ADDRESSING................................................................................ 5
4. SENDING AND RECEIVING DATA ........................................................................ 6
4.1 SOCKETS IN IPV6 AND UDP ..................................................................................... 7
4.2 PROGRAM DETAILS .................................................................................................. 9
4.2.1 Physical Topology.............................................................................................. 9
4.2.2 Server Side ......................................................................................................... 9
4.2.3 Client Side........................................................................................................ 10
5. RUNNING APPLICATION SCREENSHOTS........................................................ 12
6. CONCLUSION ........................................................................................................... 14
7. REFERENCES............................................................................................................ 15
vi
List of Figures Figure 1: IPv6 Header........................................................................................................ 2
Figure 2: IPv4 Header........................................................................................................ 3
Figure 3: Unicast versus Multicast ..................................................................................... 4
Figure 4: IPv6 Multicast Address Structure........................................................................ 5
Figure 5: Logical Transportation of Data ........................................................................... 6
Figure 6: Sockets in TCP/IP ............................................................................................... 7
Figure 7: Physical Connectivity Diagram........................................................................... 9
Figure 8: Server Side ........................................................................................................ 10
Figure 9: Client Side ......................................................................................................... 11
Figure 10: Complete Diagram .......................................................................................... 11
Figure 11: Server Sending an Image Datagrams .............................................................. 12
Figure 12: Client Receiving an Image Datagrams............................................................ 12
Figure 13: Music Streaming Client and Server................................................................. 13
Figure 14: Captured IPv6 Packets Using Ethereal Software ............................................ 13
vii
List of Tables Table 1. Four Layers of TCP/IP.......................................................................................... 6
Table 2. Socket Types......................................................................................................... 8
Table 3. Protocol Families .................................................................................................. 8
Table 4. Settings for The Sound Card................................................................................. 9
IPv6 Multicast Communication
1
1. INTRODUCTION The Internet has become an indispensable worldwide communications medium which
is a part of productivity of commercial organizations and individuals and major component of
the world’s economic engine. IPv4, which is an Internet protocol, constitutes the most
important part of this complex communication structure. However, as a result of the recent
exponential growth of the Internet, usable IPv4 addresses, which are needed to uniquely
identify each computer or host on the Internet, have become relatively scarce. Additionally,
the rising importance of the internet-connected devices and appliances ensures that the IPv4
addresses currently in use will eventually be depleted. Primarily due to a lack of addresses,
IETF (Internet Engineering Task Force) was initiated to develop a new protocol, namely
IPv6.
Today, most of the data communications over the existing Internet uses unicast data
transmission by means of either Transmission Control Protocol (TCP) or User Datagram
Protocol (UDP) which are de-facto protocols used to transfer datagrams from source to its
destination in a point-to-point fashion. In addition, huge amount of applications transfers
exactly the same data to a large number of receivers. Upcoming Internet applications will
include real-time multicast services, such as digital video, high definition TV frames, live-
audio, etc. In multicast data transmission, a sender transfers only a single packet to a
particular group, or multicast group.
This report will be about IPv6 networks and streaming over it and it is intended to
describe how to develop a simple IPv6 client/server system using C programming language
for the benefit of not only electrical and computer engineering students, but also for the
developers who want to get basic ideas of how IPv6 networks are designed and works.
IPv6 Multicast Communication
2
2. IPv6 PROTOCOL IPv6 is the new internet protocol which will be the replacement for the old protocol
IPv4. Due to the problems of today’s traditional internet protocol, such as IP address
shortage, big internet routing tables, lack of end-to-end communication between mobile or
stationary devices, and some security reasons, a new protocol having more address space and
overcoming these problems was designed. IPv6 addresses are 128-bits long and they are used
to identify each interface. IPv6 supports addresses [1] which are four times the number of bits
as IPv4 addresses (128 vs. 32). This is 4 Billion times 4 Billion times 4 Billion (2^96) times
the size of the IPv4 address space (2^32). This works out to be:
340,282,366,920,938,463,463,374,607,431,768,211,456. This is an extremely large address
space. In a theoretical sense this is approximately 665,570,793,348,866,943,898,599
addresses per square meter of the surface of the planet Earth (Assuming the earth surface is
511,263,971,197,990 square meters).
2.1 Headers
Header is control information placed before the data when preparing the data for
network transmission. Both IPv6 and IPv4 headers are illustrated in Figure 1 and in Figure 2,
respectively. Although an IPv6 address is four times bigger than IPv4 address in size, its
header is only half of the size of the IPv4 header. Since IPv6 header is shorter than IPv4
header, it is faster for a router to route an IPv6 packet.
Figure 1: IPv6 Header.
Note. Deering, S. & Hinden, R. (1998). Internet protocol version 6
specification. Retrieved June 1, 2006 from the World Wide Web:
http://www.ietf.org/rfc/rfc2460.txt [2].
IPv6 Multicast Communication
3
Figure 2: IPv4 Header.
Note. Fernandez, D. (2002). Addressing and routing in IPv6. Retrieved May 5, 2006
from the World Wide Web: http://www.ipv6-es.com/02/in/i-agenda.htm [3].
2.2 Change of Software Applications
With IPv6 deployment, not only network infrastructure but also applications used on
the net will need to be changed. There is a lot of software used on the net, such as web
browsers, e-mail clients, file transfer programs, etc., but these applications are coded for IPv4
protocol. Therefore, all applications have to be patched or even rewritten from scratch before
the IPv6 deployment since they must be compatible with IPv6 protocol. Moreover software
compilers, such as C and C++, and their libraries will need to be revised and changed with
respect to IPv6 protocol requirements.
IPv6 Multicast Communication
4
3. MULTICASTING Multicasting is an old concept. IP multicast was first introduced in Steve Deering’s
Ph.D. dissertation in 1988 and tested on a wide scale during an "audiocast" at the 1992
Internet Engineering Task Force (IETF) meeting in San Diego [4]. However, it is obvious
that multicast communication, the one-to-many or many-to-many delivery of datagrams has
become one of the most challenging topic in the Internet. Many network product vendors
made investments for research and development of multicasting. Multicasting is still growing
into a true deployment challenge for network and Internet engineers. And it is starting to be
used by many Internet Service Providers (ISPs) due to its efficient use of bandwidth and less
host/router processing [5].
3.1 What is Multicasting?
Multicasting is a process of sending datagrams from one sender to multiple receivers.
Unicast transmission sends multiple copies of data as one copy for each receiver as seen in
Figure 3. The main reason or concept of multicasting is to have better bandwidth utilization
and less host/router processing because packets are sent only once [5]. However the main
disadvantage of multicasting is that it uses UDP based applications since this results in
occasional packet drops. Another disadvantage is all routers need to support multicast [6].
Figure 3: Unicast versus Multicast
Note. Cisco Systems, (1998) IP Multicasting. Retrieved April 7, 2006 from http://www.mbone.de/training/Module1.pdf [5]
Host
Router
Unicast
Host
Router
Multicast
IPv6 Multicast Communication
5
3.2 IPv6 Multicast Addressing
All multicast addresses in IPv6 protocol begin with the format prefix 1111 1111,
which can also be written as FF. In Classless Inter Domain Routing (CIDR) notation IPv6
multicast addresses are shown as FF00::/8. As a new feature in IPv6 addressing [7] we have
scope showing the effective area of the address as seen in Figure 4.
Figure 4: IPv6 Multicast Address Structure
Note. Cisco Systems, (2004). IPv6 Multicast Introduction. Retrieved from May 20,
2006 from http://www.cisco.com/warp/public/cc/pd/iosw/prodlit/iosiw_wp.htm [7].
Example:
FF02::1 = Link-Local and All Nodes
FF02::2 = Link-Local and All Routers
Note: FF02::1 is equal to FF02:0:0:0:0:0:0:1. However in IPv6 addressing we may compress
repeating zeros and use double colons ‘::‘ for our convenience.
128 Bits
Group ID
1111 1111
F F Flags Scope
8 bits 8 bits
Flags= 0 if permanent 1 if temporary 1: Node 2: link Scope= 5: site 8: organization E: global
IPv6 Multicast Communication
6
4. SENDING AND RECEIVING DATA In computer networks, TCP/IP protocol suite allows computers of all sizes, from
many different computer vendors, running totally different operating systems, to
communicate with each other. This protocol suite is not standart instead it is ‘de-facto’,
accepted by all vendors. It was started in the 1960s as a packet switching network which was
a government-financed research project. Then it has turned into the most widely used form of
networking between computers [8]. Networking protocols are normally developed in layers,
with each layer responsible for a different function of the communication. A protocol suite,
such as TCP/IP, is the combination of different protocols at various layers. TCP/IP
considered to be a 4-layer system, as shown in Table 1.
Application Telnet, Email, FileTransfer, etc.
Transport TCP, UDP,etc.
Network IPv4, IPv6, ICMP, etc.
DataLink and Physical DeviceDriver, I/F Card, Cables, Medium, etc.
Table 1. Four Layers of TCP/IP
Note. Stevens, W. R., TCP/IP Illustrated, Vol.I: The Protocols [8]
General function of these layered structure is to provide logical end-to-end
transportation of data through a number of intermediate networks and devices, such as
routers, as shown in Figure 5 below.
Figure 5: Logical Transportation of Data
Note. Kostin, A. (2006) Internet Architecture and Protocols. Retrieved June 15, 2006
from http://cmpe.emu.edu.tr/kostin/PUBLIC/CMPE445.LEC/cmpe445lec.htm [9].
Application Transport Network DataLink/Phys
Application Transport Network DataLink/Phys
Network
(e.g. Ethernet)
IPv6 Multicast Communication
7
4.1 Sockets in IPv6 and UDP
A socket is an interface between an application process and a transport protocol like
UDP or TCP. It is sometimes defined as Application Program Interface (API) for sending an
receiving data across a computer network [10]. An illustration of how datagrams are sent and
received by means of socket and transport protocol together with TCP/IP model is show in
Figure 6.
Figure 6: Sockets in TCP/IP
Note. Kostin, A. (2006) Internet Architecture and Protocols. Retrieved June 15, 2006
from http://cmpe.emu.edu.tr/kostin/PUBLIC/CMPE445.LEC/cmpe445lec.htm [9].
User Datagram Protocol (UDP) prepares individual UDP datagrams (or messages) for
sending or passing data from received UDP datagrams to an application process. UDP does
not have any recovery mechanism to retransmit the lost messages. It also does not provide
Application Processes
UDP Sockets
Application Layer
IPv6 Protocol
Logical Link Control (LLC)
Media Access Control (MAC)
Transport Layer
Network Layer
Ethernet / 802.11 / PPP / etc.
DataLink And
Physical Layers
TCP Sockets
Network ( e.g. Ethernet)
IPv6 Multicast Communication
8
any sequencing of messages. However in delay sensitive applications, it is one of the most
proper protocol to use.
Sockets are created using system function call which is: int socket(int domain, int type, int protocol);
The socket has the indicated type, which specifies the communication semantics. It returns an
integer descriptor referencing the socket. Current types are listed in Table 2 below.
SOCK_STREAM
(TCP)
Provides sequenced, reliable, two-way,
connection-based byte streams. An out-of-
band data transmission mechanism may be
supported.
SOCK_DGRAM
(UDP)
Supports datagrams (connectionless,
unreliable messages of a fixed maximum
length).
SOCK_SEQPACKET
Provides a sequenced, reliable, two-way
connection-based data transmission path for
datagrams of fixed maximum length; a
con sumer is required to read an entire packet
with each read system call.
SOCK_RAW Provides raw network protocol access.
SOCK_RDM Provides a reliable datagram layer that does
not guarantee ordering.
Table 2. Socket Types Note. Linux manual pages [11].
The domain parameter specifies a communication domain; this selects the protocol family
which will be used for communication as seen in Table 3. I used PF_IPV6 (IPv6 Internet
Protocol Family).
PF_INET IPv4 Internet protocols
PF_INET6 IPv6 Internet protocols
PF_IPX IPX - Novell protocols
PF_X25 ITU-T X.25 / ISO-8208 protocol
PF_ATMPVC Access to raw ATM PVCs
PF_APPLETALK Appletalk
Table 3. Protocol Families Note. Linux manual pages [11].
IPv6 Multicast Communication
9
4.2 Program Details
So far I tried to explained about the underlying protocols and their functions. In order
to transmit analog audio as protocol datagram units (PDU), first I needed to constitute audio
datagrams. In the following parts I tried to explain the details of the physical connections and
the program itself.
4.2.1 Physical Topology
In this project I used one PC as a server and one PC as a client with sound cards
installed. I used a cdplayer in order to produce datagrams. The network is a simple star
topology to connect the devices and cabling is standard UTP RJ45 Ethernet cabling. I may
also use a hub or switch device to make these connection in order to isolate the traffic from
the local area network of the department as shown in Figure 7.
Figure 7: Physical Connectivity Diagram
4.2.2 Server Side
I opened the audio device with open() system call. For Unix operating systems to
open a device is just like to open a file. So it was easy for me to read and write audio
datagrams (In fact that was the main reason for me to choose this operating system). Then I
set the sampling parameters for the sound card of the computer. This settings are necessary
for the sound quality. The parameters I used are listed in Table 4 below.
SIZE (Sample Size: 8 bits / 16 bits) 16 Bits
RATE (Sampling Frequency) 16000 samples / s.
CHANNELS (Mono=1 / Stereo=2) STEREO
Table 4. Settings for The Sound Card.
Switch
Radio/Mic./CDplayer
Client 1
Client
Server
Client 2
IPv6 Multicast Communication
10
With this parameters 1 second of audio data consists of:
(16000 / )*(16 / )*2( _ )*(1 /8 ) 64000samples s bits sample for stereo Byte bits Bytes= (4.1)
Then I opened the socket that will be used to transmit the datagrams and I set the IPv6
multicast group address and protocol type as UDP to that socket. It is an important point
since all datagram headers will have that multicast group address in their destination address
part. By using read system function -which reads audio datagrams from the audio device into
the predefined small temporary storage area in memory- I constituted IPv6 datagrams from
the sampled analog signals which in fact means I recorded a small audio datagram. Then I
directly write this datagram to the socket which means I sent or ‘multicast’ the IPv6 datagram
to the network. I tried to depict the whole process as in the following Figure 8.
Figure 8: Server Side
4.2.3 Client Side
The first thing I did in the client side was to construct a queue (buffer) mechanism to
put the data packets, or datagrams, that I will get from the network. I defined a FIFO queue to
hold these small datagrams having size of:
* 1024 *64 65536QueueSize DatagramSize QueueLength Bytes Bytes= = = (4.2)
where DataSize is the memory containing each audio datagram and QueueLength is the
length of the queue containing maximum 64 audio datagrams. Why I choosed 64 as length
was just trial-and-error paradigm.
I opened the socket and make the relevant setting for it in order to join the pre-defined
multicast group address in a similar way I did for the server side. I read IPv6 packets from the
network and move them to the queue first. Then I wrote the data to the audio device and as a
result I ‘heard’ it as analog voice signal.
If we examine this situation we have two separate processes indeed: One of them to
read datagrams from the network and the other one is to write them to the audio device. So I
developed my program having multiple process capability feature. To achieve this I used
‘unix threads’. Threads are a way for a program to split itself into two or more
… /dev/audio
ReadFromDevice Multicast To Network
Memory Area (Temp)
IPv6 Netw.
IPv6 Multicast Communication
11
simultaneously running tasks. Multithreading is a popular programming and execution model
that allows multiple threads to exist within the context of a single process, sharing the
process' resources but able to execute independently [10].
I tried to illustrate the whole process in Figure 9.
Figure 9: Client Side
A complete picture of the project is shown in Figure 10 below.
Figure 10: Complete Diagram
…
ReadFromNetwork WriteTo /dev/audio
QUEUE
PROCESS 2 PROCESS 1
/dev/audio EthCard:
Radio/ SoundCard Server-PC EthernetCard CDPlayer/ Microphone etc.
Network(Ethernet)
EthernetCard Client-PC SoundCard Speaker
IPv6 Multicast Communication
12
5. RUNNING APPLICATION SCREENSHOTS I used 278x310 pixels, RGB, 24 bits and 259,216 bytes of a bitmap image file -having
676 bytes of bitmap header- for data transfer.
Figure 11: Server Sending an Image Datagrams
Figure 12: Client Receiving an Image Datagrams
IPv6 Multicast Communication
13
Figure 13: Music Streaming Client and Server
Figure 14: Captured IPv6 Packets Using Ethereal Software
IPv6 Multicast Communication
14
6. CONCLUSION This project contains basic elements of understanding how a packet based network
functions. Besides it may also be extended to a picture, video or TV streaming system using
multicasting techniques. Main purpose of doing this project was to learn about very new
packet network technology, namely IPv6, by implementing a small socket-based multicast
streaming program. This is important because in my opinion with the deployment of IPv6
transmission techniques, billions of mobile phones and maybe our household devices, such as
washing machines, refrigerators, and even cars will be connected to the Internet in the near
future. We are mostly carrying voice in today’s data networks, but in near future it will be
common to carry live video or TV frames by using IPv6 packets and we must develop very
efficient coding and compression techniques. We will watch TV or stored multimedia like
video from our mobile phones by using IPv6 multicast. How this can be done is still a
challenging research area.
I learned too many new valuable subjects about advanced system and socket
programming with C language, IPv6 networks, and multicast protocol. I may conclude that
with this project I gained experience of building IPv6 based networks, basic IPv6 packet
transmission system and data communication between two end systems. I also get the core
aspects of TCP/IPv6 protocol suite and had solid understanding of it.
IPv6 Multicast Communication
15
7. REFERENCES
[1] Hinden, R. (2003). IP next generation overview. Retrieved May 19, 2006 from
http://playground.sun.com/ipv6/INET-IPng-Paper.html.
[2] Deering, S., & Hinden, R. (1998). Internet Protocol, version 6 specification. Retrieved
June 1, 2006 from http://www.ietf.org/rfc/rfc2460.txt
[3] Fernández, D. (2002). Addressing and routing in IPv6. Retrieved May 5, 2006 from
http://www.ipv6-es.com/02/in/i-agenda.htm
[4] Almeroth, K.C. (1999). The Evolution of Multicast. Retrieved April 8, 2006 from
http://www.cs.umd.edu/projects/syschat/multicast1.pdf
[5] Cisco Systems, (1998). IP Multicasting. Retrieved April 7, 2006 from
http://www.mbone.de/training/Module1.pdf
[6] Suzuki, S. (2004). IPv6 Multicast Explained. Retrieved June 15, 2006 from
http://www.ipv6style.jp/en/tech/20041001/
[7] Cisco Systems, (2004). IPv6 Multicast Introduction. Retrieved May 20, 2006 from
http://www.cisco.com/warp/public/cc/pd/iosw/prodlit/iosiw_wp.htm
[8] Stevens, W. R., TCP/IP Illustrated, Vol.I: The Protocols, Addison-Wesley, 1994.
[9] Kostin, A. (2006). Internet Architecture and Protocols. Retrieved June 15, 2006 from
http://cmpe.emu.edu.tr/kostin/PUBLIC/CMPE445.LEC/cmpe445lec.htm
[10] Wikipedia Free Encyclopedia (2006). Internet Socket. Retrieved June 10, 2006 from
http://en.wikipedia.org/wiki/Internet_socket.
[11] Linux Manual Pages, (2006). Socket, section 2. Retrieved June 10, 2006 from
http://linuxreviews.org/man/socket/index.html.en#toc1