In my Vagrantfile I have:
config.vm.provision "shell", path: "gateway.sh", run:
"always"
where gateway.sh contains:
route del default gw 10.0.2.2
route add default gw 10.164.28.1 eth
Obviously you need to use the correct IP in the second command. If you're
building boxes that need to work in different offices you might want to put
some smarts into gateway.sh so it picks the right gateway IP to match the
allocated address for eth1
Mike
On Wed, Sep 24, 2014 at 5:01 AM, Alvaro Miranda Aguilera <[email protected]>
wrote:
> What's the Guest OS ?
>
> On Wed, Sep 24, 2014 at 2:38 PM, <[email protected]> wrote:
>
>> Thanks Alvaro. That works.
>>
>> I ended up running the following in the guest:
>> $ sudo *route* add default gw 10.1.10.1
>> $ sudo *route* del default gw 10.0.2.2
>> $ route -n
>>
>> Kernel IP routing table
>>
>> Destination Gateway Genmask Flags Metric Ref Use
>> Iface
>>
>> 0.0.0.0 10.1.10.1 0.0.0.0 UG 0 0 0
>> eth1
>>
>> 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0
>> eth0
>>
>> 10.1.10.0 0.0.0.0 255.255.255.0 U 0 0 0
>> eth1
>>
>>
>> The next question is how to get this setup sticky. I've read
>> https://github.com/mitchellh/vagrant/issues/2389 Still not sure what's
>> the best way to go
>>
>> Any tips on setting up init or rc.local with provisioning?
>>
>>
>> Regards,
>> S
>>
>> On Monday, September 22, 2014 7:42:58 PM UTC-4, Alvaro Miranda Aguilera
>> wrote:
>>>
>>> yeah, for the 2nd part the issue is the default gw is always on the nat
>>> network, so the real ip/traffic is nto being routed.
>>>
>>> a hack could be put into a init script or /etc/rc.local if exists
>>> something manual.
>>>
>>> check this post for ideas:
>>>
>>> http://enginx.com/blog/vagrant-networking-enable-
>>> internet-accessible-machine-setup/
>>>
>>> hope this helps.
>>>
>>>
>>> On Tue, Sep 23, 2014 at 4:25 AM, <[email protected]> wrote:
>>>
>>>> I tried to forward wan traffic directly to the host. ie:
>>>>
>>>> *router*: forward TCP port 80 to host 10.1.10.25:8080
>>>>
>>>> *vagrant*:
>>>>
>>>> Vagrant.configure("2") do |config|
>>>> config.vm.network "forwarded_port", guest: 80, host: 8080
>>>> end
>>>>
>>>> http traffic is being served, but still logging host ip as real ip.
>>>>
>>>>
>>>> I also tried setting vagrant as public network, but for some reason it is
>>>> not responding to traffic from internet.
>>>>
>>>> *router:* forward TCP port 80 to 10.1.10.36:80
>>>> *Vagrant:*
>>>> Vagrant.configure("2") do |config|
>>>> config.vm.network "public_network", ip: "10.1.10.36"
>>>> end
>>>>
>>>> http request from host or another computer on the local network are
>>>> being served with their IP as real IP, but external (internet) traffic did
>>>> wasn't served.
>>>>
>>>> Any thoughts?
>>>>
>>>>
>>>>
>>>> On Wednesday, September 17, 2014 11:51:35 PM UTC-4, Alvaro Miranda
>>>> Aguilera wrote:
>>>>>
>>>>> Not sure if will work but you can test without that pfctl part.
>>>>>
>>>>> - wan -> port 8080
>>>>>
>>>>> or
>>>>>
>>>>> guest 80 to host 80
>>>>>
>>>>> if none of those works, then you could look into assign an ip of the
>>>>> network and use public/bridge networking.
>>>>>
>>>>> Alvaro.
>>>>>
>>>>> On Thu, Sep 18, 2014 at 3:36 PM, <[email protected]> wrote:
>>>>>
>>>>>> Is it possible to collect the real ip of the visitor address when the
>>>>>> vagrant box is configured as follow:
>>>>>> I have a vagrant box setup without private or public network. (I
>>>>>> guess this is host-only network?)
>>>>>> nginx is running on port 80 which is forwarded to 8080 on the host.
>>>>>> At the host, I have pfctl forward port 80 to 8080.
>>>>>> I have the router to forward port 80 on the wan port to port 80 on
>>>>>> the host.
>>>>>> External visitor can see the website (nginx), but the ip that's being
>>>>>> logged is not the real ip address of the visitor.
>>>>>>
>>>>>> cheers,
>>>>>>
>>>>>> --
>>>>>> 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.
>>
>
> --
> 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.