1

I found similar questions but couldn't get them to work for my use case. I have a linux server running memcached that is listening to traffic on its local network ip, which is on eth1. I would like to allow a specific external IP to access memcached (has to be specific as there is no auth on memcached, and I don't want to restart the service and lose the cache.)

So I would like to do two things:

  1. On the memcached server, allow a specific external IP "A" to connect to the server on eth0, the public net, and forward the packets to eth0 with access to memcached. There should be no interference with existing traffic to memcached on eth1. This can probably be done with iptables.

  2. Use the server with IP "A" as a proxy for other servers on its LAN. How can I set up all traffic on "A":1234 to forward to eth0 on the memcached server? Can this be done with iptables?

Any help would be appreciated.

3
  • You could probably do this with iptables, but I think this would be easier to maintain as a userspace layer 4 proxy (haproxy can be configured to work this way; lots of good guides on Google to be found). Dec 9, 2017 at 8:33
  • @DrewBloechl you're probably referring to point 2. Surely point 1 is pretty straight-forward for iptables?
    – timetofly
    Dec 11, 2017 at 2:24
  • 1
    Yes, my previous comment is about point 2. For point 1, I think what you want is a DNAT rule. Dec 11, 2017 at 19:32

0

You must log in to answer this question.

Browse other questions tagged .