A
A
Anton Shvets2016-02-09 10:22:04
linux
Anton Shvets, 2016-02-09 10:22:04

Vagrant and port forwarding. How to setup?

ubuntu server 15.10
You need to install zimbra or another service that provides mail and a collaboration organizer.
zimbra showed a segmentation fault during installation. I decided to
use vm ubuntu server
14.04lts

default: 8080 => 8080 (adapter 1)
    default: 80 => 8777 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key

The following is in the config
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 80, host: 8777
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.network "public_network"

$ cat /etc/sysctl.conf | grep forward
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
#net.ipv6.conf.all.forwarding=1

Question.
There is access from the host system.
But from the outside, an attempt to enter
ssh mydomen.local -p 2222
Or a call to Apache in the vagrant mydomen.local:8777 ( -> port 80)
Or to a node on port 8080 - does not work.
It is possible, in theory, to set up forwarding in iptables, but vagrant provides this feature, how to use it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Novikov, 2016-02-09
@Xuxicheta

It is clear that there will be no access from the outside. But if you really need to, use vagrant share .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question