{"action":"created","issue":{"url":"https://api.github.com/repos/docker/machine/issues/2560","labels_url":"https://api.github.com/repos/docker/machine/issues/2560/labels{/name}","comments_url":"https://api.github.com/repos/docker/machine/issues/2560/comments","events_url":"https://api.github.com/repos/docker/machine/issues/2560/events","html_url":"https://github.com/docker/machine/issues/2560","id":121773968,"number":2560,"title":"Configuring swarm to communicate between nodes using eth1","user":{"login":"wildsurfer","id":1456389,"avatar_url":"https://avatars.githubusercontent.com/u/1456389?v=3","gravatar_id":"","url":"https://api.github.com/users/wildsurfer","html_url":"https://github.com/wildsurfer","followers_url":"https://api.github.com/users/wildsurfer/followers","following_url":"https://api.github.com/users/wildsurfer/following{/other_user}","gists_url":"https://api.github.com/users/wildsurfer/gists{/gist_id}","starred_url":"https://api.github.com/users/wildsurfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildsurfer/subscriptions","organizations_url":"https://api.github.com/users/wildsurfer/orgs","repos_url":"https://api.github.com/users/wildsurfer/repos","events_url":"https://api.github.com/users/wildsurfer/events{/privacy}","received_events_url":"https://api.github.com/users/wildsurfer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-11T19:17:06Z","updated_at":"2015-12-11T21:10:14Z","closed_at":null,"body":"Hey there. I'm using docker-machine to build swarm cluster over digitalocean droplets. I want to configure it to use digitalocean private interfaces (eth1) instead of public(eth0).\r\n\r\nHere is a quick script to illustrate the problem:\r\n\r\n```bash\r\n#!/bin/bash\r\n\r\nexport DIGITALOCEAN_ACCESS_TOKEN=.......\r\nexport DIGITALOCEAN_PRIVATE_NETWORKING=true\r\n\r\ndocker-machine ls -q | grep test-| xargs docker-machine rm\r\n\r\ndocker-machine create -d digitalocean test-keystore\r\nip=$(docker-machine ssh test-keystore 'ifconfig eth1 | grep \"inet addr:\" | cut -d: -f2 | cut -d\" \" -f1')\r\n\r\ntoken=\"consul://${ip}:8500\"\r\n\r\ndocker $(docker-machine config test-keystore) run -d \\\r\n    -p \"${ip}:8500:8500\" \\\r\n    -h \"consul\" \\\r\n    progrium/consul -server -bootstrap\r\n\r\ndocker-machine create \\\r\n    -d digitalocean \\\r\n    --swarm \\\r\n    --swarm-master \\\r\n    --swarm-discovery $token \\\r\n    --engine-opt=\"cluster-store=$token\" \\\r\n    --engine-opt=\"cluster-advertise=eth1:2376\" \\\r\n    test-swarm-master\r\n\r\ndocker-machine create \\\r\n    -d digitalocean \\\r\n    --swarm \\\r\n    --swarm-discovery $token \\\r\n    --engine-opt=\"cluster-store=$token\" \\\r\n    --engine-opt=\"cluster-advertise=eth1:2376\" \\\r\n    test-swarm-1\r\n```\r\n\r\nAs you can see this is a simple cluster made of 2 nodes. My thought was that this should be enough to satisfy my needs, but unfortunately it doesn't work as expected...\r\n\r\nLet's check eth1 interface on master node:\r\n\r\n```bash\r\nbash-3.2$ docker-machine ssh test-swarm-master ifconfig eth1\r\neth1      Link encap:Ethernet  HWaddr 04:01:8e:ce:2a:02  \r\n          inet addr:10.132.164.169  Bcast:10.132.255.255  Mask:255.255.0.0\r\n          inet6 addr: fe80::601:8eff:fece:2a02/64 Scope:Link\r\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1\r\n          RX packets:1630 errors:0 dropped:0 overruns:0 frame:0\r\n          TX packets:1597 errors:0 dropped:0 overruns:0 carrier:0\r\n          collisions:0 txqueuelen:1000 \r\n          RX bytes:369220 (369.2 KB)  TX bytes:245840 (245.8 KB)\r\n```\r\n\r\nLet's try `docker info`:\r\n\r\n```bash\r\nbash-3.2$ docker info\r\nContainers: 4\r\nImages: 3\r\nRole: primary\r\nStrategy: spread\r\nFilters: health, port, dependency, affinity, constraint\r\nNodes: 2\r\n test-swarm-1: 104.236.235.73:2376\r\n  └ Status: Healthy\r\n  └ Containers: 2\r\n  └ Reserved CPUs: 0 / 1\r\n  └ Reserved Memory: 0 B / 514.5 MiB\r\n  └ Labels: executiondriver=native-0.2, kernelversion=3.13.0-71-generic, operatingsystem=Ubuntu 14.04.3 LTS, provider=digitalocean, storagedriver=aufs\r\n test-swarm-master: 104.131.77.93:2376\r\n  └ Status: Healthy\r\n  └ Containers: 2\r\n  └ Reserved CPUs: 0 / 1\r\n  └ Reserved Memory: 0 B / 514.5 MiB\r\n  └ Labels: executiondriver=native-0.2, kernelversion=3.13.0-71-generic, operatingsystem=Ubuntu 14.04.3 LTS, provider=digitalocean, storagedriver=aufs, type=proxy\r\nCPUs: 2\r\nTotal Memory: 1.005 GiB\r\nName: 0f99e736baf7\r\n\r\n```\r\n\r\nAs you probably see, nodes are advertised using external IP (example: 104.236.235.73:2376). I want it to be 10.132.164.169:2376. Looks like ` --engine-opt=\"cluster-advertise=eth1:2376\"` option doesn't work. Hope I'm not missing anything.\r\n\r\nAdditional info:\r\n\r\n```bash\r\nbash-3.2$ docker-machine ssh test-swarm-master ps aux | grep swarm\r\nroot      3985  0.1  2.5  26028 12736 ?        Ssl  13:43   0:01 /swarm manage --tlsverify --tlscacert=/etc/docker/ca.pem --tlscert=/etc/docker/server.pem --tlskey=/etc/docker/server-key.pem -H tcp://0.0.0.0:3376 --strategy spread consul://10.132.85.138:8500\r\nroot      4069  0.0  1.0  19688  5500 ?        Ssl  13:43   0:00 /swarm join --advertise 104.131.77.93:2376 consul://10.132.85.138:8500\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/docker/machine/issues/comments/164048294","html_url":"https://github.com/docker/machine/issues/2560#issuecomment-164048294","issue_url":"https://api.github.com/repos/docker/machine/issues/2560","id":164048294,"user":{"login":"nathanleclaire","id":1476820,"avatar_url":"https://avatars.githubusercontent.com/u/1476820?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanleclaire","html_url":"https://github.com/nathanleclaire","followers_url":"https://api.github.com/users/nathanleclaire/followers","following_url":"https://api.github.com/users/nathanleclaire/following{/other_user}","gists_url":"https://api.github.com/users/nathanleclaire/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanleclaire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanleclaire/subscriptions","organizations_url":"https://api.github.com/users/nathanleclaire/orgs","repos_url":"https://api.github.com/users/nathanleclaire/repos","events_url":"https://api.github.com/users/nathanleclaire/events{/privacy}","received_events_url":"https://api.github.com/users/nathanleclaire/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T21:10:13Z","updated_at":"2015-12-11T21:10:13Z","body":"Hm, I don't know if it's solvable immediately, given that this line:\r\n\r\nhttps://github.com/docker/machine/blob/master/libmachine/provision/configure_swarm.go#L42-L48\r\n\r\nAlways uses the public IP address.  This is necessary if, for instance, you're connecting across clouds.\r\n\r\nI can certainly see the use case and we'll keep it in mind in the future.  I've thought about adding some way to get and use private IPs at the driver level, but doing so would be a pretty large undertaking."}}