Route all lxd networks traffic to a specific interface


(Giuseppe Di Lena) #1

Hello,

I created a VPN(with n2n) between 2 servers and I configured lxd cluster;

as a result, I have now 2 different interfaces that I can use;

edge0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1400
        inet 192.168.20.1  netmask 255.255.255.0  broadcast 192.168.20.255
        inet6 fe80::d434:7fff:fef7:fd4c  prefixlen 64  scopeid 0x20<link>
        ether d6:34:7f:f7:fd:4c  txqueuelen 1000  (Ethernet)
        RX packets 176918  bytes 25393555 (25.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 239425  bytes 210900839 (210.9 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 10.0.1.26  netmask 255.255.255.0  broadcast 10.0.1.255
        inet6 fe80::64:30ff:fe23:81b2  prefixlen 64  scopeid 0x20<link>
        ether 02:64:30:23:81:b2  txqueuelen 1000  (Ethernet)
        RX packets 318651  bytes 249442008 (249.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 295534  bytes 247070172 (247.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0 is the default one;
edge0 is the device created to use the VPN network;

How to specify with lxd to use edge0 to forward all the traffic between the node of the cluster?

Bests
Giuseppe


#2

delete current default route and add the new one which points to your vpn-interface
default 0.0.0.0 edge0


(David Negreira) #3

You can setup the LXD listening interface to be listening on the edge0 interface, either with the lxd init or lxc config set core.https <address>


(Giuseppe Di Lena) #4

Thank you!