Skip to content

Instantly share code, notes, and snippets.

@jegade
Last active March 7, 2024 06:47
Show Gist options
  • Save jegade/982ca4d5a9c1bc6eb3fb31bff020fb86 to your computer and use it in GitHub Desktop.
Save jegade/982ca4d5a9c1bc6eb3fb31bff020fb86 to your computer and use it in GitHub Desktop.
Running OVH vrack with docker network

Run containers on dedicated ovh server with vrack and ipvlan

Dependencies

I tested this with gentoo, and docker with --experimental.

Intro

OVH vrack is a virtual rack for your dedicated server. You can get a whole ip subnet from ovh, which you can map to any of the host inside the vrack.

The dedicated server has second network device (eth1,eno2,…) which is connected to the vrack.

Steps

  1. Setup eth1/eno2 with a private network ip

# ip addr add 10.0.x.x/16 dev eth1

1.1 Set link up

# ip link eth1 up

  1. First you need to create a docker network based on your ip-subnet

# docker network create -d ipvlan --subnet=176.xxx.xxx.48/28 --gateway=176.xxx.xxx.62 -o parent=eth1 avrack

  1. Then you can start a container with an ip from this subnet

# docker run -d --name web --net=avrack --ip=176.xxx.xx.61 larsks/simpleweb

  1. Now you can reach the host from outsite at 176.xxx.xx.61

# curl 176.xxx.xx.61

Docker-Compose example

version: "2"
services:
    frontend:
        container_name: frontend
        image: larsks/simpleweb
        networks:
         avrack:
           ipv4_address: 176.xxx.xxx.61

networks:
  avrack:
    external: true

Use in Docker Swarm

  1. Create a config on every node, with only one ip in the range

# docker network create --config-only --subnet=135.xxx.xx.xx/27 --gateway=135.xxx.xx.xx --ip-range 135.xxxx.xxx.65/32 -o parent=eno2 vrack65

  1. Create a global swarm network

#docker network create -d ipvlan --scope swarm --config-from vrack65 avrack65 --attachable

  1. Use the new network in the docker-compose.yml-Stack

  2. Repeat for every ip you need from the subnet.

Further Reading ipvlan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment