Title: Networking
Author: WordPress VIP Documentation
Published: November 4, 2021
Last modified: April 3, 2025

---

 1. [VIP Local Development Environment](https://docs.wpvip.com/vip-local-development-environment/)
 2. Networking

#  Networking

The VIP Local Development Environment is composed of several Docker containers. 
Some of these containers bind host ports to be accessible from outside of their 
internal network.

The [`traefik` proxy container](https://hub.docker.com/_/traefik) is shared between
all local environments running on the host machine. This makes it possible to run
multiple `dev-env` instances simultaneously under different domains. Running multiple
local environments simultaneously requires each local environment to have a unique`--
slug` value. The slug value is assigned when the environment is created with [the `vip dev-env create` command](https://docs.wpvip.com/vip-cli/commands/dev-env/create/).

Unique domain names are created for each local environment with the following pattern:
`
<slug>.vipdev.lndo.site`

The `traefik` proxy container uses the full domain name to direct traffic to the
correct NGINX container in the internal Docker network.

For example, when a local environment’s domain (e.g. `http://example-env.vipdev.
lndo.site/`) is loaded in a browser, DNS resolution will find an A record for `*.
lndo.site` that maps to a `localhost`. That request will then hit the `traefik` 
proxy container which is bound to the localhost port `80`.

The `traefik` proxy container serves as a gateway to the local environment, and 
will try to bind port `80` and `443` to support `http` and `https` traffic. If those
ports are taken, backup ports will be used instead.

## Apply a custom domain

The default pattern for the domain names of a VIP Local Development Environment (
e.g. `example-env.vipdev.lndo.site`) can be overridden with a custom domain (e.g.`
example-env.example-domain.com`).

**Note**

Custom domains are applied globally and cannot be applied per-local environment.
When a custom domain is configured to apply to a local environment, it is applied
to _every_ VIP Local Development Environment on a user’s local machine as long as
the configuration in the Lando `config.yml` file exists. This can cause any previously
existing local environments to become unresponsive or unreachable.

Custom domains should be configured just prior to creating a local environment. 
In this example, the custom domain name `example-domain.com` is configured then 
a local environment with the slug `example-env` is created. This enables the local
environment to load at `example-env.example-domain.com`.

When following these instructions, substitute the values `example-domain.com` and`
example-env` where they appear with the values of the desired custom domain and 
environment slug.

 1. In the terminal of the user’s local machine, run the following command to create
    a Lando `config.yml` file and update it with the value of the custom domain:

    ```lang-shell
    mkdir -p ~/.local/share/vip/lando; echo "domain: example-domain.com" > ~/.local/share/vip/lando/config.yml
    ```

 2. Create a new environment with the slug value `example-env` by running the command:

    ```lang-shell
    vip dev-env create --slug=example-env
    ```

A warning message will appear below the environment’s information output:

    ```lang-shell
    WARNING: example-env.example-domain.com resolves to 76.223.84.192 instead of 127.0.0.1. Things may not work as expected.
    Please add the following lines to the hosts file on your system:

    127.0.0.1 example-env.example-domain.com
    ```

 3. [Update the hosts file](https://docs.wpvip.com/domains/managing-your-hosts-file/)
    of the local machine in a text editor. Add the values provided in the warning message
    to enable `example-domain.com` to resolve at the local IP address `127.0.0.1`:
    `
    127.0.0.1 example-env.example-domain.com`

If the phpMyAdmin or MailPit services are enabled for the environment, the warning
message will include instructions for updates to the hosts file that are necessary
for those services to be reachable with the applied custom domain. For example:

    ```lang-shell
    127.0.0.1 example-env-pma.example-domain.com
    127.0.0.1 example-env-mailpit.example-domain.com
    ```

## Port binding for services

To identify the exposed services that are running VIP Local Development Environment
and have a port mapped to the host machine, run [the `vip dev-env info` command](https://docs.wpvip.com/vip-cli/commands/dev-env/info/).

In this example output, the exposed services for the local environment with the 
slug `example-env` are `PHPMYADMIN` and `ENTERPRISE SEARCH`.

    ```lang-shell
    $ vip dev-env info --slug=example-env
     SLUG               example-env                                                                                    
     LOCATION           /home/example-user/.local/share/vip/dev-environment/example-env  
     SERVICES           devtools, nginx, php, database, memcached, phpmyadmin, elasticsearch, wordpress, vip-mu-plugins, app-code 
     NGINX URLS         http://example-env.vipdev.lndo.site/      
                        https://example-env.vipdev.lndo.site/  
     PHPMYADMIN URLS    http://localhost:49170  
     ENTERPRISE SEARCH  http://127.0.0.1:49168                                
     STATUS             UP               
    ```

The ports for these services are explicitly selected to avoid conflicting with any
other running local environment. For this reason, service ports might change between
restarts of an environment.

## Connect to the SQL database with a GUI application

To connect to the local SQL database, [phpMyAdmin](https://www.phpmyadmin.net/) 
can be optionally enabled for a local environment by passing `--phpmyadmin=y` with
[the `vip dev-env create` command ](https://docs.wpvip.com/vip-cli/commands/dev-env/update/)
or [the `vip dev-env update` command](https://docs.wpvip.com/vip-cli/commands/dev-env/start/).

It is also possible to configure an external GUI application (e.g. [TablePlus](https://tableplus.com/))
connect with the SQL database of a local environment.

The steps below outline the steps to connect a GUI application to a local environment
with the slug value `example-env`:

 1. Run the command `vip dev-env info --slug=example-env`.
 2. Reference the value for `LOCATION` in the command output. It will be similar to`/
    home/example-user/.local/share/vip/dev-environment/example-env`.
 3. Locate the `example-env` directory on the local machine by following the path provided
    by the `LOCATION` value.
 4. Create a new file in the `example-env` directory named `.lando.local.yml`. A `.
    lando.yml` should already exist in the `example-env` directory.
 5. Open `.lando.local.yml` in a file editor and add the following content:

    ```lang-yml
    services:
      database:
        type: compose
        services:
          ports:
            - "13306:3306"
    ```

 6. Save the updates made to `.lando.local.yml`.
 7. In the terminal, restart the local environment by running the command:

    ```lang-shell
    vip dev-env start --slug=example-env
    ```

 8.  Configure the GUI application to connect to the updated and restarted local environment
     with the values:
 9.   * **Username:** `wordpress`
      * **Password:** `wordpress`
      * **Host:** `127.0.0.1` (Do not use `localhost`.)
      * **Port:** `13306` (This is the value that was assigned to `ports:` in `.lando.
        local.yml`. In this example `13306` was added, but an arbitrary value can be
        added as long as it is unique. The value assigned to the port cannot currently
        be in use on the host for any other services on any other environments.)

Last updated: April 03, 2025