Hello, it's possible to stop the dns setting in RedHat and friends
(Centos/fedora/OL), but as you have found in ubuntu is not easy. I havent
been able to find something that works

in RH is easy as adding "PEERDNS=no" to the nic that you want to stop from
grabing the dns over dhcp.

A provision script can be like this:

$conf = <<-EOF

cat > /etc/resolv.conf <<EOF2

search yourdomain.tld

nameserver 192.168.1.1

EOF2

EOF

  #resolv.conf and hosts

  config.vm.provision "shell", inline: $conf, run: "always"


Alvaro.

On Sat, Feb 13, 2016 at 4:07 AM, <[email protected]> wrote:

> I use ubuntu/trusty64 now.
>
> By default dhclient.conf contains:
>
> request subnet-mask, broadcast-address, time-offset, routers,
>         domain-name, domain-name-servers, domain-search, host-name,
>         dhcp6.name-servers, dhcp6.domain-search,
>         netbios-name-servers, netbios-scope, interface-mtu,
>         rfc3442-classless-static-routes, ntp-servers,
>         dhcp6.fqdn, dhcp6.sntp-servers;
>
> When changed to:
>
> request subnet-mask, broadcast-address, time-offset, routers,
>         host-name, netbios-name-servers, netbios-scope,
>         interface-mtu, rfc3442-classless-static-routes,
>         ntp-servers, dhcp6.fqdn, dhcp6.sntp-servers;
>
> and machine restarted nameserver on eth0 gets populated into resolv.conf.
>
>
> The second problem is when I surround this section with:
>
> interface "eth0" {
>         request subnet-mask, broadcast-address, time-offset, routers,
>                 domain-name, domain-name-servers, domain-search, host-name
> ,
>                 dhcp6.name-servers, dhcp6.domain-search,
>                 netbios-name-servers, netbios-scope, interface-mtu,
>                 rfc3442-classless-static-routes, ntp-servers,
>                 dhcp6.fqdn, dhcp6.sntp-servers;
> }
>
> Vagrant freezes on restart.
>
>
> Yes, I actually have no other choice but to provision each time, but I was
> interested in a more canonical solution.
>
> --tr
>
> On Friday, February 12, 2016 at 6:01:24 PM UTC+9, Alvaro Miranda Aguilera
> wrote:
>>
>> Hello,
>>
>> eth0 use dhcp to get the IP, and dhcp provide the dns information.
>>
>> on my experience, is easier you use a shell provisioner script to
>> override the dns settings and lets things go default.
>>
>> What's the os for the guest?
>>
>> with vagrant, you can have `run: "always"` to run the provisioner all the
>> time.
>>
>> Alvaro.
>>
>> On Thu, Feb 11, 2016 at 4:47 PM, <[email protected]> wrote:
>>
>>> I've been trying to prevent dhclient from getting nameserver settings on
>>> eth0 interface.
>>>
>>> I could supersede DNS settings with a static nameserver.
>>>
>>> I could change settings for eth1 by adding interface "eth1" { ...
>>> } section to dhclient.conf
>>>
>>>
>>> I found however problems with setting the eth0 interface:
>>>
>>>    1. The first problem is that removing domain-name and
>>>    domain-name-servers has no effect, it still gets the values from
>>>    DHCP.
>>>    2. The second problem is that adding a interface "eth1" { ... } section
>>>    to the dhclient.conf causes Vagrant machine to freeze on reboot at
>>>    this moment:
>>>
>>> ==> client: Configuring and enabling network interfaces...
>>>
>>> What can I do to stop dhclient from supplying Vagrant's DHCP settings to
>>> resolvconf, while retaining this for other interfaces than eth0?
>>>
>>> --
>>> This mailing list is governed under the HashiCorp Community Guidelines -
>>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>>> violation of those guidelines may result in your removal from this mailing
>>> list.
>>>
>>> GitHub Issues: https://github.com/mitchellh/vagrant/issues
>>> IRC: #vagrant on Freenode
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Vagrant" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/vagrant-up/82cc2aa1-53c2-4f20-8a34-bc861ad3d090%40googlegroups.com
>>> <https://groups.google.com/d/msgid/vagrant-up/82cc2aa1-53c2-4f20-8a34-bc861ad3d090%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/bcc71752-c364-4d7d-a84e-6ca01f6c1479%40googlegroups.com
> <https://groups.google.com/d/msgid/vagrant-up/bcc71752-c364-4d7d-a84e-6ca01f6c1479%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CAHqq0eycQfxXk9Ty1gC8oQ3S6iB5Fw2DyU4JUWj63TJ76Ui5PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to