Skip to content

Latest commit

 

History

History
288 lines (208 loc) · 9.09 KB

File metadata and controls

288 lines (208 loc) · 9.09 KB
title excerpt updated
Configuring an IP block in a vRack
This guide will show you how to configure a block of public IP addresses for use with the vRack.
2023-08-31

Objective

As well as private IP addressing, the vRack{.external} also allows you to route public IP traffic through your server's vRack{.external} port using a public IP address block.

This guide will show you how to configure a block of public IP addresses for use with the vRack{.external}.

Requirements

  • A public block of IP addresses in your account, with a minimum of four addresses
  • Your chosen private IP address range
  • A vRack compatible server{.external}
  • A vRack{.external} service activated in your account
  • Access to the OVHcloud Control Panel{.external}

Warning

This feature might be unavailable or limited on servers of the Eco product line.

Please visit our comparison page for more information.

Instructions

[!primary]

For example purposes we'll be using an IP block of 46.105.135.96/28 and eth1 for the secondary network interface, which is dedicated to the vRack{.external}.

Also for example purposes, the network configuration file we refer to is located in /etc/network/interfaces. The equivalent file on your server may be located somewhere else, depending on your operating system. The file content may also be different. If you encounter any difficulties, please refer to the official documentation for your distribution.

Add the IP block to the vRack

Warning

Once an IP block is added to the vRack, it is no longer attached to a physical server.

This setup allows you to configure IPs of the same block on multiple servers, provided that these servers are all in the same vRack as the IP block. The IP block must have at least 2 usable IPs or more for this to be possible.

In your OVHcloud Control Panel, go to the Bare Metal Cloud{.action} section and click on Network{.action}. Next, open the vRack{.action} menu.

Select your vRack from the list to display the list of eligible services. Click the IP block you wish to add to the vRack and click on the Add{.action} button.

vrack{.thumbnail}

Configure a usable IP address

For vRack{.external} purposes, the first, penultimate, and last addresses in any given IP block are always reserved for the network address, network gateway, and network broadcast respectively. This means that the first useable address is the second address in the block, as shown below:

46.105.135.96   Reserved: Network address
46.105.135.97   First usable IP
46.105.135.98
46.105.135.99
46.105.135.100
46.105.135.101
46.105.135.102
46.105.135.103
46.105.135.104
46.105.135.105
46.105.135.106
46.105.135.107
46.105.135.108
46.105.135.109  Last usable IP
46.105.135.110  Reserved: Network gateway
46.105.135.111  Reserved: Network broadcast

To configure the first usable IP address, we need to edit the network configuration file, as shown below. In this example, we need to use a subnet mask of 255.255.255.240.

[!primary]

The subnet mask we've used in our example is appropriate for our IP block. Your subnet mask may differ depending on the size of your block. When you purchase your IP block, you'll receive an email that will tell you which subnet mask to use.

###Debian/Ubuntu

/etc/network/interfaces

auto eth1
iface eth1 inet static
address 46.105.135.97
netmask 255.255.255.240
broadcast 46.105.135.111

Create a new IP routing table

First, we need to download and install iproute2, which is a package that will enable us to manually configure IP routing on the server.

Establish an SSH connection to your server and run the following command from the command line. This will download and install iproute2.

# apt-get install iproute2

Next, we need to create a new IP route for the vRack{.external}. We'll be adding a new traffic rule by amending the file, as shown below:

/etc/iproute2/rt_tables

#
# reserved values
#
255	local
254	main
253	default
0	unspec
#
# local
#
#1	inr.ruhep
1 vrack

Amend the network configuration file

[!primary]

For example purposes, the network configuration file we refer to is located in /etc/network/interfaces. The equivalent file on your server may be located somewhere else, depending on your operating system.

Finally, we need to amend the network configuration file to account for the new traffic rule and route the vRack{.external} traffic through the network gateway address of 46.105.135.110.

/etc/network/interfaces

auto eth1
iface eth1 inet static
address 46.105.135.97
netmask 255.255.255.240
broadcast 46.105.135.111
post-up ip route add 46.105.135.96/28 dev eth1 table vrack
post-up ip route add default via 46.105.135.110 dev eth1 table vrack
post-up ip rule add from 46.105.135.96/28 table vrack
post-up ip rule add to 46.105.135.96/28 table vrack

Now reboot your server to apply the changes or alternatively enable simply the new network interface:

ip link set eth1 up

CentOS 6/7

Create the file for the secondary network interface

First we can copy and use the configuration being used for the primary network interface and adjust it as per our needs:

sudo cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

Then we access to the new file:

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth1

And we define the IP settings:

# Created by cloud-init on instance boot automatically, do not edit.
#
DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
NETMASK=255.255.255.240
IPADDR=46.105.135.97
ARP=yes

Create a new IP routing table

Next, we need to create a new IP route for the vRack{.external}. We'll be adding a new traffic rule by amending the file, as shown below:

/etc/iproute2/rt_tables

#
# reserved values
#
255	local
254	main
253	default
0	unspec
#
# local
#
#1	inr.ruhep
1 vrack

Next, create the file needed to apply the new rules:

nano /etc/sysconfig/network-scripts/rule-eth1

And paste the following content (please remember to replace our variables with your own values):

from 46.105.135.96/28 table vrack
to 46.105.135.96/28 table vrack

Amend the network configuration file

Finally, we need to amend the network configuration file to account for the new traffic rule and route the vRack{.external} traffic through the network gateway address of 46.105.135.110.

We can achieve it by editing the following file in order to add persistent and static routes:

nano /etc/sysconfig/network-scripts/route-eth1

Paste the following content (please remember to replace our variables with your own values):

46.105.135.96/28 dev eth1 table vrack
default via 46.105.135.110 dev eth1 table vrack

Now reboot your server to apply the changes or alternatively enable simply the new network interface:

ip link set eth1 up

Windows Server 2012/2016

Step 1: Check and configure the secondary network interface

First we must access to the new network interface information:

check the second network interface{.thumbnail}

Then we must check the properties:

properties of the second network interface{.thumbnail}

properties of the second network interface{.thumbnail}

Step 2: IP Configuration

We must select the Use the following IP address option:

ip configuration{.thumbnail}

And we can finally define the IP information:

ip configuration{.thumbnail}

Step 3: Rebooting the network interface

First we do the disabling process

disabling network{.thumbnail}

Then we do the enabling process

enabling network{.thumbnail}

Troubleshooting

If you are unable to establish a connection from your VM or server to the private network, please send us a ticket from your control panel with the following :

  • IP source and IP destination
  • Ifconfig -a or ipconfig /all from both servers or VMs (setup network configuration interface)
  • ping in both ways
  • arp -a
  • Routing table

Please, include the results from above into your ticket.

Go further

Configuring the vRack on your dedicated servers{.external}

Creating multiple vLANs in a vRack{.external}

Configuring the vRack between the Public Cloud and a Dedicated Server{.external}

Join our community of users.