OpenWrt Forum Archive

Topic: How to connect to VPN (PPTP/L2TP) over PPPOE connection?

The content of this topic has been archived on 29 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have PPPOE connection, here's my /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdb7:b3ce:33b6::/48'

config interface 'lan'
        option ifname 'eth0'
        option force_link '1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option gateway '192.168.1.1'

config interface 'wan'
        option ifname 'eth1'
        option _orig_ifname 'eth1'
        option _orig_bridge 'false'
        option proto 'pppoe'
        option username 'myusername'
        option password 'mypassword'

config interface 'wan6'
        option ifname 'eth1'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4'

I'm pretty new with OpenWRT and have limited knowledge in Linux.

1. Can someone guide me on how to use PPTP over PPPOE connection? I'm using privateinternetaccess VPN service.
2. Is it possible to set that only certain ethernet port will use VPN? For example my router (841n v11) have 4 ethernet port, port 1 goes to PS4, port 2 goes to PC. I want my PS4 to be connected to VPN but not the PC, is that possible?

I've done this with openvpn, but i don't know is that possible with pptp. You have to create vlan and assinged port 1 to it, then bridge that vlan with vpn interface.

If someone intreresting how I implemented it :
what you need to download :

Do not forget to update available paсkages - opkg update
1 -  opkg install ppp-mod-pptp kmod-nf-nathelper-extra


/etc/config/network :

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'


config interface 'lan'
    option type 'bridge'
    option ifname 'eth0'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'
    option ip6assign '60'

config interface 'wan'
    option ifname 'eth1'
    option _orig_ifname 'eth1'
    option _orig_bridge 'false'
    option proto 'pppoe'
    option username 'username'
    option password 'passowrd'
    option defaultroute '0'
    option peerdns '0'

config interface 'vpn'
    option ifname 'vpn'
    option proto 'pptp'
    option username 'username'
    option password 'passowrd'
    option server 'vpn.example.com'
    option pppd_options 'nomppe'

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '1 2 3 4 0'

#here you have to put route to pptp_server
config 'route'  'pptp_server'
        option 'interface' 'wan'
        option 'target'  'vpn.example.com'   
        option 'netmask' '255.255.255.255'

then append to /etc/config/firewall:

config 'zone'
        option 'name'      'wan'
        option 'network'   'wan vpn # Important'
        option 'input'     'REJECT'
        option 'forward'   'REJECT'
        option 'output'    'ACCEPT'
        option 'masq'      '1'

(Last edited by spikejke on 10 Mar 2018, 12:34)

The discussion might have continued from here.