Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance names not resolved on hyperkit #853

Closed
Saviq opened this issue Jun 23, 2019 · 18 comments
Closed

Instance names not resolved on hyperkit #853

Saviq opened this issue Jun 23, 2019 · 18 comments

Comments

@Saviq
Copy link
Collaborator

Saviq commented Jun 23, 2019

$ systemd-resolve --status
Global
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
Global
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test

Link 22 (vethwepla3dc978)
Current Scopes: none

$ systemd-resolve kube-node1.multipass kube-master.multipass
kube-node1.multipass: resolve call failed: 'kube-node1.multipass' not found
kube-master.multipass: resolve call failed: 'kube-master.multipass' not found

Originally posted by @sciabarracom in #666 (comment)

@maxramqvist
Copy link

maxramqvist commented Feb 22, 2020

We are having the same issue. It works fine with multipass on Ubuntu out of the box, but on Mac the .multipass-domain isn't configured. I'm not sure what's required for this to work.

Is there a workaround? A cloud-init configuration? Hosts-file isn't really a viable option - even if it works.

A workaround or some pointers to make it work through Ubuntu configuration would be really helpful until multipass supports this. Thanks ;)

Edit:
We tried the Virtualbox backend, but that is in worse shape. There the different multipass instances can't reach each other. They are all configured on the same subnet and with the same IP-address.

@thatnerdjosh
Copy link

thatnerdjosh commented May 17, 2020

@maxramqvist did you find a workaround? I was reading at https://askubuntu.com/questions/1224343/multipass-instances-cannot-resolve-each-others-name-but-can-resolve-external-n that the solution is to add manage_etc_hosts: false to the cloud-init, but I am having trouble getting that to work using --cloud-init <file>

Edit: I figured out why my cloud-init wasn't working, was a yml formatting issue... it works with just the key (as in cloud config loads)... but the problem still isn't resolved

@maxramqvist
Copy link

Problem was never resolved, we just stopped using multipass. :/ @NerdsvilleCEO

@thatnerdjosh
Copy link

@maxramqvist for a quick resolution it could be scripted using awk and a bash script

@thatnerdjosh
Copy link

This was bugging me so I developed a workaround.. it's ugly but works for now

#!/bin/bash

if ! multipass list | grep workstation; then
  multipass launch -n workstation -c 1 -m 1G -d 10G --cloud-init cloud.cfg
else
  multipass start workstation
fi

cat <<EOF > hosts
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
EOF

multipass list | egrep -v "Name|\-\-" | awk '{var=sprintf("%s\t%s.multipass",$3,$1); print var}' >> hosts
multipass transfer hosts workstation:/home/ubuntu/hosts
multipass exec workstation sudo mv hosts /etc/hosts

@goofrider
Copy link

Upvote +1. Still no-one assigned to this issue? 😞

@arobert3434
Copy link

Multipass 1.5.0+mac, just hit this, was really surprised that inter-instance DNS was not offered by this otherwise well-functioning platform.

@haim-ari
Copy link

Still same issue in
multipass 1.8.1+mac
macOS Monterey 12.1 (21C52)

@Saviq
Copy link
Collaborator Author

Saviq commented Jan 20, 2022

I'll actually mark this duplicate, here's a workaround you can employ:

#1830 (comment)

@Saviq
Copy link
Collaborator Author

Saviq commented Jan 20, 2022

Duplicate of #1830

@haim-ari
Copy link

haim-ari commented Jan 21, 2022

@Saviq I'm not sure this workaround is relevant.
From macOS I run:
multipass list
And get:
ant-server Running 10.100.102.34 Ubuntu 20.04 LTS

So from the macOS terminal I would like to be able to:
ping ant-server.multipass

But it does not resolve:
ping: cannot resolve ant-server.multipass: Unknown host

The workaround you mentioned seems to be relevant to Linux host, not Mac, am I missing something?

@Saviq
Copy link
Collaborator Author

Saviq commented Jan 21, 2022

@haim-ari you need to enable it on the Linux instances, but you'll be able to resolve insrance.local from macOS.

@haim-ari
Copy link

@haim-ari you need to enable it on the Linux instances, but you'll be able to resolve insrance.local from macOS.

@Saviq

multipass list

Name State IPv4 Image
ant-server Running 10.100.102.42 Ubuntu 20.04 LTS

Test (This is not the excepted IP)

multipass exec ant-server -- dig ant-server.local | grep -A1 'ANSWER SECTION'
;; ANSWER SECTION:
ant-server.local. 0 IN A 10.0.2.15

Available interfaces in the launched instance are:

ssh 10.100.102.42 -l ubuntu -i ~/.ssh/ant_rsa

ip addr

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:ff:d0:52 brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3 valid_lft 86296sec preferred_lft 86296sec inet6 fe80::5054:ff:feff:d052/64 scope link valid_lft forever preferred_lft forever

3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:e1:0c:c5 brd ff:ff:ff:ff:ff:ff inet 10.100.102.42/24 brd 10.100.102.255 scope global dynamic enp0s8

The cloud-init (I used interface enp0s8)

write_files:
- path: /etc/systemd/resolved.conf
  append: true
  content: |
    MulticastDNS=yes

- path: /etc/systemd/system/[email protected]
  content: |
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/systemd-resolve --set-mdns=yes --interface=%i
    After=sys-subsystem-net-devices-%i.device

    [Install]
    WantedBy=sys-subsystem-net-devices-%i.device

runcmd:
- systemctl restart systemd-resolved.service
- systemctl start [email protected]
- systemctl enable [email protected]

from cloud-init log:

Jan 21 10:07:07 ant-server systemd[1]: Starting [email protected]...
Jan 21 10:07:07 ant-server systemd[1]: [email protected]: Succeeded.
Jan 21 10:07:07 ant-server systemd[1]: Finished [email protected].

From the host (Mac):
ping ant-server.local
ping: cannot resolve ant-server.local: Unknown host

@Saviq
Copy link
Collaborator Author

Saviq commented Jan 21, 2022

@haim-ari right, this recipe worked for a single interface case. On VirtualBox you get the extra interface, but <instance>.local points at the default 10.0.2.15 IP, which is VirtualBox-internal :/

Not sure if/how you can convince systemd-resolved to announce the other IP, and announce over the external interface.

But! Since your external IP is given by your router, did you try ping ant-server in the first place? Or ping ant-server.<your-router-domain>? The router giving out the IP over DHCP should also allow resolving the instance name that way.

That, or you could use the new qemu driver, but that doesn't support --network yet, if you need it.

@haim-ari
Copy link

@haim-ari right, this recipe worked for a single interface case. On VirtualBox you get the extra interface, but <instance>.local points at the default 10.0.2.15 IP, which is VirtualBox-internal :/

Not sure if/how you can convince systemd-resolved to announce the other IP, and announce over the external interface.

But! Since your external IP is given by your router, did you try ping ant-server in the first place? Or ping ant-server.<your-router-domain>? The router giving out the IP over DHCP should also allow resolving the instance name that way.

That, or you could use the new qemu driver, but that doesn't support --network yet, if you need it.

@Saviq

ping ant-server does not work.
There is no "router-domain"
--network is needed.

@Saviq
Copy link
Collaborator Author

Saviq commented Jan 21, 2022

@haim-ari you could change your router configuration to resolve client hostnames. Otherwise you'd need to dig into systemd-resolved settings to expose the right IP on the external interface.

@haim-ari
Copy link

@Saviq
As mentioned, the workaround is not relevant for macOS and this issue is not duplicate.
solution for macOS + VirtualBox + multipass to resolve the launched instance ip by the instance name (with/without domain) is still required.

@Saviq
Copy link
Collaborator Author

Saviq commented Jan 21, 2022

@haim-ari this issue was about hyperkit, actually, and the other is just an umbrella one, is all - as we need to solve it across the board.

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

No branches or pull requests

6 participants