Sample Function Parameters:
Name |
Description |
|
The Server ID of the Container for which you would like to modify the configuration info. |
|
The new IP address. A Virtuozzo Container may have multiple IP addresses assigned to it. When modifying the IP address information, all of the existing address information will be removed from the configuration and the new addresses will be put in their place. In this example, we will be operating with a single IP address for simplicity. |
|
New netmask. |
|
The name of the network interface for which you would like to modify the IP address settings. |
Sample Function:
/// <summary>
/// Sample function ModifyIP.
/// Modifies the Container IP address.
/// </summary>
/// <param name="ve_eid">Server ID of the Container.</param>
/// <param name="new_ip">New IP address.</param>
/// <param name="netmask">New netmask.</param>
/// <param name="network">Network interface name.</param>
/// <returns>"OK" or error information.</returns>
public string ModifyIP(string ve_eid, string new_ip, string netmask, string network)
{
try {
// Instantiate the proxy class.
vzaenvmBinding env = (vzaenvmBinding)binder.InitBinding(typeof(vzaenvmBinding));
// The main input object.
set2 set_input = new set2();
// Set Server ID of the Container.
set_input.eid = ve_eid;
// The Container configuration structure.
venv_configType1 veconfig = new venv_configType1();
// Set ip addresses.
ip_addressType[] ip_address = new ip_addressType[1];
ip_address[0] = new ip_addressType();
ip_address[0].ip = new_ip;
ip_address[0].netmask = netmask;
// The network interface information structure.
net_vethType[] net = new net_vethType[1];
net[0] = new net_vethType();
// Set the network parameters.
net[0].host_routed = new object();
net[0].id = network;
net[0].ip_address = ip_address;
veconfig.net_device = net;
set_input.config = veconfig;
// Modify the Container configuration.
env.set(set_input);
return "OK!";
}
catch (Exception e) {
return "Exception: " + e.Message;
}
}