port forwarding para servidor lan interno

1

Eu tenho ppp0 - > eth1 e eth0 (lan interno). Eu preciso encaminhar externel 10022 porta para a porta 8999 do servidor 192.168.1.254

iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 10022 -j DNAT --to 192.168.1.254:8999
iptables -A FORWARD -p tcp -d 192.168.1.254 --dport 10022 -j ACCEPT

Eu também tenho:

cat /proc/sys/net/ipv4/conf/ppp0/forwarding 

1

tempo limite de conexão ... alguma ideia?

iptables -L -nv

Chain INPUT (policy DROP 14 packets, 1609 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  -f  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID 
 2037  136K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    0     0 ACCEPT     icmp --  ppp0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  eth0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  tap0   *       0.0.0.0/0            0.0.0.0/0           
   14  1609 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4 

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 TCPMSS     tcp  --  *      ppp2    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU 
    0     0 TCPMSS     tcp  --  *      eth1    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU 
    0     0 TCPMSS     tcp  --  *      eth0    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU 
    0     0 TCPMSS     tcp  --  *      ppp0    0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 tcpmss match 1400:1536 TCPMSS clamp to PMTU 
   16  2368 ACCEPT     all  --  *      *       0.0.0.0/0            192.168.1.0/24      state RELATED,ESTABLISHED 
    0     0 ACCEPT     all  --  *      *       192.168.1.0/24       0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 4 

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  -f  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID 
 3097 4268K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW,RELATED,ESTABLISHED 
    
por Pol Hallen 15.07.2013 / 21:07

1 resposta

0

Você precisa definir o encaminhamento de IP no eth0 também. Use

sysctl -p net.ipv4.ip_forward=1

O -p torna a mudança persistente durante as reinicializações. Além disso, posso estar errado, mas achei que a linha superior deveria ser:

iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 10022 -j DNAT --to-destination 192.168.1.254:8999
    
por 15.07.2013 / 21:40