Configure the 2nd Interface on a C2 Instance

Configuring the Second Network Interface on a C2 BareMetal Cloud Instance

C2M and C2L instances come with two 2.5Gbit/s interfaces. By default, all the traffic is routed through eth0.

This tutorial explains how to configure routing to use eth1 for internal trafic, and eth0 for internet (and nbd connections).


Routing network traffic depending on its destination

Your volumes are connected to your instance via the network, by using the NBD-Protocol.

To prevent your nbd devices from being disconnected later in the tutorial, we must explicitely route them through eth0.

Note: The network interface names may be different, depending on the OS on your Cloud Instance. You can run ifconfig to determine the interface names of your server.

1 . Get the nbd server IP address:

$> ps auxf | grep xnbd-client
root      1830  0.0  0.0   1772    64 ?        S    09:01   0:00 @xnbd-client --blocksize 4096 --retry=900 4896 /dev/nbd0
root      4265  0.0  0.0  12956   964 pts/0    S+   09:08   0:00          \_ grep --color=auto xnbd-client

Here, the nbd server is

2 . Show the default routes:

$> ip route
default via dev eth0 dev eth0  proto kernel  scope link  src dev eth1  proto kernel  scope link  src

The eth0 gateway is (second line), the eth1 gateway is (third line).

3 . Route the nbd connection explicitly through eth0:

# replace with nbd server IP
# replace with eth0 gateway IP
$> ip route add via
$> ip route
default via dev eth0 via dev eth0 # the new route dev eth0  proto kernel  scope link  src dev eth1  proto kernel  scope link  src

If you have several NBD connections, you need to follow this procedure for each of them.

The internal traffic is in the subnets and

4 . Add the routes:

# replace with eth1 gateway IP
$> ip route add via
$> ip route add via

Verifying the configuration

1 . To ensure your NBD connection is still valid, try to create a file:

$> touch testfile

2 . Since it should work, you can remove the file with rm testfile.

Check you can still reach the metadata API:

$> curl
{"api": "api-metadata", "description": "Metadata API, just query or to get info about yourself"}

3 . Ensure your are really using eth1 for internal traffic:

$> ip route get via dev eth1  src
$> ip route get # is a random IP address in via dev eth1  src

Discover a New Cloud Experience

Deploy SSD Cloud Servers in seconds.