Tuesday, April 5, 2011

Sample Coding in Wireless

Here Guys this is an sample tcl coding


# Define options
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 50 ;# number of mobilenodes
set val(rp) DSDV ;# routing protocol
set val(x) 1000 ;# X dimension of topography
set val(y) 1000 ;# Y dimension of topography
set val(stop) 150 ;# time of simulation end

set ns [new Simulator]
set tracefd [open simple.tr w]
set namtrace [open simwrls.nam w]

$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# set up topography object
set topo [new Topography]

$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)



# configure the nodes
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON

for {set i 0} {$i < $val(nn) } { incr i } {
set n($i) [$ns node]
}

# Provide initial location of mobilenodes
$n(0) set X_ 347.0
$n(0) set Y_ 3.0
$n(0) set Z_ 0.0

$n(1) set X_ 345.0
$n(1) set Y_ 36.0
$n(1) set Z_ 0.0

$n(2) set X_ 330.0
$n(2) set Y_ 121.0
$n(2) set Z_ 0.0

$n(3) set X_ 316.0
$n(3) set Y_ 152.0
$n(3) set Z_ 0.0

$n(4) set X_ 246.0
$n(4) set Y_ 90.0
$n(4) set Z_ 0.0

$n(5) set X_ 379.0
$n(5) set Y_ 6.0
$n(5) set Z_ 0.0



# Set a TCP connection between n(1) and n(31)
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n(1) $tcp
$ns attach-agent $n(31) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 10.0 "$ftp start"

# Set a TCP connection between n(31) and n(43)
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $n(31) $tcp
$ns attach-agent $n(43) $sink
$ns connect $tcp $sink

#defining heads
$ns at 0.0 "$n(0) label CH"
$ns at 0.0 "$n(1) label Source"
#$ns at 0.0 "$n(2) label N2"



$ns at 10.0 "$n(5) setdest 785.0 228.0 5.0"
$ns at 13.0 "$n(26) setdest 700.0 20.0 5.0"
$ns at 15.0 "$n(14) setdest 115.0 85.0 5.0"

#Color change while moving from one group to another
$ns at 73.0 "$n(2) delete-mark N2"
$ns at 73.0 "$n(2) add-mark N2 pink circle"
$ns at 124.0 "$n(11) delete-mark N11"
$ns at 124.0 "$n(11) add-mark N11 purple circle"
$ns at 103.0 "$n(5) delete-mark N5"
$ns at 103.0 "$n(5) add-mark N5 white circle"
$ns at 87.0 "$n(26) delete-mark N26"
$ns at 87.0 "$n(26) add-mark N26 yellow circle"
$ns at 92.0 "$n(14) delete-mark N14"
$ns at 92.0 "$n(14) add-mark N14 green circle"

# Define node initial position in nam
for {set i 0} {$i < $val(nn)} { incr i } {
# 20 defines the node size for nam
$ns initial_node_pos $n($i) 20
}

# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$n($i) reset";
}

# ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at 150.01 "puts \"end simulation\" ; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam simwrls.nam &
}

$ns run

Monday, November 15, 2010

Reduction of Rekeyying process to overcome Security

Hello Peoples

Here This topic is to discuss the overhead problem while continuous rekeying, The experts can suggest idea are the students can discuss about that , actually using the Tree structure other than that new ideas needed . share with us

Monday, October 11, 2010

Installation of Wimax in NS2.31

Hello Guys

First of all i like to apologies for delay posting in Ns2 , because busy with my Research area. Now i like to share some thoughts in Wimax 3G, here iam going to give the installation of Wimax in ns 2.31

1) at present the UMTS and the Wimax 3G research going on the Area6 but now iam posting for startup people to implement the wimax

2) download ns-allinone-2.31



#########################


wimax implementation ....

The patch file is only provided for ns-2.31.

a- Using the ns-allinone installation
step1: install the patch by running "patch -p0 step2: re-run "./configure ; make clean ; make" in the ns-2.31 directory.

b- From the ns-2.31 directory
step1: install the patch by running "patch -p1 step2: re-run "./configure ; make clean ; make" in the ns-2.31 directory.

download file from here
http://www.mediafire.com/file/apk8x0dvkj6hl5x/wimaximp.rar

Monday, September 20, 2010

RSA algorithm in Ns2

RSA This algorithm is used in cryptography Technique in that RSA is added along with it. These are procedures followed



Key generation

RSA involves a public key and a private key. The public key can be known to everyone and is used for encrypting messages. Messages encrypted with the public key can only be decrypted using the private key. The keys for the RSA algorithm are generated the following way:

1. Choose two distinct prime numbers p and q.
* For security purposes, the integers p and q should be chosen uniformly at random and should be of similar bit-length. Prime integers can be efficiently found using a primality test.
2. Compute n = pq.
* n is used as the modulus for both the public and private keys
3. Compute φ(pq) = (p − 1)(q − 1). (φ is Euler's totient function).
4. Choose an integer e such that 1 < e < φ(pq), and e and φ(pq) share no divisors other than 1 (i.e., e and φ(pq) are coprime).
* e is released as the public key exponent.
* e having a short bit-length and small Hamming weight results in more efficient encryption. However, small values of e (such as e = 3) have been shown to be less secure in some settings.[4]
5. Determine d (using modular arithmetic) which satisfies the congruence relation d e \equiv 1\pmod{\varphi(pq)}.
* Stated differently, ed − 1 can be evenly divided by the totient (p − 1)(q − 1).
* This is often computed using the extended Euclidean algorithm.
* d is kept as the private key exponent.

The public key consists of the modulus n and the public (or encryption) exponent e. The private key consists of the private (or decryption) exponent d which must be kept secret.

Note:

* An alternative, used by PKCS#1, is to choose d matching e d ≡ 1 (mod λ) with λ = lcm(p-1,q-1), where lcm is the least common multiple. Using λ instead of φ(n) allows more choices for d. λ can also be defined using the Carmichael function λ(n).
* For efficiency the following values may be precomputed and stored as part of the private key:
o p and q: the primes from the key generation,
o d\mod (p - 1) and d\mod(q - 1),
o q^{-1} \mod(p).

[edit] Encryption

Alice transmits her public key (n,e) to Bob and keeps the private key secret. Bob then wishes to send message M to Alice.

He first turns M into an integer 0 < m < n by using an agreed-upon reversible protocol known as a padding scheme. He then computes the ciphertext c corresponding to:

c = m^e\,\bmod\,n

This can be done quickly using the method of exponentiation by squaring. Bob then transmits c to Alice.
[edit] Decryption

Alice can recover m from c by using her private key exponent d by the following computation:

m = c^d\,\bmod{\,n}.

Given m, she can recover the original message M by reversing the padding scheme.

(In practice, there are more efficient methods of calculating cd using the pre computed values above.)
[edit] A worked example

Here is an example of RSA encryption and decryption. The parameters used here are artificially small, but one can also use OpenSSL to generate and examine a real keypair.

1. Choose two prime numbers

p = 61 and q = 53 Make sure that these prime numbers are distinct.

2. Compute n = pq

n=61\cdot53=3233

3. Compute the totients of product. For primes the totient is maximal and equals the prime minus one. Therefore \varphi(pq) = (p-1)(q-1) \,

\varphi(61\cdot53) = (61 - 1)\cdot(53 - 1) = 3120\,

4. Choose any number e > 1 that is coprime to 3120. Choosing a prime number for e leaves you with a single check: that e is not a divisor of 3120.

e = 17

5. Compute d such that d e \equiv 1\pmod{\varphi(pq)}\, e.g., by computing the modular multiplicative inverse of e modulo \varphi(pq)\,:

d = 2753
since 17 · 2753 = 46801 and 46801 mod 3120 = 1, this is the correct answer.
(iterating finds (15 times 3120)+1 divided by 17 is 2753, an integer, whereas other values in place of 15 do not produce an integer. The extended euclidean algorithm finds the solution to Bézout's identity of 3120x2 + 17x-367=1, and -367 mod 3120 is 2753)

The public key is (n = 3233, e = 17). For a padded message m the encryption function is m^{17} \mod {3233} or abstractly:

c = m^e\mod {n}

The private key is (n = 3233, d = 2753). The decryption function is c^{2753} \mod {3233} or in its general form:

m = c^d\mod {n}

For instance, in order to encrypt m = 65, we calculate

c = 2790 = 65^{17}\mod {3233}

To decrypt c = 2790, we tap

m = 65 = 2790^{2753}\mod {3233}.

Both of these calculations can be computed efficiently using the square-and-multiply algorithm for modular exponentiation. In real life situations the primes selected would be much larger; in our example it would be relatively trivial to factor n, 3233, obtained from the freely available public key back to the primes p and q. Given e, also from the public key, we could then compute d and so acquire the private key.

These Procedures implemented in TCL coding to run in NS2 .For codings and queries please send the mail to admin.

NS2 Projects

Hello Everyone
sorry for not posting about NS2 about two months.I know many students facing difficulties in doing Projects in Ns2. Here iam helping out doing Projects in NS2 ,
I can help Masters,PHD students,UG students and also for Researchers.
But for doing the Projects Cost will be added .
The services will be available like Online chatting, Voice Chatting,Even remote connection and i will help you people to know about Ns2. Any networking Projects can be done in NS2.

For this please contact to this mail id : clickprasan@gmail.com

still more post will be added on this blog keep reading, Ns2 Rocks.
still any doubts can ask me are can mail me I will clarify the doubts with my Best.

Tuesday, July 13, 2010

Ns2 in MAC Protocol

MAC PROTOCOL
Several researchers have proposed simple medications of IEEE 802.11 to incorporate power control. The main idea of these power control schemes is to use different power levels for RTS-CTS and DATA-ACK. Specially, maximum transmit power is used for RTS-CTS, and the minimum required transmit power is used for ATA-ACK transmissions in order to save energy. However, we show that these schemes can degrade network throughput and can result in higher energy consumption than when using IEEE 802.11 without power control. We propose a power control protocol which does not degrade throughput and yields energy saving.

A power control mechanism that can be incorporated into the IEEE 802.11 RTS-CTS handshake. The scheme in allows a node, A, to specify its current transmit power level in the transmitted RTS, and allows receiver node B to include a desired transmit power level in the CTS sent back to A. On receiving the CTS, node A then transmits DATA using the power level specified in the CTS. This scheme allows B to help A choose the appropriate power level, so as to maintain a desired signal-to-noise ratio. A similar protocol is utilized, wherein the RTS and CTS packets are sent at the highest power level, and the DATA and ACK may be sent at a lower power level. We refer to this scheme as the BASIC power control MAC protocol. We found that the BASIC scheme has a shortcoming that can degrade the throughput. Furthermore, the BASIC

Scheme may potentially increase the energy consumption, instead of decreasing it. We elaborate a power-aware routing optimization, determines routes which consume low energy. PARO chooses a cost function based on the transmit power level at each hop on a

Route, to determine a low energy-consuming route between a pair of nodes. PARO also uses a power control MAC protocol similar to BASIC. Several other routing metrics. A power control protocol presented is also similar to the BASIC scheme. It maintains a table for the minimum transmits power necessary to communicate with neighbor nodes. This scheme allows each node to increase or decrease its power level dynamically. However, different power levels among nodes result in asymmetric links, causing col-
lesions’ power control protocol proposed in uses one control channel and multiple data channels. A control channel is used to assign data channels to nodes. An RTS, CTS,

RES (a special packet), and broadcast packets are transmitted through the control channel using the highest transmit power. By an RTS-CTS handshake, source and destination
Nodes decide which channel and what power level to use for data transmissions. On the reception of CTS, the source sends an RES to the destination to reserve a data channel.

Then, DATA and ACK transmissions occur on the reserved data channel using the negotiated power level from the RTS-CTS handshake. Transmit power is controlled according to packet size. The proposed scheme is based on the observation
that reducing transmission power can result in energy savings, but can also result in more errors. A higher bit error rate can lead to increased retransmissions, consuming more

Energy. Thus, the protocol chooses an appropriate transmission power level based on the packet size. An adaptive scheme is also presented in to choose MAC frame
Size based on the channel conditions. IEEE 802.11 may result in unfairness (performance degradation) for nodes which use lower transmission power than their neighbor nodes. Poojary et al. propose a scheme to improve the fairness. COMPOW selects a common power level at all nodes in the network to ensure bi-directional links. Each node runs several routing daemons, each at a different power level. The power level is chosen to be the smallest power level which achieves the same level of network connectivity as the highest power level.

Thursday, May 20, 2010

Self- Organized Public Key Management

Overview

A self-organized approach for public key certificates, which is similar to PGP , but unlike PGP it does not depend on the certificate directories for the distribution of certificates. In this key management service the need for the existence of a centralized certification authority is omitted and every node in the network is responsible for generating their keys, issuing, storing and distributing public key certificates. The key management scheme is said to be self-organized, as it does not require any external configuration or management.

The relationship between users of the system is denoted by a directed trust graph G (V, E), where the vertices represent the nodes and an edge E denotes a public key certificate.

The main working principle is, each user maintains a local repository, which contains a limited number of certificates selected by the users based on an algorithm. When a user u wants to verify the public key certificates of another user v, then they merge the local certificate repositories and user u tries to find a certificate chain to user v in the merged repository.

Following sub-sections discusses and analyses the various operations of the self organized key management scheme:

Generating Keys, Each user of the system generates its own public key and corresponding private key locally.

Issuing Certificates, Each user in the system has the capability to issue a public key certificate. Suppose user u gets a public key of another user v through a secure channel or from another user whom user u trusts. If a user u believes that a public key Kpub belongs to a user v, then it can issue a public key certificate for v, which is signed by u. The system assumes that users are honest and do not issue false certificates. So, if user u issues a public key certificate for user v, then there must exist a directed edge form vertex u to vertex v in the trust graph G (V, E)

Storing Certificates, As mentioned earlier, each user of the system maintains a local repository where it stores the public key certificates. The local repository consists of two parts; first, each user stores the certificates that it issues and the certificates issued to it. This is necessary, as in this process all the certificates that have been issued is stored at least once. Along with these each user stores a set of other certificates issued by other users. The later set of certificates is selected using a common algorithm. In terms of the system model, each user u selects a sub graph of the trust graph G (V, E) which consists of the outgoing edges and corresponding vertices from user u and an additional set of selected edges and corresponding vertices.

Analysis

This key management scheme that does not require any existing infrastructure and nodes in the networks are responsible for issuing, distributing and storing certificates in a distributed manner. The key management service works like PGP, but instead of using separate directories, it uses the local repositories maintained by each user. Uses of public key cryptography ensure confidentiality and a decentralized approach means that there is no single point of failure. The proposal does not discuss about the scalability issue.

Some of the key points need to be mentioned regarding the efficiency of the proposed scheme:
• The proposed key management service lacks the certificate revocation mechanism, which is an important issue that should be considered.

• The authenticity of a received public key is achieved based on the probability of finding a certificate chain in the merged directory. Though, it was shown that the probability is always high if each user uses the same algorithm. Even though, all nodes may not be honest and issue false certificates. So, there is a risk using this type of model in applications where security and accountability is a prime issue.

• As discusses earlier that the proposed scheme is similar to PGP. Like PGP It has a problem in the initial stages of its execution before the number of certificates issued reaches to a certain number consider the scenario shown in fig, where a dashed line represent only friendship and a directed line represents a certificate. Now, if node 9 wants to communicate securely with node 1, it has to find a chain of certificate in the graph. But, as it is the initial stage and only nodes 2,8 and 9 have issued a certificate. So, node 9 has to wait for some other nodes to issue certificates to find a certificate chain between node 1 and 9