COMPUTING > Cloud Servers > Public IP > How to make connections configured in Linux servers effective

10.1.5 How to make connections configured in Linux servers effective Cloud Server Pro service guide

To be able to make the association created between the Public IP and Cloud Server effective you have to configure the network card with the parameters provided when the Public IP was created. These data can be recovered from the control panel in the window with the details of the Public IP:
  1. Select the tab "Manage" in the control panel and click the menu item "Public IP" on the left
  2. When the summary screen for all the public IPs opens, click on the "Details" button in the line of the IP whose configuration parameters you want to find out 

Once you have taken note of the data, access the Cloud Server via the Recovery Console. You can configure the network card in Linux either temporarily (until the next reboot), or permanently.
To configure the card temporarily, for diagnostic purposes or to check or test its functionality, proceed as follows:

  1. Launch from command line "ifconfig" thus composed ifconfig <interface> <ip_address> netmask <netmask> where in the order: <interface> is the card that you want to configure (eth0 eth1 eth2), <ip_address> is the Public IP address that you want to associate, <netmask> is the relevant subnet mask. (e.g. launching ifconfig eth2 95.110.153.24 netmask 255.255.255.0 the card "eth2" will be configured with the IP "95.110.153.24" and the subnet mask "255.255.255.0")
  2. Launch from the command line "route" thus composed route add default gw <gateway> where <gateway> is the IP address for the gateway. (e.g. by launching route add default gw 95.110.153.1 the default gateway will be set with the IP "95.110.153.1")
  3. Launch from command line ifconfig <interface> to check that the card has been configured correctly (e.g. ifconfig eth2 to check the new setting on the card eth2)
  4. Launch from command line route to check the gateway setting for the IP
To configure the network interface permanently, proceed as follows:

CentOS 5.x - CentOS 6.x

  1. Launch from command line system-config-network
  2. In the graphical interface, by moving with the arrows and the <Tab> navigate to Device Configuration and press "Enter"
  3. This will open the list of network interfaces present: navigate to the tab that we previously associated with press "Enter"
  4. Retrieve the values relating to the IP, previously recorded in their respective fields, and then confirm with "OK", Save (Save) in the subsequent screens and exit (Quit).

CentOS 6.x - Alternative method

  1. Run nano /etc/sysconfig/network-scripts/ifcfg-eth0 from the command line to edit the configuration file for the eth0 network interface (if you wish to edit the other interfaces simply replace eth0 with eth1 or eth2)
  2. Edit the file by entering the details of the previously recorded Public IP, for the network adapter that you wish to configure. We remind you that to move within the text file you can use the arrows and to enter the new text you just need to add it after the existing lines (in the example we are configuring the eth0 network adapter with the network IP 95.110.153.165 with netmask 255.255.25.0)

    DEVICE=eth0
    NM_CONTROLLED=no
    ONBOOT=yes
    TYPE=Ethernet
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    NAME="System eth0"
    BOOTPROTO=none
    IPADDR=95.110.153.165
    NETMASK=255.255.255.0
    GATEWAY=95.110.153.1
    DNS1=8.8.8.8
    DNS2=8.8.4.4

  3. Once you have entered all the details press "CTRL+O" to save the changes and then "CTRL+X" to exit the editor.
  4. We remind you that when setting up a Public IP you should also check and if needed set the Gateway IP by running nano /etc/sysconfig/network from the command line by making sure that it corresponds to that indicated in the details of the Public IP.

    HOSTNAME=nameCloudServer
    NETWORKING=yes
    GATEWAY=95.110.153.1

  5. To apply your changes simply run /etc/init.d/network restart
At this point the Cloud Server is correctly connected to the Internet and can be accessed from the Internet via the public IP configured.
See also
Recovery Console