# Creating a second public edge router

**URL:** <https://openziti.discourse.group/t/creating-a-second-public-edge-router/539>\
**Category:** Ziti Overlay\
**Created:** [June 1, 2022, 1:13am UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539 "2022-06-01T01:13:56Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [June 6, 2022, 11:31am UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/21 "2022-06-06T11:31:58Z")

</div>

> [@markamind](#):
>
> advertise: tls:instance-20220416-1603:10080

You need to change this on both routers. That's the address that OTHER routers will connect to your router over. You'll then subsequently have to open that port in your firewall for where you setup the quickstart. The advertise setting is what you want/need to change. make it:

```auto
tls:${external_address_of_link_listener_router}:10080

```

(or whatever port you choose)

---

<div class="post-metadata">

**Author:** ![plorenz](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/plorenz/32/54_2.png) [@plorenz](https://openziti.discourse.group/u/plorenz)\
**Post date:** [June 6, 2022, 1:58pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/22 "2022-06-06T13:58:02Z")

</div>

> [@markamind](#):
>
> I am working through this over the weekend… and though to ask… what are the benefits by making a router tunneller enabled?

Want to expand on this a bit. As @TheLumberjack said, if you're app embedded, there's no need for the router-embedded tunneler because you don't need a tunneler at all. However, if you're going to run a tunneler, there are some advantages to using the router-embedded tunneler, specifically on the hosting side. The benefits are mostly around simplifying deployments.

You generally want/need one or more routers in your hosting site. If you use the embedded tunneling functionality, you don't need an extra tunneler running externally. You also bring the fabric one hop closer to the hosting server. Because of that, it's also likely to be the most performant option (though as with anything, testing to get actual performance numbers is a good idea).

In terms of functionality on the hosting side, anything you should be able to do with one, you should be able to do with the other.

For client side, ziti-edge-tunnel (or any of the desktop edge or mobile edge components) is recommended because the router is a relatively heavy component. On the hosting side it's not an issue because you will generally have routers sitting next to your server components anyway.

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [June 7, 2022, 1:45am UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/23 "2022-06-07T01:45:17Z")

</div>

Thanks for the further details.. this is very helpful

PS\>\> I have it now working with a few more tweaks

opc 87899 1 0 Jun05 ? 00:00:28 /home/opc/. **ziti** /quickstart/instance-20220416-1603/ **ziti** -bin/ **ziti** -v0.25.4/ **ziti** -router run /home/opc/ **ziti** /quickstart/instance-20220416-1603 **/instance-20220416-1603-edge-router.yaml**

opc 607469 606163 4 01:39 pts/1 00:00:02 /home/opc/. **ziti** /quickstart/instance-20220416-1603/ **ziti** -bin/ **ziti** -v0.25.4/ **ziti** -router run /home/opc/ **ziti** /quickstart/instance-20220416-1603/ **instance-20220416-1603-2nd-edge-router.yaml**

> > I needed to change the port for bot the link and edge binding and advertise sections..

link:  
dialers:  
- binding: transport  
listeners:  
- binding: transport  
bind: **tls:0.0.0.0:10081**  
advertise: **tls:instance-20220416-1603:10081**  
options:  
outQueueSize: 4

listeners:

# bindings of edge and tunnel requires an "edge" section below

- binding: edge  
address: **tls:0.0.0.0:8443**  
options:  
advertise: **IP address of the server:8443**  
connectTimeoutMs: 1000  
getSessionTimeout: 60s
- binding: tunnel  
options:  
mode: host #tproxy|host

---

<div class="post-metadata">

**Author:** ![dmuensterer](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/dmuensterer/32/2451_2.png) [@dmuensterer](https://openziti.discourse.group/u/dmuensterer)\
**Post date:** [July 19, 2023, 7:55pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/24 "2023-07-19T19:55:33Z")

</div>

This was very helpful but unfortunately I’m getting an error while enrolling the JWT I’ve created in ZAC. I’ve created a default config using:

```auto
./ziti create config router edge --routerName zt-router-1 -o /home/ziti/zt-edge-router.yaml

```

What does `erott` mean? Is there anything else I need to keep in mind while enrolling another router?

```auto
ziti@zt-router-1:~$ ./ziti-bin/ziti-v0.29.0/ziti edge enroll /home/ziti/zt-router-1.jwt
INFO generating 4096 bit RSA key
Usage:
  ziti edge enroll path/to/jwt [flags]

Flags:
      --ca string Additional trusted certificates
  -c, --cert string The certificate to present when establishing a connection.
  -h, --help help for enroll
  -n, --idname string Names the identity. Ignored if not 3rd party auto enrollment
  -j, --jwt string Enrollment token (JWT file). Required
  -k, --key string The key to use with the certificate. Optionally specify the engine to use. supported engines: [parsec]
  -a, --keyAlg RSA|EC Crypto algorithm to use when generating private key (default RSA)
  -o, --out string Output configuration file.
  -p, --password string Password for updb enrollment, prompted if not provided and necessary
      --rm Remove the JWT on success
  -u, --username string Username for updb enrollment, prompted if not provided and necessary
  -v, --verbose Enable verbose logging

failed to enroll: enrollment method 'erott' is not supported

```

---

<div class="post-metadata">

**Author:** ![gberl002](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/gberl002/32/333_2.png) [@gberl002](https://openziti.discourse.group/u/gberl002)\
**Post date:** [July 19, 2023, 8:23pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/25 "2023-07-19T20:23:28Z")

</div>

@dmuensterer there are some minor mistakes in your command, mainly that `ziti edge enroll` is used for enrolling an identity, you would want `ziti router enroll`. But, aside from that, as mentioned in the beginning, this isn’t well documented, and since quickstart was recently refactored, it’d be good to come up with a set of steps for this until we get it officially in the doc.

Assuming this is on a different VPS/machine and you’re using the latest ziti (which you are), I would do the following.

_ **EDIT \<** _ I should mention, you’ll want to run `ziti edge delete edge-router zt-router-1` so the following doesn’t collide with the router you already tried creating _ **\> END EDIT** _

1. Set the following variables appropriately based on your network, referring to the .env file of your network would be useful for any non-router values. I filled some of them in for you

```auto
export ZITI_HOME=/home/ziti/
export ZITI_ROUTER_NAME=zt-router-1
export ZITI_ROUTER_ADVERTISED_HOST=
export ZITI_BIN_DIR=./ziti-bin/ziti-v0.29.0
export ZITI_USER=admin
export ZITI_PWD=
export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=
export ZITI_CTRL_EDGE_ADVERTISED_PORT=
export ZITI_CTRL_ADVERTISED_ADDRESS=
export ZITI_CTRL_ADVERTISED_PORT=

```

1. Run the `ziti-cli-functions.sh`’s Add Router function. Source the CLI script if you haven’t already.

```auto
source /dev/stdin <<< "$(wget -qO- https://get.openziti.io/quick/ziti-cli-functions.sh)"

```

This example will create an edge router (public) with the attribute `public`, the attribute is the fourth param so you can remove/edit it how you want. It will create the config, enroll the router, etc and place all of the files and logs in `ZITI_HOME` as set above.

```auto
addRouter "${ZITI_ROUTER_NAME}" public public

```

1. Start up your router, also using a provided function from `ziti-cli-functions.sh`

```auto
startRouter

```

That should be everything, double check using `ziti edge list edge-routers` to be sure it’s showing “online”.

Let me know how this goes.

---

<div class="post-metadata">

**Author:** ![dmuensterer](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/dmuensterer/32/2451_2.png) [@dmuensterer](https://openziti.discourse.group/u/dmuensterer)\
**Post date:** [July 19, 2023, 9:48pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/26 "2023-07-19T21:48:06Z")

</div>

Thanks for the help! Unfortunately I couldn’t do the `addRouter` part because the management API isn’t publicly accessible…  
Instead what I did is

```auto
ziti@zt-router-1:~/ziti-bin/ziti-v0.29.0$ ./ziti router enroll /home/ziti/zt-edge-router.yaml --jwt /home/ziti/zt-router-1.jwt
[1.442] INFO edge/router/enroll.(*RestEnroller).Enroll: registration complete
ziti@zt-router-1:~/ziti-bin/ziti-v0.29.0$ startRouter
[1] 1987
Express Edge Router started as process id: 1987. log located at: /home/ziti/zt-router-1.log

```

which worked…

However, I didn’t get positive feedback while trying to list the edge-routers:

```auto
ziti@zt-router-1:~/ziti-bin/ziti-v0.29.0$ ./ziti edge list edge-routers
error: no identity 'default' found in cli config /home/ziti/.config/ziti/ziti-cli.json
[1]+ Exit 2 "${ZITI_BIN_DIR}/ziti" router run "${ZITI_HOME}/${ZITI_ROUTER_NAME}.yaml" > "${log_file}" 2>&1

```

Also, the certificates are obviously not there yet… I assume they were somehow generated automatically while enrolling the JWT? But where?

```auto
ziti@zt-router-1:~$ cat zt-edge-router.yaml
v: 3

identity:
  cert: "/home/ziti/ziti-bin/ziti-v0.29.0/zt-router-1.cert"
  server_cert: "/home/ziti/ziti-bin/ziti-v0.29.0/zt-router-1.server.chain.cert"
  key: "/home/ziti/ziti-bin/ziti-v0.29.0/zt-router-1.key"
  ca: "/home/ziti/ziti-bin/ziti-v0.29.0/zt-router-1.cas"
  #alt_server_certs:
  # - server_cert: ""
  # server_key: ""

etc...

```

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [July 19, 2023, 9:52pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/27 "2023-07-19T21:52:06Z")

</div>

> [@dmuensterer](#):
>
> However, I didn’t get positive feedback while trying to list the edge-routers:

Sadly you cut off "the most important" part of your router config... the very next line is what I wanted to see.

```auto
ctrl:
  endpoint: tls:ip-172-31-47-200:8440

```

I expect that endpoint is either "wrong" (wrong address) or the webacl doesn't allow port 8440 through.

> [@dmuensterer](#):
>
> Also, the certificates are obviously not there yet… I assume they were somehow generated automatically while enrolling the JWT?

Since you are more secure, and you have taken the management API offline you should follow a slightly different set of steps. You should:

- create the router using the `ziti` CLI and output the .jwt file.
- transfer the \*.jwt file to the "external/other/second" router
- run `ziti router enroll` on the router

The certificates will be generated when you successfully enroll. So my guess is you enrolled the router on your controller?

---

<div class="post-metadata">

**Author:** ![dmuensterer](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/dmuensterer/32/2451_2.png) [@dmuensterer](https://openziti.discourse.group/u/dmuensterer)\
**Post date:** [July 19, 2023, 10:10pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/28 "2023-07-19T22:10:10Z")

</div>

Aha, it works! - I put the router hostname in the ctrl section by mistake!

I really appreciate the help throghout the last couple of days regarding all the different issues we had! 🙂

Just to confirm:  
Are the certificates put automatically to the filepaths which are defined in the YAML file while enrolling? They are there, I just want to understand what the direction is here:

1. The YAML file defines where the cert files are being put while enrolling?  
**OR**
2. While enrolling, the cert files are stored in the current dir and referenced in the YAML afterwards?

Could you please quickly confirm what the different ports are doing and do they have to be open?

```auto
ctrl:
  endpoint: tls:zt.mydomain..com:6262

link:
  dialers:
    - binding: transport
  listeners:
    - binding: transport
      bind: tls:0.0.0.0:10080
      advertise: tls:zt-router-1.mydomain.com:10080
      options:
        outQueueSize: 4

```

6262 is probably the communication between router and controller?  
10080 says transport… do the `ziti-edge-tunnelers` have to communicate to port 10080? I assume not, but why?

I hope I didn’t miss any docs where this is explained but couldn’t find one … 🙂

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [July 19, 2023, 10:21pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/29 "2023-07-19T22:21:08Z")

</div>

> [@dmuensterer](#):
>
> Are the certificates put automatically to the filepaths which are defined in the YAML file while enrolling?

Yes. The act of enrolling **writes** those files. You specify where you want them **before** enrolling in the router config, then enroll and they get written out.

> [@dmuensterer](#):
>
> Could you please quickly confirm what the different ports are doing and do they have to be open?

Also documented here (but I see I want to update that info a wee bit): [Host OpenZiti Anywhere | NetFoundry Documentation](https://openziti.io/docs/learn/quickstarts/network/hosted/#firewall)

- `8440/tcp`: Edge Controller providing router control plane
- `8441/tcp`: Edge Controller providing client sessions
- `8442/tcp`: Edge Router providing client connections
- `8443/tcp`: Ziti Admin Console (ZAC) [optional]

And here: [Router Configuration Reference | NetFoundry Documentation](https://openziti.io/docs/reference/configuration/router)

### ctrl.endpoint

`ctrl.endpoint` is the address of the control plane. This points to your controller's port. If you followed the host it anywhere quickstart, 6262 ==\> 8440 on the controller (or in the controller config file the `ctrl.listener` value. mine right now is set to tls:0.0.0.0:8440 for example)

### link.listeners.bind

this section is for router to router configuration. with this configuration you are stating "hello OpenZiti overlay. I am an edge router that other edge routers should connect to". If you intend this to be a "public" edge router -- one that other routers should link **to**. Then this is fine and you will want to have port 10080 open on this router.

However, if this is a 'private' edge router (one that you're using to provide reach into a private VPC for example) you would turn that whole section off by commenting it out/removing it. In fact if you run that `ziti create config` command with `--private` you'll see what i mean. A "private" edge router is one that will only dial outbound links to other routers, but won't advertise a 'link listener':

```auto
ziti create config router edge --private --routerName test | grep -A10 "link\:"
link:
  dialers:
    - binding: transport
# listeners:
# - binding: transport
# bind: tls:0.0.0.0:10080
# advertise: tls:sg3u22:10080
# options:
# outQueueSize: 4

```

Hope that helps

---

<div class="post-metadata">

**Author:** ![dmuensterer](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/dmuensterer/32/2451_2.png) [@dmuensterer](https://openziti.discourse.group/u/dmuensterer)\
**Post date:** [July 20, 2023, 12:12pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/30 "2023-07-20T12:12:29Z")

</div>

> [@TheLumberjack](#):
>
> Hope that helps

It absolutely did make things very clear. Thank you!

---

<div class="post-metadata">

**Author:** ![rickwang7712](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/rickwang7712/32/1706_2.png) [@rickwang7712](https://openziti.discourse.group/u/rickwang7712)\
**Post date:** [June 18, 2024, 8:22am UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/31 "2024-06-18T08:22:08Z")

</div>

Hi @TheLumberjack ,

I'm also getting stuck at creating a new public edge router here.  
My controller and 1st router was deployed at PC-A by quickstart script; and I would like to deploy another router on PC-B.

I followed the [Guide/Deployments/Docker/Router/Deploy the Router with Docker](https://openziti.io/docs/guides/deployments/docker/router) and I got flooded by following log:

```auto
ziti-router-1 | [4.607] ERROR ziti/router/env.(*networkControllers).connectToControllerWithBackoff.func2: {endpoint=[tls:ctrl-perf.test.inc:1280] error=[error connecting ctrl (remote error: tls: internal error)]} unable to connect controller

```

ctrl-perf.test.inc:1280 is my ${ZITI\_CTRL\_EDGE\_ADVERTISED\_ADDRESS}:${ZITI\_CTRL\_EDGE\_ADVERTISED\_PORT} configured in .env for the controller's quickstart deployment.

I guess this is the certification error because ctrl-perf.test.inc:1280 replied a NetFoundry self-signed certificate.

May I ask how to solve this properly?  
Even I set ZITI\_PKI\_ALT\_SERVER\_CERT & ZITI\_PKI\_ALT\_SERVER\_KEY in controller's env, controller still replies the self signed certificate.  
But my zac is exported at ctrl-perf.test.inc:8443, and it successfully replies the certificate I configured:

```auto
      - ZAC_SERVER_CERT_CHAIN=${ZITI_PKI_ALT_SERVER_CERT:-}
      - ZAC_SERVER_KEY=${ZITI_PKI_ALT_SERVER_KEY:-}

```

Thanks!

Update:  
I finally nailed it!

I used the commands I saw in run-router.sh, and used an additional downloaded ziti binary to deploy my 2nd router:

```auto
ZITI_HOME=./ ../ziti-bins/ziti edge create edge-router router2 -o router2.jwt -t -a "public"
ZITI_HOME=./ ../ziti-bins/ziti router enroll router2.yaml --jwt router2.jwt 
ZITI_HOME=./ ../ziti-bins/ziti router run ./router2.yaml

```

And then modified the paths in router2.yaml to run in docker-compose.yml

```auto
services:
  ziti-edge-router:
    user: "1000"
    image: "${ZITI_IMAGE}:${ZITI_VERSION}"
    env_file:
      - ./.env
    ports:
      - ${ZITI_INTERFACE:-0.0.0.0}:${ZITI_ROUTER_PORT:-3022}:${ZITI_ROUTER_PORT:-3022}
      - ${ZITI_INTERFACE:-0.0.0.0}:${ZITI_ROUTER_WSS_PORT:-3023}:${ZITI_ROUTER_WSS_PORT:-3023}
      - ${ZITI_INTERFACE:-0.0.0.0}:${ZITI_ROUTER_LISTENER_BIND_PORT:-10080}:${ZITI_ROUTER_LISTENER_BIND_PORT:-10080}
    environment:
      - ZITI_CTRL_ADVERTISED_ADDRESS=${ZITI_CTRL_ADVERTISED_ADDRESS:-ziti-controller}
      - ZITI_CTRL_ADVERTISED_PORT=${ZITI_CTRL_ADVERTISED_PORT:-6262}
      - ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS:-ziti-edge-controller}
      - ZITI_CTRL_EDGE_ADVERTISED_PORT=${ZITI_CTRL_EDGE_ADVERTISED_PORT:-1280}
      - ZITI_ROUTER_NAME=${ZITI_ROUTER_NAME:-ziti-edge-router}
      - ZITI_ROUTER_ADVERTISED_ADDRESS=${ZITI_ROUTER_ADVERTISED_ADDRESS:-ziti-edge-router}
      - ZITI_ROUTER_PORT=${ZITI_ROUTER_PORT:-3022}
      - ZITI_ROUTER_LISTENER_BIND_PORT=${ZITI_ROUTER_LISTENER_BIND_PORT:-10080}
      - ZITI_ROUTER_ROLES=public
      - ZITI_ROUTER_IP_OVERRIDE=${EXTERNAL_IP}
      - NODE_EXTRA_CA_CERTS=${NODE_EXTRA_CA_CERTS:-}
      - ZITI_PKI_ALT_SERVER_CERT=${ZITI_PKI_ALT_SERVER_CERT:-}
      - ZITI_PKI_ALT_SERVER_KEY=${ZITI_PKI_ALT_SERVER_KEY:-}
    networks:
      - ziti
    volumes:
      - ./ziti-fs/:/persistent/
      - ./dev_certs/:/etc/certs/
      - ./ziti-bins/:/openziti/ziti-bin
    entrypoint: /bin/bash
    command: "/var/openziti/scripts/run-router.sh edge"
networks:
  ziti:

```

Now I can see both of my routers are online and registered in console web.

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [June 18, 2024, 12:24pm UTC](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539/32 "2024-06-18T12:24:03Z")

</div>

Glad you got things sorted. Make sure they linked together now by running `ziti fabric list links` and you should see one link between the two routers.

[Previous page](https://openziti.discourse.group/t/creating-a-second-public-edge-router/539.md?page=1)
