[Twisted-web] Binding twistd to a Specific IPv4 Address

Matt Goodall matt at pollenation.net
Mon Apr 4 06:35:28 MDT 2005


Eric Radman wrote:

>Is there a way to instruct twistd to bind to a specific IPv4 address?
>  
>
You can specify an interface arg when creating the server. See the 
t.w.internet.interfaces.IReactorTCP.listenTCP docstring for details. 
That docstring also applies to TCPServer.

- Matt

>Right now I'm setting up each server on it's own port and redirecting
>packets with iptables:
>
># Apache
>iptables -t nat -A PREROUTING -p tcp -d 10.1.1.1 --dport 80 \
>    -j DNAT --to-destination 10.1.1.1:8001
>
># Twisted 1
>iptables -t nat -A PREROUTING -p tcp -d 10.1.1.2 --dport 80 \
>    -j DNAT --to-destination 10.1.1.2:8002
>
># Twisted 2
>iptables -t nat -A PREROUTING -p tcp -d 10.1.1.3 --dport 80 \
>    -j DNAT --to-destination 10.1.1.3:8003
>
>This is kind of messy.
>
>  
>


-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.




More information about the Twisted-web mailing list