Route private traffic between multiple Linodes - simple route table question

Hello.

I have some Linodes running GlusterFS for high availability file services, and I have some Linodes running a web server platform, and the web servers connect to the Gluster servers as clients. Running Ubuntu 16.04 LTS.

My question is regarding my routing table – I'm a little confused about the interface being used not showing the alias. I just want to make sure that on my side, the traffic is going out through the private network and not being counted towards the public network traffic, even though the interface is the same as the one listed for the public IP route. Below, eth0:1 is the alias for the private IP on the Linode. For example purposes, Linode 1/Private IP 1 is 192.168.1.1, Linode 2/Private IP 1 is 192.168.2.1.

----- added to rc.local ------------------------------------------------

ip route add 192.168.1.1 dev eth0:1


The resulting routing table looks like (pivoting it for readability):

Destination: 192.168.1.1

Gateway: 0.0.0.0

Genmask: 255.255.255.255

Flags: UGH

Metric: 0

Ref: 0

Use: 0

Iface: eth0

Alternatively, should I be using a "via" option when adding the route? (ip route add 192.168.1.1 dev eth0:1 via 192.168.2.1)

While it makes sense to me that traffic destined for the private network isn't going to route out through the public network, I just want to make sure that bandwidth is not being calculated based on eth0 if my eth0:1 alias is routing out through eth0, if that makes sense.

Thanks for any pointers.

2 Replies

You test this by````
ip route get xxx

Since the interface is an alias, you should specify source IP when adding a route, as in````
ip route add 192.168.1.1 src 192.168.1.2 dev eth0

The via option is for gateways.

Ah, of course! Thank you – that was exactly what I needed.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct