DD-WRT and Pound Help

Post new topic   Reply to topic    DD-WRT Forum Index -> Generic Questions
Author Message
EZee
DD-WRT Novice


Joined: 31 May 2015
Posts: 1

PostPosted: Sun May 31, 2015 20:42    Post subject: DD-WRT and Pound Help Reply with quote
I have spent several days researching this with no luck at all.

I am running Brainslayer beta build of DD-WRT v24sp2 on a Linksys EA2700.

What I am attempting to do is set up a reverse proxy so that I can redirect external http/https requests to different servers inside my network.

Example:
http://external_ip/plex would go to my internal server http://192.168.1.99:32400

https://external_ip/sonarr would go to my internal server https://192.168.1.94:9898

I have looked into Pound but there is very little detail documentation on how to do this I feel like I am going in circles.

Does anyone have directions/HowTo on how to get this working?

I do see that Pound is included in my DD-WRT image, so I am guessing I would not need to install it from Optware.

Your help is appreciated. Thanks
Sponsor
sasha
DD-WRT Novice


Joined: 03 Nov 2008
Posts: 11

PostPosted: Fri Mar 03, 2017 3:06    Post subject: Reply with quote
This might be an old topic, but i just spent some time setting this up, so I thought it might help someone.

I am using Kong firmware on R7000 (from here http://desipro.de/ddwrt/K3-AC-Arm/)

pound is included and jffs is mounted on this router with enough space so I did not need USB stick for extra storage.

The setup was to create folder /jffs/pound and place 2 files in there

/jffs/pound/pound.cfg
Code:

TimeOut  120
Alive  30
Control  "/tmp/pound.ctl"

ListenHTTP
Address 0.0.0.0
  Port 8080
  xHTTP 3

  # 192.168.0.1 is router's IP address on LAN
  # this  makes sure i can access it on port 80
  Service "DD-WRT"
    HeadRequire "^Host:[\t ]*DD-WRT$"
    Backend
      Address 192.168.0.1
      Port 80
    end
  end

  # I use subdomains to redirect to different sites
  # 192.168.0.125 is address of the server within my local network
  Service "pcp.domain.ca"
    HeadRequire "^Host:[\t ]*pcp\.domain\.ca$"
    Backend
      Address 192.168.0.125
      Port 80
    end
  end

  # this one directs to same host where apache uses VirtualHost to serve different content
  Service "xxx.domain.ca"
    HeadRequire "^Host:[\t ]*xxx\.domain\.ca$"
    Backend
      Address 192.168.0.125
      Port 80
    end
  end

  # this one works the same as above but redirects to different host:port
  Service "tnt.domain.ca"
    HeadRequire "^Host:[\t ]*tnt\.domain\.ca$"
    Backend
      Address 192.168.0.126
      Port 8081
    end
  end
 
  # this one catches everything not caught so far and directs to 3rd host
  Service "Default"
    BackEnd
      Address 192.168.0.102
      Port 80
    end
  end

end



/jffs/pound/pound.service
Code:

#!/bin/sh

cfg=/jffs/pound/pound.cfg
PATH=/sbin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=pound
DAEMON=/usr/sbin/${NAME}
POUND_CTL_DIR="/tmp"
POUNDCTL_BIN="/usr/sbin/poundctl"

test -x $DAEMON || exit 0

if [ -z "$1" ] ; then
    case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
        S??*) rc="start" ;;
        K??*) rc="stop" ;;
        *) rc="usage" ;;
    esac
else
    rc="$1"
fi

case "$rc" in
    start)
        echo "Starting $NAME"
        if [ -n "`pidof $NAME`" ]; then
            echo "$NAME already running"
        else
            if [ ! -e $cfg ]; then
              echo "missing $cfg"
              exit 1
            fi
            $DAEMON -v -f $cfg
        fi
        ;;
    stop)
        if [ -n "`pidof $NAME`" ]; then
            echo "Stopping $NAME"
            killall $NAME 2> /dev/null
        else
            echo "$NAME already stopped"
            exit 1
        fi
        ;;
    restart)
        "$0" stop
        sleep 1
        "$0" start
        ;;
    status)
        if [ -n "`pidof $NAME`" ]; then
            $POUNDCTL_BIN -c /tmp/pound.ctl
        else
            echo "$NAME is not running"
            exit 1
        fi
        ;;
    *)
        echo "Usage: $0 (start|stop|restart|usage|status)"
        ;;
esac

exit 0


You have to
Code:

chmod +x /jffs/pound/pound.service


In DD-WRT admin
NAT / QoS > Port Forwarding

Application: Pound
Protocol: TCP
Port from: 80
IP Address: 192.168.0.1 # this is router's address
Port to: 8080 # this is port I have in .cfg file as listen port for pound

Note that if you have anything else that has "Port from" as "80" you have to disable it.

In DD-WRT admin
Administration > Commands

In the text box enter
Code:

/jffs/pound/pound.service start

Hit "Save Startup"

Clear content from the text box and enter:
Code:

iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT

Hit "Save Firewall"

That should do the trick

To make sure I can access host from internal network the same as from outside I added this to DD-WRT admin Sevices > Services > Additional DNSMasq Options

strict-order
address=/tnt.domain.ca/192.168.0.126
address=/xxx.domain.ca/192.168.0.125
address=/pcp.domain.ca/192.168.0.125
Jokerigno
DD-WRT Novice


Joined: 02 Mar 2017
Posts: 6

PostPosted: Mon Mar 06, 2017 14:33    Post subject: Reply with quote
Sasha, I THINK I LOVE YOU!

I was searching over the internet for this solution!

I will try to do it tonight!

Internet is a wonderful place, THANK YOU!
Norcino
DD-WRT Novice


Joined: 04 Nov 2017
Posts: 8

PostPosted: Sat Dec 09, 2017 18:30    Post subject: Reply with quote
I have a WRT1900v2 with the firmware DD-WRT v3.0-r33679 std (11/04/17) Kernel VersionLinux 4.9.60 #68 SMP Sat Nov 4 06:18:00 CET 2017 armv7l.

I don't have pound installed and jffs is not mounted. Can anyone help me understand how to install pound and how to mount jffs to the local router's file system?

_________________
Router: Linksys WRT 1900ACv2
Firmware: DD-WRT v3.0-r28788 std (01/13/16)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Generic Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum