Difference between revisions of "Static external IP address"
From MyWiki
(Created page with "<source lang="bash"? # -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <source lang="bash" | + | <source lang="bash"> |
# -*- mode: ruby -*- | # -*- mode: ruby -*- | ||
# vi: set ft=ruby : | # vi: set ft=ruby : | ||
− | |||
− | |||
− | |||
− | |||
Vagrant.configure("2") do |config| | Vagrant.configure("2") do |config| | ||
− | |||
− | |||
− | |||
− | |||
− | |||
config.vm.box = "almalinux/9" | config.vm.box = "almalinux/9" | ||
− | |||
− | |||
− | |||
− | |||
− | |||
# Create a forwarded port mapping which allows access to a specific port | # Create a forwarded port mapping which allows access to a specific port | ||
Line 25: | Line 11: | ||
# accessing "localhost:8080" will access port 80 on the guest machine. | # accessing "localhost:8080" will access port 80 on the guest machine. | ||
# NOTE: This will enable public access to the opened port | # NOTE: This will enable public access to the opened port | ||
− | + | config.vm.network "forwarded_port", guest: 22, host:222 # Lets try this | |
# Create a forwarded port mapping which allows access to a specific port | # Create a forwarded port mapping which allows access to a specific port |
Latest revision as of 15:48, 8 February 2024
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "almalinux/9" # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port config.vm.network "forwarded_port", guest: 22, host:222 # Lets try this # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine and only allow access # via 127.0.0.1 to disable public access # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" # Create a private network, which allows host-only access to the machine # using a specific IP. # config.vm.network "private_network", ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network "public_network" # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # # config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: # vb.memory = "1024" # end # # View the documentation for the provider you are using for more # information on available options. # Enable provisioning with a shell script. Additional provisioners such as # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the # documentation for more information about their specific syntax and use. # config.vm.provision "shell", inline: <<-SHELL # apt-get update # apt-get install -y apache2 # SHELL end