Note: Unable to redirect IPv4 default gateway: VPN gateway parameter is missing
OpenVPN will display the error message "NOTE: unable to redirect IPv4 default gateway -- VPN gateway parameter (--route-gateway or --ifconfig) is missing" in the connection log if the VPN connection has been configured to route all network traffic through it, but the internal gateway IP address needed for this is missing.
How you resolve this depends on your VPN connection type: routed (TUN) or bridged (TAP). You can check what type your VPN connection is by editing your connection in Viscosity, and then under the General tab looking at the Device setting (which will be either tun or tap). Please note that this option can't simply be changed: it must match the option set on the VPN server.
Once you know whether you have a tun or tap connection, refer to the sections below to resolve the message.
Bridged (TAP)
If you have a bridged (TAP) connection and you are receiving the message in the connection log, it typically indicates that the VPN connection is not being assigned an IP address when OpenVPN attempts to set up the network routes. Often for TAP connections an IP address is assigned by a DHCP server, however this process often takes several seconds. You'll need to ensure your VPN connection waits for this process to complete before setting up the network routes. This can be done like so:
- Edit your connection in Viscosity. This can be done by opening Viscosity's Preferences window from the menu, selecting your VPN connection from the list, and then clicking the "Edit" button.
- Click on the "Advanced" tab. You should see a large text area for extra advanced OpenVPN configuration commands. This may be empty, or it may already have one or more advanced commands listed (each line is a different command).
- If there are already one or more commands in the configuration commands area, check for any that start with "route-delay" and have a number at the end. If such a command exists, remove it (as it will interfere with the command we add in the next step).
- Add the command
route-delay auto
on a new line. - Click Save and try connecting.
If your VPN connection now works, and the message no longer appears in the connection log, then the issue has been resolved. If you still see the message, then please try the following:
- Edit your connection in Viscosity.
- Click on the "Networking" tab.
- Enter
dhcp
into the "Default Gateway" field. - Click Save and try connecting.
If your VPN connection still doesn't work correctly and you still see the message, then please try the following:
- Edit your connection in Viscosity.
- Click on the "Networking" tab.
- Enter the internal IP address of the router on the VPN network into the "Default Gateway" field. Often this is the same internal IP address of the OpenVPN server or modem/router.
- Click Save and try connecting.
Finally, if you're still stuck, it likely means that the OpenVPN server is not configured correctly. It may not be bridged to the VPN network, NAT or firewall rules on the VPN server could be blocking traffic, or the OpenVPN server needs to be configured to assign an IP address by pushing out an "ifconfig" command. You will need to contact your VPN Provider for more information and assistance. If you are unsure of who your VPN Provider is please see How Do I Find Out Who My VPN Provider Is?.
Routed (TUN)
If you have a routed (tun) connection and are receiving the message in the log, it typically indicates that the OpenVPN server is not sending the correct gateway IP address to use. To resolve this, first open Viscosity's Details window while connected and see whether there is a "Client IP" address assigned for the VPN connection.
If there is no Client IP address listed, it means the OpenVPN server is not correctly configured to assign an IP address by pushing out an "ifconfig" command. You will need to get in touch with your VPN Provider to fix the OpenVPN server's configuration. If you are unsure of who your VPN Provider is please see How Do I Find Out Who My VPN Provider Is?.
If your VPN connection is being correctly assigned an IP address, then the VPN connection may be configured to use a "subnet" topology, but no gateway is being set. You can correct this like so:
- Edit your connection in Viscosity.
- Click on the "Networking" tab.
- Enter the internal IP address of the router on the VPN network into the "Default Gateway" field. Often this is the same internal IP address of the OpenVPN server or modem/router.
- Click Save and try connecting.
If you don't know the correct internal IP address to use as the Default Gateway, or the VPN connection still doesn't work correctly, you will need to get in touch with your VPN Provider. If you are unsure of who your VPN Provider is please see How Do I Find Out Who My VPN Provider Is?.