Support / Knowledge Base / Setting the IP address of a running system using internet address manager (IAM) on NET+OS V7.X

Setting the IP address of a running system using internet address manager (IAM) on NET+OS V7.X

Here is how you can change Netos 7.X IP address on the fly:
 
  • get the DHCP configuration from NVRAM
 
iamStatus = customizeIamGetDhcpConfig("eth0", &myIamDhcpParams);
 
  • set DHCP to disabled
 
myIamDhcpParams.isEnabled = FALSE;
 
  • write the DHCP configuration back to NVRAM
 
iamStatus = customizeIamSetDhcpConfig("eth0", &myIamDhcpParams);
 
  • get the static configuration from NVRAM
 
iamStatus = customizeIamGetStaticConfig("eth0", &myIamStaticParams);
 
  • set static to enabled
 
myIamStaticParams.isEnabled = TRUE;
 
  • set up the IP address, subnet mask and gateway
 
myIamStaticParams.ipAddress.addr.ipv4.sin_addr.s_addr = 0xA34217C; // 10.52.33.124
myIamStaticParams.subnetMask = 0xfffff80;  //255.255.248.0
myIamStaticParams.gateway.addr.ipv4.sin_addr.s_addr = 0xA342001; //10.52.32.1
 
  • write the static configuration back to NVRAM
 
iamStatus = customizeIamSetStaticConfig("eth0", &myIamStaticParams);
 
  • retrieve the address acquisition method last used
 
theIamStatus = naIamGetCurrentMethod("eth0", &myMethod);
 
  • disable DHCP in RAM
 
theIamStatus = naIamDisable("eth0", myMethod);
 
  • enable static in RAM
 
theIamStatus = naIamEnable("eth0", NA_IAM_METHOD_STATIC);
 
  • if you have a serial line connected to a terminal emulator, you will see the IAM messages announcing the loss of the DHCP address and the acquisition of the static address
  • get the DHCP configuration from NVRAM
 
iamStatus = customizeIamGetDhcpConfig("eth0", &myIamDhcpParams);
 
  • set DHCP to enabled
 
myIamDhcpParams.isEnabled = TRUE;
 
  • write the DHCP configuration to NVRAM
 
iamStatus = customizeIamSetDhcpConfig("eth0", &myIamDhcpParams);
 
  • get the static configuration from NVRAM
 
iamStatus = customizeIamGetStaticConfig("eth0", &myIamStaticParams);
 
  • zero out all static address fields
 
myIamStaticParams.ipAddress.addr.ipv4.sin_addr.s_addr = 0x00000000;
myIamStaticParams.subnetMask = 0x00000000;
myIamStaticParams.gateway.addr.ipv4.sin_addr.s_addr = 0x00000000;
 
  • disable static
 
myIamStaticParams.isEnabled = FALSE;
 
  • write the static configuration back to NVRAM
 
iamStatus = customizeIamSetStaticConfig("eth0", &myIamStaticParams);
 
  • disable static in RAM
 
theIamStatus = naIamDisable("eth0", NA_IAM_METHOD_STATIC);
 
  • enable DHCP in RAM
 
theIamStatus = naIamEnable("eth0", NA_IAM_METHOD_DHCP);
 
  • If you have a serial line connected to a terminal emulator, you will see the IAM messages announcing the loss of the static address and the acquisition of the DHCP address.
Last updated: Aug 08, 2017

Recently Viewed Articles

No recently viewed articles
Contact a Digi expert and get started today! Contact Us