# OpenVPN with Proxy

**URL:** <https://community.ipfire.org/t/openvpn-with-proxy/8953>\
**Category:** Web Proxy, URL Filter & Update Accelerator\
**Created:** [18 November 2022 07:10 UTC](https://community.ipfire.org/t/openvpn-with-proxy/8953 "2022-11-18T07:10:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![windb](https://community.ipfire.org/user_avatar/community.ipfire.org/windb/32/8231_2.png) [@windb](https://community.ipfire.org/u/windb)\
**Post date:** [18 November 2022 07:10 UTC](https://community.ipfire.org/t/openvpn-with-proxy/8953/1 "2022-11-18T07:10:34Z")

</div>

Hello everyone,

one thing in advance, I’m a greenhorn 😉

I would like to use OpenVPN (on my smartphone) with the proxy on the IPfire, so that the set URL filter also works on the smartphone.

I already tried that, without success:

> **[Connecting To An OpenVPN Server Via An HTTP Proxy. | OpenVPN](https://openvpn.net/community-resources/connecting-to-an-openvpn-server-via-an-http-proxy/)**
>
> OpenVPN supports connections through an HTTP proxy, with the following authentication modes.

As described I added the line to/in the ovpn file.

Because I don’t have a public IP address, I use a dynamic DNS service.

[Error messages.](https://senden.tromdienste.de/r/2Y_ACYRRLg#bssNF1I3BjCH2wNIHB/3A+MH7oytomUpqwvxOr8YIQg=)

Does anyone have any idea how I can fix it?

Thanks in advance!

Cheers,  
Marco

---

<div class="post-metadata">

**Author:** ![cfusco](https://community.ipfire.org/user_avatar/community.ipfire.org/cfusco/32/9213_2.png) [@cfusco](https://community.ipfire.org/u/cfusco)\
**Post date:** [18 November 2022 11:33 UTC](https://community.ipfire.org/t/openvpn-with-proxy/8953/2 "2022-11-18T11:33:16Z")

</div>

I wish the OpenVPN documentation would be more clear about this business of proxy setting.

That document explains how to connect to an OpenVPN server that is operating behind a proxy server. What you want to do is different: you want to connect to your OpenVPN server (no proxy here) and once you become part of the network, to use the proxy that is (likely) running on the same machine.

This is pretty much dependent on the OpenVPN client and the operating system you are using. The standard way for OpenVPN server to communicate to the client the use of a proxy server when browsing the web, is to push the message by adding the following lines to `/var/ipfire/ovpn/scripts/server.conf.local` (you need first to check the box “Additional Configuration” in the Web User Interface):

```auto
push dhcp-option PROXY_HTTP proxy_ip 800
push dhcp-option PROXY_HTTPS proxy_ip 800

```

Or in alternative you can add the following lines in the `.ovpn` configuration file that will be imported by the client:

```auto
dhcp-option PROXY_HTTP proxy_ip 800
dhcp-option PROXY_HTTPS proxy_ip 800

```

However, it is up to the operating system and the OpenVPN client to honor the request. For mobile devices, iOS will oblige the request, but Android does not allow a OpenVPN client to change the network configuration, therefore you will need to configure the proxy in android WIFI or APN connection setting that you will use when connecting to the proxy with `OpenVPN connect` client.

The proxy ip is the local ip, e.g 192.168.1.1

See my [tutorial](https://community.ipfire.org/t/how-to-set-up-a-roadwarrior-config-in-openvpn-using-openvpn-connect-for-android-and-ios/8366/9) for a complete configuration howto for mobile devices.

---

<div class="post-metadata">

**Author:** ![windb](https://community.ipfire.org/user_avatar/community.ipfire.org/windb/32/8231_2.png) [@windb](https://community.ipfire.org/u/windb)\
**Post date:** [20 November 2022 05:41 UTC](https://community.ipfire.org/t/openvpn-with-proxy/8953/3 "2022-11-20T05:41:21Z")

</div>

Hey,

thanks a lot for your answer.

Unfortunately, it somehow does not work for me.

If I add the following two lines to file /var/ipfire/ovpn/scripts/server.conf.local

```auto
push dhcp-option PROXY_HTTP proxy_ip 800
push dhcp-option PROXY_HTTPS proxy_ip 800

```

I cannot start OpenVPN at all.

The alternative, adding the following two lines to the .ovpn file

```auto
dhcp-option PROXY_HTTP proxy_ip 800
dhcp-option PROXY_HTTPS proxy_ip 800

```

generates [this](https://senden.tromdienste.de/r/ANg5ELSkqX#yXLYk8GFeNKb4mXkJl7HddarAuL5lIh+AnF0gbPWPCw=) and [these](https://senden.tromdienste.de/r/n3uRhhYoMm#yF7DXZO6dHMxKowWOMS9McmXBanEnNKCZFneuCVVSSg=) error messages:

I tried with UDP and TCP as well.

When I turn on proxy in APN settings on my android device with Graphene OS, internet works but proxy does not.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![cfusco](https://community.ipfire.org/user_avatar/community.ipfire.org/cfusco/32/9213_2.png) [@cfusco](https://community.ipfire.org/u/cfusco)\
**Post date:** [20 November 2022 12:40 UTC](https://community.ipfire.org/t/openvpn-with-proxy/8953/4 "2022-11-20T12:40:03Z")

</div>

> [@windb](#):
>
> If I add the following two lines to file /var/ipfire/ovpn/scripts/server.conf.local

did you change `proxy_ip` with the ip address of your server, like 192.168.1.1? Also, did you remove the (wrong) proxy setting form `OpenVPN connect`?

First, you need to have a successful OpenVPN connection working fine without using the proxy, before you can work on the proxy use. The guide I linked in my previous post, for android has been tested with grapheneOS and it worked correctly in my tests.

---

<div class="post-metadata">

**Author:** ![windb](https://community.ipfire.org/user_avatar/community.ipfire.org/windb/32/8231_2.png) [@windb](https://community.ipfire.org/u/windb)\
**Post date:** [20 November 2022 13:50 UTC](https://community.ipfire.org/t/openvpn-with-proxy/8953/5 "2022-11-20T13:50:47Z")

</div>

Yes, I have.

Without proxy everything works fine.

However, for the setting I only needed the following two files:  
.p12  
.ovpn

---

<div class="post-metadata">

**Author:** ![cfusco](https://community.ipfire.org/user_avatar/community.ipfire.org/cfusco/32/9213_2.png) [@cfusco](https://community.ipfire.org/u/cfusco)\
**Post date:** [20 November 2022 14:01 UTC](https://community.ipfire.org/t/openvpn-with-proxy/8953/6 "2022-11-20T14:01:22Z")

</div>

If it works, then you should only set the APN of the grapheneOS with the proxy server “192.168.4.1” or whatever is the OpenVPN address for the IPFire machine, as `OpenVPN connect` will not do it for you anyway.
