port forwarding, iptables
Добавлено: 2007-08-30 12:57:44
sorry gays, I have only english localization of linux box - need to set up networking first and it's very urgently.
Please, help!
This is a simple set of rules, I try to use to forward port from the local net to my vmware windows. The routes are ok, comps are available from each others.
But it does not work. How to set up logging? May be I should add a rule to allow all traffic for beginning?
Sorry again for using english...
Please, help!
Код: Выделить всё
local_net (192.168.5.165) ---> eth0 (192.168.5.166:4005) <---> vmnet8 (172.16.85.129:4005)
Код: Выделить всё
#!/bin/bash
IPTABLES="/sbin/iptables"
/bin/echo 1 > /proc/sys/net/ipv4/ip_forward
EXT="192.168.5.166" #- внешний IP роутера
LOC="172.16.85.129" # - внутренний адрес машины, которую надо "выкидывать" наружу
PORT1="4005" #- Порт, на который будут заходить извне и попадать на локальную машину
PORT2="4005" # - Порт, который "выбрасывается" наружу (например, 80 - http, либо 21 - ftp)
iptables -t nat -A PREROUTING -p tcp -d $EXT --dport $PORT1 -j DNAT --to-destination $LOCAL_IP:$PORT2
iptables -A FORWARD -i eth0 -d $LOC -p tcp --dport $PORT2 -j ACCEPT
But it does not work. How to set up logging? May be I should add a rule to allow all traffic for beginning?
Sorry again for using english...