shell bash add tag
leeand00
In local port forwarding, what DNS server resolves the name of internal_db.local?

Would that be the internal SSH server's DNS? (that's what I would think)

Or is it the external DNS server that assigns the sshgateway.com its address?

For example:

```
ssh -L 4000:internal_db.local:3306 user@ssh.sshgateway.com
```

Top Answer
Jack Douglas
Name resolution for the forwarding happens at the destination end of the tunnel.

I just double-checked this:

``` shell
ssh -L 2222:webserver:22 root@mygateway.xyz
```

`webserver` doesn't resolve to anything locally but I was able to connect through the port forward using:

``` shell
ssh root@localhost -p 2222
```

Alternatively you can check this with tshark for a public name, running during the connection to the remote server via the tunnel:

``` shell
root@mygateway.xyz:~# tshark -f 'host 1.1.1.1'
Running as user "root" and group "root". This could be dangerous.
Capturing on 'ens3'
    1 0.000000000 NNN.NNN.NNN.NNN → 1.1.1.1      DNS 71 Standard query 0x9521 A mywebserver.xyz
    2 0.000033057 NNN.NNN.NNN.NNN → 1.1.1.1      DNS 71 Standard query 0xb533 AAAA mywebserver.xyz
    3 0.003754670      1.1.1.1 → NNN.NNN.NNN.NNN DNS 143 Standard query response 0xb533 AAAA mywebserver.xyz SOA max.ns.cloudflare.com
    4 0.003786821      1.1.1.1 → NNN.NNN.NNN.NNN DNS 98 Standard query response 0x9521 A mywebserver.xyz A 195.200.211.92
```

(real IP addresses replaced with `NNN.NNN.NNN.NNN`)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.