Hello

I personally don't know how to change the dns being used by
dhcp/virtualbox, and that came from the nat/dhcp combo, so I have


ugly way that works:

you can use a shell provisioner to overwrite that file,


$resolv = <<SCRIPT
cat /etc/resolv.conf <<EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
search <some_local_domain> <some_other_local_domain>
EOF
SCRIPT


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

That will run always that on first run, and any up/reload.



not-so ugly way:

Virtualbox with NAT, will overwrite that file, so you need to add
PEERDNS=no to /etc/sysconfig/network-scripts/ifcfg-eth0 if using any
redhat/centos/etc os
then you can use

$resolv = <<SCRIPT
grep PEERDNS /etc/sysconfig/network-scripts/ifcfg-eth0 || echo
'PEERDNS=no' >> /etc/sysconfig/network-scripts/ifcfg-eth0
cat /etc/resolv.conf <<EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
search <some_local_domain> <some_other_local_domain>
EOF
SCRIPT


  config.vm.provision "shell", inline: $resolv


note on this one, there is no run: "always" and there is an extra line
on top of the script

in this way, it will run only on initia provision, but the file won't
be overwritten

if you are on a non-redhat OS, like ubuntu, then I am afraid I don't
know how to avoid the resolv.conf being overwritten


On Thu, Jun 18, 2015 at 1:20 AM, Andrew Cafourek
<[email protected]> wrote:
> Thanks for the tip!  If I manually edit  /etc/resolv.conf to use 8.8.8.8 the
> curl request to AWS works perfectly.
>
> However, that file has a big warning that any changes will be overwritten.
> Is there a setting I can apply in my Vagrantfile to specify the nameserver
> to use?
>
> (I had previously included this to use the host DNS, but doesn't seem to be
> helping much)
> v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
>
> Thanks
>
> On Tuesday, June 16, 2015 at 9:41:12 PM UTC-4, Alvaro Miranda Aguilera
> wrote:
>>
>> Can you test overriding the /etc/resolv.conf information?
>>
>> You can put the dns server of your network, your isp if at home, or
>> 8.8.8.8 / 8.8.4.4 (google's one)
>>
>> The usual way of working in Virtualbox is the guest vm, will nat to
>> the host and that will ask the normal dns.
>>
>> Time by time this doesn't work properly.
>>
>> Alvaro.
>>
>>
>> On Wed, Jun 17, 2015 at 10:21 AM, Andrew Cafourek
>> <[email protected]> wrote:
>> > I am using the AWS PHP SDK to interface with a CloudSearch instance and
>> > it
>> > appears to work fine on my production and staging servers, but I am
>> > continually getting Guzzle/cURL errors in my local environment (using
>> > VVV of
>> > local WordPress development in vagrant). For each request I see this
>> > error
>> >
>> > Uncaught exception 'Guzzle\Http\Exception\CurlException' with message
>> > '[curl] 6: Could not resolve host:
>> >
>> > search-localalumnispacesv2-ytnhdpo4wvr56v66sfdkwmk5lu.us-east-1.cloudsearch.amazonaws.com
>> >
>> > When I error log $e->getMessage(), I can see the url it is using to call
>> > the
>> > AWS APIs and when I test that url via the browser directly, through HTTP
>> > test apps or with cURL directly in command line (on my host machine),
>> > I'm
>> > able to get a response without any problem. This leads me to believe
>> > that
>> > the actual request is fine and the url's host is valid.
>> >
>> > I can reproduce the problem when I ssh into the virtual vagrant box and
>> > do a
>> > cURL command for the url, leading me to believe that the issue is
>> > isolated
>> > to requests made from within my vagrant box.
>> >
>> > Any ideas for what might be causing it not to resolve within vagrant?
>> > Other
>> > hosts (google.com, etc) seem to be working fine.
>> >
>> > --
>> > 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].
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to