[ICN-281] Vagrant vm can not get correct name server in ubuntu-1804. Created: 24/Feb/20  Updated: 17/Dec/20  Resolved: 25/Feb/20

Status: Done
Project: Integrated Cloud Native NFV
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Le Yao Assignee: Le Yao
Resolution: Done Votes: 0
Labels: icn-kud-r3
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Bare metal with Ubuntu-18.04-server behind a NAT


Issue Links:
Blocks
blocks ICN-260 KUD Multi Vagrant 18.04 issue Done
Sprint: ICN Sprint 12

 Description   

Wrong name server causes that vagrant vm cannot running correctly.
systemd-resolved will set the nameserver to 127.0.0.53, which will not work correctly.
It happened when your bare metal works behind a NAT and the vm image is 18.04+.



 Comments   
Comment by Le Yao [ 26/Feb/20 ]

Get it, but these two solution can not work with 'vagrant up installer'.
The vm Installer uses nfs type to set synced_folder and the vm will install nfs client before the vm.provision shell scripts runs. That's to say the vm still use the wrong nameserver 127.0.0.53.

Comment by Akhila Kishore [ 26/Feb/20 ]

The issue is with VM's to be created during Vagrant up or Vagrant up installer

Solution 1:
#!/bin/bashset -e
echo "nameserver %{NATIP}" >> /etc/resolv.conf
Solution 2: Could be https://gerrit.onap.org/r/c/multicloud/k8s/+/99540/2/kud/hosting_providers/vagrant/node.sh#87 adding this information inside Vagrantfile (https://github.com/onap/multicloud-k8s/blob/master/kud/hosting_providers/vagrant/Vagrantfile) instead of node.sh. 

r.kuralamudhan: The broader question should be why aren't the 18.04 VMs getting created properly in my opinion. Solution 1 & 2 could be a potential fix. However, this could be perceived as hardcoding the values inside the VM rather than debugging why aren't the VMs getting created fine with the correct nameserver information in the first place.

Comment by Le Yao [ 26/Feb/20 ]

Another patch may fix the issues:
https://gerrit.onap.org/r/c/multicloud/k8s/+/99540/2/kud/hosting_providers/vagrant/node.sh#87

Comment by Le Yao [ 25/Feb/20 ]

To solve it, you can add a shell script to Vagrantfile to set the name server manually.

#!/bin/bash
set -e
echo "nameserver %{NATIP}" >> /etc/resolv.conf

Comment by Le Yao [ 25/Feb/20 ]

Some of the errors it caused:
Stderr from the command:

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'us.archive.ubuntu.c om'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'us.archive. ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'us.archiv e.ubuntu.com'

Generated at Sat Feb 10 05:58:40 UTC 2024 using Jira 9.4.5#940005-sha1:e3094934eac4fd8653cf39da58f39364fb9cc7c1.