How to disable hostname reconfiguration on vpn connection

Got a problem with Viscosity or need help? Ask here!

sbarnea

User avatar
Posts: 12
Joined: Thu Oct 20, 2016 4:27 am

Post by sbarnea » Thu Feb 23, 2017 11:52 pm
It seems that once Viscosity for Mac establish a connection the hostname is reconfigured to something like "OVPN-117-91" which is picked based on the IP address of the VPN.

I do want to disable this functionality as I want to keep my hostname stable and to float to random values on each VPN connection.

I observed that the value is loaded inside NetBIOS Name field in System Preferences > Network configuration but as soon I change it it reverts. I even tried to change the DHCP Client ID but it seems to have no effect, again when the VPN is updated this is overridden.

I do have few extra commands configured but none related to hostname.
Code: Select all
cipher AES-256-CBC
tls-remote ovpn.example.com
reneg-sec 0
ping-exit 120
route-delay 5
topology subnet

James

User avatar
Posts: 2312
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Fri Feb 24, 2017 2:27 am
Hi sbarnea,

If the VPN connection is a bridged TAP connection using a DHCP server, then the hostname set by the DHCP user will be used (if the VPN is set up to route all traffic). This is configurable via DHCP Option 12 ("Host Name") on your DHCP server.

macOS can also get the hostname from reverse DNS on the assigned IP address. To prevent this simply do not set up a reverse DNS entry for the VPN assigned IP address. It's highly unlikely a reverse DNS entry is being set unless you have set up a custom DNS server that's creating DNS entries for DHCP assigned IPs.

You can also override macOS's behaviour to set a fixed hostname. The page linked below has some relevant information on how to do this:
http://superuser.com/questions/49891/ho ... request-on

Cheers,
James
Web: https://www.sparklabs.com
Support: https://www.sparklabs.com/support
Twitter: https://twitter.com/sparklabs

glassfulanomaly

Posts: 2
Joined: Tue Mar 24, 2020 8:47 pm

Post by glassfulanomaly » Tue Apr 07, 2020 10:47 pm
At least as of macOS 10.15.4 (probably earlier), the method in the referenced superuser post is no longer valid. macOS no longer has an /etc/hostconfig file.
3 posts Page 1 of 1