Experiment - 10 Aim: Theory:: To Implement Mobile Node Discovery
Experiment - 10 Aim: Theory:: To Implement Mobile Node Discovery
Experiment -10
Theory:
A mobile node is an Internet-connected device whose location and point of attachment to the
Internet may frequently be changed. This kind of node is often a cellular telephone or handheld
or laptop computer, although a mobile node can also be a router. Special support is required to
maintain Internet connections for a mobile node as it moves from one network or subnet to
another, because traditional Internet routing assumes a device will always have the same IP
address. Therefore, using standard routing procedures, a mobile user would have to change the
device's IP address each time they connected through another network or subnet.
Since mobility and ease of connection are crucial considerations for mobile device users,
organizations that want to promote mobile communications are putting a great deal of effort into
making mobile connection and uncomplicated for the user. The Internet Engineering Task Force
(IETF) Mobile IP working group has developed several standards or proposed standards to
address these needs, including Mobile IP and later enhancements, Mobile IP version 6 (MIPv6)
and Hierarchical Mobile IP version 6 (HMIPv6).
Mobile IP Overview
The Mobile Node is a device such as a cell phone, personal digital assistant, or laptop whose
software enables network roaming capabilities.
The Home Agent is a router on the home network serving as the anchor point for communication
with the Mobile Node; it tunnels packets from a device on the Internet, called a Correspondent
Node, to the roaming Mobile Node. (A tunnel is established between the Home Agent and a
reachable point for the Mobile Node in the foreign network.)
The Foreign Agent is a router that may function as the point of attachment for the Mobile Node
when it roams to a foreign network, delivering packets from the Home Agent to the Mobile Node.
The care-of address is the termination point of the tunnel toward the Mobile Node when it is on a
foreign network. The Home Agent maintains an association between the home IP address of the
28 | P a g e
Mobile Node and its care-of address, which is the current location of the Mobile Node on the
foreign or visited network
This section explains how Mobile IP works. The Mobile IP process has three main phases, which
are discussed in the following sections.
• Agent Discovery
A Mobile Node discovers its Foreign and Home Agents during agent discovery.
• Registration
The Mobile Node registers its current location with the Foreign Agent and Home Agent during
registration.
• Tunneling
A reciprocal tunnel is set up by the Home Agent to the care-of address (current location of the
Mobile Node on the foreign network) to route packets to the Mobile Node as it roams.
Agent Discovery
During the agent discovery phase, the Home Agent and Foreign Agent advertise their services on
the network by using the ICMP Router Discovery Protocol (IRDP). The Mobile Node listens to
these advertisements to determine if it is connected to its home network or foreign network.
The IRDP advertisements carry Mobile IP extensions that specify whether an agent is a Home
Agent, Foreign Agent, or both; its care-of address; the types of services it will provide such as
reverse tunneling and generic routing encapsulation (GRE); and the allowed registration lifetime
or roaming period for visiting Mobile Nodes. Rather than waiting for agent advertisements, a
Mobile Node can send out an agent solicitation. This solicitation forces any agents on the link to
immediately send an agent advertisement.
If a Mobile Node determines that it is connected to a foreign network, it acquires a care-of
address. Two types of care-of addresses exist:
• Care-of address acquired from a Foreign Agent
• Colocated care-of address
A Foreign Agent care-of address is an IP address of a Foreign Agent that has an interface on the
foreign network being visited by a Mobile Node. A Mobile Node that acquires this type of care-
of address can share the address with other Mobile Nodes. A colocated care-of address is an IP
address temporarily assigned to the interface of the Mobile Node itself. A colocated care-of
address represents the current position of the Mobile Node on the foreign network and can be
used by only one Mobile Node at a time.
When the Mobile Node hears a Foreign Agent advertisement and detects that it has moved
outside of its home network, it begins registration.
29 | P a g e
Registration
The Mobile Node is configured with the IP address and mobility security association (which
includes the shared key) of its Home Agent. In addition, the Mobile Node is configured with
either its home IP address, or another user identifier, such as a Network Access Identifier.
The Mobile Node uses this information along with the information that it learns from the Foreign
Agent advertisements to form a Mobile IP registration request. It adds the registration request to
its pending list and sends the registration request to its Home Agent either through the Foreign
Agent or directly if it is using a colocated care-of address and is not required to register through
the Foreign Agent. If the registration request is sent through the Foreign Agent, the Foreign
Agent checks the validity of the registration request, which includes checking that the requested
lifetime does not exceed its limitations, the requested tunnel encapsulation is available, and that
reverse tunnel is supported. If the registration request is valid, the Foreign Agent adds the visiting
Mobile Node to its pending list before relaying the request to the Home Agent. If the registration
request is not valid, the Foreign Agent sends a registration reply with appropriate error code to
the Mobile Node.
The Home Agent checks the validity of the registration request, which includes authentication of
the Mobile Node. If the registration request is valid, the Home Agent creates a mobility binding
(an association of the Mobile Node with its care-of address), a tunnel to the care-of address, and a
routing entry for forwarding packets to the home address through the tunnel.
The Home Agent then sends a registration reply to the Mobile Node through the Foreign Agent
(if the registration request was received via the Foreign Agent) or directly to the Mobile Node. If
the registration request is not valid, the Home Agent rejects the request by sending a registration
reply with an appropriate error code.
The Foreign Agent checks the validity of the registration reply, including ensuring that an
associated registration request exists in its pending list. If the registration reply is valid, the
Foreign Agent adds the Mobile Node to its visitor list, establishes a tunnel to the Home Agent,
and creates a routing entry for forwarding packets to the home address. It then relays the
registration reply to the Mobile Node.
Finally, the Mobile Node checks the validity of the registration reply, which includes ensuring an
associated request is in its pending list as well as proper authentication of the Home Agent. If the
registration reply is not valid, the Mobile Node discards the reply. If a valid registration reply
specifies that the registration is accepted, the Mobile Node is confirmed that the mobility agents
are aware of its roaming. In the colocated care-of address case, it adds a tunnel to the Home
Agent. Subsequently, it sends all packets to the Foreign Agent.
The Mobile Node reregisters before its registration lifetime expires. The Home Agent and
Foreign Agent update their mobility binding and visitor entry, respectively, during reregistration.
In the case where the registration is denied, the Mobile Node makes the necessary adjustments
30 | P a g e
and attempts to register again. For example, if the registration is denied because of time
mismatch and the Home Agent sends back its time stamp for synchronization, the Mobile Node
adjusts the time stamp in future registration requests.
Thus, a successful Mobile IP registration sets up the routing mechanism for transporting packets
to and from the Mobile Node as it roams.
Tunneling
The Mobile Node sends packets using its home IP address, effectively maintaining the
appearance that it is always on its home network. Even while the Mobile Node is roaming on
foreign networks, its movements are transparent to correspondent nodes.
Data packets addressed to the Mobile Node are routed to its home network, where the Home
Agent now intercepts and tunnels them to the care-of address toward the Mobile Node.
Tunneling has two primary functions: encapsulation of the data packet to reach the tunnel
endpoint, and decapsulation when the packet is delivered at that endpoint. The default tunnel
mode is IP Encapsulation within IP Encapsulation. Optionally, GRE and minimal encapsulation
within IP may be used.
Typically, the Mobile Node sends packets to the Foreign Agent, which routes them to their final
destination, the Correspondent Node, as shown in Figure 2.
However, this data path is topologically incorrect because it does not reflect the true IP network
source for the data—rather, it reflects the home network of the Mobile Node. Because the packets
show the home network as their source inside a foreign network, an access control list on routers
in the network called ingress filtering drops the packets instead of forwarding them. A feature
called reverse tunneling solves this problem by having the Foreign Agent tunnel packets back to
the Home Agent when it receives them from the Mobile Node. See Figure 3.
31 | P a g e
Figure 3 Reverse Tunnel
Tunnel MTU discovery is a mechanism for a tunnel encapsulator such as the Home Agent to
participate in path MTU discovery to avoid any packet fragmentation in the routing path between
a Correspondent Node and Mobile Node. For packets destined to the Mobile Node, the Home
Agent maintains the MTU of the tunnel to the care-of address and informs the Correspondent
Node of the reduced packet size. This improves routing efficiency by avoiding fragmentation and
reassembly at the tunnel endpoints to ensure that packets reach the Mobile Node.
Security
Mobile IP uses a strong authentication scheme for security purposes. All registration messages
between a Mobile Node and Home Agent are required to contain the Mobile-Home
Authentication Extension (MHAE).
The integrity of the registration messages is protected by a preshared 128-bit key between a
Mobile Node and Home Agent. The keyed message digest algorithm 5 (MD5) in "prefix+suffix"
mode is used to compute the authenticator value in the appended MHAE, which is mandatory.
Mobile IP also supports the hash-based message authentication code (HMAC-MD5). The
receiver compares the authenticator value it computes over the message with the value in the
extension to verify the authenticity.
Optionally, the Mobile-Foreign Authentication Extension and Foreign-Home Authentication
Extension are appended to protect message exchanges between a Mobile Node and Foreign
Agent and between a Foreign Agent and Home Agent, respectively.
Replay protection uses the identification field in the registration messages as a timestamp and
sequence number. The Home Agent returns its time stamp to synchronize the Mobile Node for
registration.
Cisco IOS software allows the mobility keys to be stored on an authentication, authorization, and
accounting (AAA) server that can be accessed using TACACS+ or RADIUS protocols. Mobile
32 | P a g e
IP in Cisco IOS software also contains registration filters, enabling companies to restrict who is
allowed to register.
Network mobility is enabled by Mobile IP, which provides a scalable, transparent, and secure
solution. It is scalable because only the participating components need to be Mobile IP aware—
the Mobile Node and the endpoints of the tunnel. No other routers in the network or any hosts
with which the Mobile Node is communicating need to be changed or even aware of the
movement of the Mobile Node. It is transparent to any applications while providing mobility.
Also, the network layer provides link-layer independence, interlink layer roaming, and link-layer
transparency. Finally, it is secure because the set up of packet redirection is authenticated.
Result:
# Program for Mobile Node Discovery
#
import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import javax.bluetooth.*;
import java.util.*;
public class Blue extends MIDlet implements CommandListener,DiscoveryListener
{
private List activeDevices;
private Command select,exit;
private Display display;
private LocalDevice local=null;
private DiscoveryAgent agent = null;
private Vector devicesFound = null;
private ServiceRecord[] servicesFound = null;
private String connectionURL = null;
public void startApp() {
display = Display.getDisplay(this);
activeDevices = new List("Active Devices", List.IMPLICIT);
select = new Command("Search Again", Command.OK, 0);
exit = new Command("Exit", Command.EXIT, 0);
activeDevices.addCommand(exit);
activeDevices.setCommandListener(this);
try {
local = LocalDevice.getLocalDevice(); }
catch (Exception e) {}
doDeviceDiscovery();
display.setCurrent(activeDevices);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) { notifyDestroyed(); }
public void commandAction(Command cmd, Displayable disp) {
if (cmd == select && disp == activeDevices) {
activeDevices.deleteAll();
doDeviceDiscovery();
}
if (cmd == exit) { destroyApp(false); }
}
public void inquiryCompleted(int param) {
try {
switch (param) {
case DiscoveryListener.INQUIRY_COMPLETED:
if (devicesFound.size() > 0) {
activeDevices.addCommand(select);
activeDevices.setSelectCommand(select);
}
else { activeDevices.append("No Devices Found", null); }
break; }
}
catch (Exception e) {}
}
public void serviceSearchCompleted(int transID, int respCode) {}
public void servicesDiscovered(int transID, ServiceRecord[] serviceRecord) {}
public void deviceDiscovered(RemoteDevice remoteDevice, DeviceClass deviceClass) {
String str = null;
try {
str = remoteDevice.getBluetoothAddress() + " - ";
str += remoteDevice.getFriendlyName(true);
} catch (Exception e) {}
activeDevices.append(str, null);
devicesFound.addElement(remoteDevice);
if (!agent.startInquiry(DiscoveryAgent.GIAC, this)) {}
}
private void doDeviceDiscovery() {
try {
local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
devicesFound = new Vector();
} catch (Exception e) {}
}
}
Output:
Conclusion:
In this Experiment we learn how to implement mobile node discovery
33 | P a g e
Questionnaire
4) What is tunnel?
Tunneling is a protocol that allows for the secure movement of data from one network to another.
Tunneling involves allowing private network communications to be sent across a public network, such
as the Internet, through a process called encapsulation. ... Tunneling is also known as port forwarding.
6) Cisco IOS Software allows the mobility keys to be stored on an authentication, authorization,
and accounting (AAA) server that can be accessed using TACACS+ or RADIUS protocols.
34 | P a g e
8) Why network mobility scalable?
The Home Agent is the function within the MIP (Mobile IP) architecture
responsible for routing data to mobile nodes currently attached to a
foreign network. This is achieved through a tunnelling process in which a
CoA (Care-of-Address) is used to deliver the data to the mobile node.