COREmanager Documentation

IP address management

 

The COREmanager ipdb module includes the ipbind module that can be used for IP address management. This module works with the server's network interfaces, adds and deletes real IP addresses assigned to the network interface. This article describes how the module works on different operating systems.

Adding IP addresses

IP addresses can be added in different ways depending on its family (IPv4, IPv6), and whether the interface is configured to work with IP address from that family. When adding the first IP to the network interface you should also configure the default gateway (those parameters are provided by the ipdb module).

The system will check that the newly created IP address is assigned to the interface and can start listening (to a network port) on that address.

The following notations are used for parameters:

ifaceinterface nameif_aliasalias for interface (for Linux-based servers, for example eth0:0, eth0:1 , etc.)ipIP addressmasksubnetwork mask (prefix length for IPv6) - the ipbind module gets this parameter from ipdbgatewaysubnetwork mask- the ipbind module gets this parameter from ipdb

For adding first IP addresses of a certain family, the following commands are used:

FamilyLinuxFreeBSD
IPv4ifconfig [iface] [ip] netmask [mask]route add default gw [gateway]ifconfig [iface] inet [ip] netmask [mask]route add default [gateway]
IPv6ifconfig [iface] add [ip]/[mask]route add --inet6 default gw [gateway]ifconfig [iface] inet6 [ip] prefixlen [mask]route add -inet6 default [gateway]

For adding IP addresses in general, the following commands are used:

FamilyLinuxFreeBSD
IPv4ifconfig [if_alias] [ip] netmask 255.255.255.255ifconfig [iface] alias [ip]/32
IPv6ifconfig [iface] add [ip]/128ifconfig [iface] inet6 alias [ip]/128


For adding IP address to the physical interface you should also specify information about it in the system's configuration file.

Adding the first IP of the family:

FamilyDebian-based systemsRedHat-based systemsFreeBSD
File name/etc/network/interfaces/etc/sysconfig/network-scripts/ifcfg-[iface]/etc/rc.conf
IPv4auto [iface]iface [iface] inet staticaddress [ip]netmask [mask]gateway [gateway]DEVICE=[iface]IPADDR=[ip]NETMASK=[mask]GATEWAY=[gateway]ONBOOT=yesifconfig_[iface]="inet [ip] netmask [mask]"defaultrouter="[gateway]"
IPv6auto [iface]iface [iface] inet6 staticaddress [ip]netmask [mask]gateway [gateway]DEVICE=[iface]IPV6ADDR=[ip]/[mask]IPV6_DEFAULTGW=[gateway]IPV6INIT=yesifconfig_[iface]_ipv6="inet6 [ip] prefixlen [mask]"ipv6_defaultrouter="[gateway]"

Adding the following IP addresses:

FamilyDebian-based systemsRedHat-based systemsFreeBSD
File name/etc/network/interfaces
/etc/rc.conf
IPv4auto [if_alias]iface [if_alias] inet staticaddress [ip]netmask 255.255.255.255/etc/sysconfig/network-scripts/ifcfg-[if_alias]DEVICE=[if_alias]IPADDR=[ip]NETMASK=255.255.255.255BOOTPROTO=staticONBOOT=yesifconfig_[iface]_alias[N]="alias [ip] netmask 255.255.255.255"
IPv6inside the section iface [iface] inet6 staticup /sbin/ifconfig [iface] inet6 add [ip]/[mask]";/etc/sysconfig/network-scripts/ifcfg-[iface]IPV6ADDR_SECONDARIES="[ip]/[mask]"ifconfig_[iface]_alias[N]="inet6 alias [ip] prefixlen 128"

Deleting IP addresses

Deletion of IP addresses depends on IP address family. Interface IP address won't be deleted if it is the primary address of its family of that interface.

The following command is executed for deleting IP address:

FamilyLinuxFreeBSD
IPv4ifconfig [if_alias] downifconfig [iface] delete [ip]
IPv6ifconfig [iface] del [ip]/128ifconfig [iface] inet6 [ip] delete

Once the command is executed, information about that address will be deleted from server's configuration files.