Jump to content

Route wlan0 through VPN


Recommended Posts

Hi everybody!

I am trying to route all wlan0 traffic through a VPN, but I cant get it to work.

my Pineapple is cabled to my router, with a static ip address, and wlan0 is set up as an access point.

I am connecting to the vpn server using the following command:

openvpn --config /sd/config/vpnserver.ovpn

which works fine, and I traffic directly from the pineapple terminal goes through the VPN (for example pings from the pineapple terminal, i check this using tcpdump -i tun0).

But when I connect to the access point it seems like all the traffic from wlan0 goes diretly to br-lan.

I have tried adding the following rules to iptables:

iptables -t nat -I POSTROUTING 1 -o tun0 -j MASQUERADE
iptables -I FORWARD 1 -i tun0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD 1 -i wlan0 -o tun0 -j ACCEPT

but it does not work. How can I make all traffic from wlan0 go through tun0?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...