Re: udp port forwarding from internal network to internet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2005-01-27 at 08:00, Kevin Van Workum wrote:
> I'm new to netfilter and iptables and need to get
> something up and running fast. I don't have time to
> read up and learn the details right now.
> 
> I have one server machine connected to the internet
> via a cable modem with a static IP and a small
> internal network (10.0.0.0). All machines have the 2.4
> kernel. I have a user who needs to run an application
> on a few machines on the internal network. This
> application needs to connect to a server located on
> the internet via a udp port. How can I use iptables
> (or a proxy or whatever) to do this?

  # adjust these to suit
  INT_IF=eth1
  EXT_IF=eth0
  EXT_IP=`ip -4 -o addr sh $EXT_IF | awk '{print $4}' | cut -d"/" -f1`
  SRV_IP=1.2.3.4
  SRV_PORT=1111

  iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

  iptables -A FORWARD -i $INT_IF -o $EXT_IF -p udp -d $SRV_IP \
    --dport $SRV_PORT -j ACCEPT

  iptables -t nat -A POSTROUTING -o $EXT_IF -j SNAT --to-source $EXT_IP

-j

--
"'Wet Cement' - is there any sweeter sign?  Maybe 'High Voltage.'"
	--The Simpsons



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux