![]() ![]() ![]() |
21.1 Overview
21.2 Running Agents With Virtual IP Addresses in a Single JVM.
21.3 Running Agents With Multiple Ports in a Single JVM
As the name indicates, this section guides you through the steps involved in running Multiple Agents in a single JVM. Starting a JVM for each Agent accumulates a lot of resources. Hence, it is not preferred. For accessing Multiple Agents in a single JVM, each Agent should be configured with different ports or different virtual IP addresses. It is also possible to simulate a network using Multiple Agents.
21.2 Running Agents With Virtual IP Addresses in a Single JVM
The first step towards running the Agent in Virtual IP addresses is to configure the virtual IP addresses.
21.2.1 Configuring Virtual IP Addresses
This section explains how to configure Multiple IP Addresses in varied OS such as Linux, Solaris, Windows NT, and Windows 2000.
You can use the "linuxconf" tool provided by Linux OS to configure virtual IP Addresses.
For setting multiple IP Addresses on an interface on a Linux system, you should have SUPER USER permission .
Log in to SUPER USER and start the "linuxconf" tool after starting X-windows. ( just type linuxconf and press "Enter" ). The following tree will be displayed.
+ config + NetWorking + ServerTasks IP Aliases for virtual hosts + Control |
Enter at IP Aliases for virtual hosts.
From the two interfaces eth0 / lo, assign the Virtual IP Addresses for physical interface eth0.
After completing the configuration, reboot your machine for the changes to take effect.
Upwards of 10,000 interfaces can be configured this way. If you are configuring a lot of interfaces it may take some time to boot up.
We recommend using two interface cards on your linux system, and using it as a router. Set the virtual interfaces up on the interface not connected to your LAN. From other systems on your LAN, you can set the linux system as the router to get to the newly configured networks. Solaris refers to these as logical interfaces.
For Solaris you can use "ifconfig" utility to setup logical interfaces. See the ifconfig main page for more details.
For making more aliases for an IP Address in Solaris, you should have the SUPER USER permission.
Log in to SUPER USER and use "ifconfig" to configure the physical interface with different logical interfaces.
For example,
ifconfig hme0:1 132.253.154.0 netmask 255.255.255.0 up
ifconfig hme0:2 132.253.154.1 netmask 255.255.255.0 up
After the configuration, check whether the driver for the Virtual IP Addresses is activated using ping.
The steps involved in configuring virtual IP addresses in a Windows NT OS are as follows:
Click "Start" menu.
This displays the "Settings" option in it.
The "Control Panel" in settings menu provides the Network details.
From the network properties, choose "Protocols Tab". It lists various protocols used by the OS.
Select TCP/IP and view its properties.
The Properties tab of the protocol has an "Advanced" tab in it which on clicking, displays the IP Address of the machine.
The "Add" option helps to add more IP addresses to the machine.
Specifying the IP Addresses here would help you start the Agents in various IP addresses.
Follow the steps given below to configure the IP Addresses in a Windows 2001 OS.
Click the Start menu.
This displays the Network and Dial-up connection in the Control Panel.
The dial-up connection has a New Connection facility and a Local Connection option.
Selecting Local connection option provides tabs that can be configured.
The Protocols tab in that option displays the protocols configured for the machine.
Clicking TCP/IP's Advanced properties provides an option for Adding.
This Add option helps to add more than one virtual IP address to the machine.
Activating the Agent in Virtual IP Address
Say you have configured virtual IP Addresses and created an Agent using AGENT-SAMPLE-MIB. The Main File of the Agent has the following code for the agent param options.
public WebNMSSnmpAgent(String[] args){ //this takes care of the options agentOptions = new AgentParamOptions( args); Thread th = new Thread(this); th.start(); } |
On adding a similar code and specifying the entry for virtual IP addresses, the Agent gets started in virtual IP Addresses.
public WebNMSSnmpAgent (String ipAddress, String[] args){ super (ipAddress); //this takes care of the options agentOptions = new AgentParamOptions(args); Thread th = new Thread(this); th.start(); } |
Please note that the following piece of code has to be included in the Main File (towards the end) to register the virtual IP Addresses.
WebNMSSnmpAgent agent_sim3 = new WebNMSSnmpAgent ("192.168.200.1", args);
WebNMSSnmpAgent agent_sim4 = new WebNMSSnmpAgent ("192.168.200.2", args); } |
21.3 Running Agents With Multiple Ports in a Single JVM
For the Agent to run in different ports, add the following piece of code in the Main File generated.
public WebNMSSnmpAgent(int port, String[] args){ super (port); |
The following code should also be included towards the end of the main file for the Agent to run at different ports.
Say you have an Agent created using AGENT-SAMPLE-MIB. To start it from the ports 8001, 8002 and 8003 include the following code in the Main file.
WebNMSSnmpAgent agent_sim = new AGENT_SAMPLE_MIB(8001,
args); |
![]() ![]() ![]() |