Direcionar porta 3389(Terminal Service) [RESOLVIDO]

13. Re: Direcionar porta 3389(Terminal Service) [RESOLVIDO]

Ivan Kael
ivankael

(usa Debian)

Enviado em 16/03/2015 - 09:42h

Solução para redirecionar a porta 3389 do seu Gateway para o terminal server no Debian 7

## declaring interfaces
outif="eth0" # the ethernet card connected to the interwebz
lanif="eth1" # the one connected to the lan

# some machines inside our network (optional)
TerminalServer="192.168.1.2"

# delete all existing rules.
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# some machines inside our network (optional)
TerminaServer="192.168.1.2"

# delete all existing rules.
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
# Redirecionando a porta 3389
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to $TerminaServer:3389

# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT

# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW ! -i $outif -j ACCEPT
iptables -A FORWARD -i $outif -o $lanif -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow outgoing connections from the LAN side
iptables -A FORWARD -i $lanif -o $outif -j ACCEPT

# Masquerading
iptables -t nat -A POSTROUTING -o $lanif -j MASQUERADE
iptables -t nat -A POSTROUTING -o $outif -j MASQUERADE

Testado e funcionando perfeitamente no meu Servidor Gateway.
Abraço.


  



01 02



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts