Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    how can i forward ssh to a internal ip using iptables?


    Hello! i have recently setup a debian server to manage my network, it uses ipv4 forwarding for the routing, iptables for the firewall and hostapd for the wap. at the moment i am trying to forward my ssh port (22000) to a internal ip: 192.168.1.111 but i have not had success, my iptables save file looks like so:

    # Generated by iptables-save v1.4.8 on Thu Jul 28 13:05:43 2011
    *nat
    :PREROUTING ACCEPT [741:63044]
    :POSTROUTING ACCEPT [0:0]
    :OUTPUT ACCEPT [192:13768]
    -A POSTROUTING -o eth0 -j MASQUERADE
    COMMIT
    # Completed on Thu Jul 28 13:05:43 2011
    # Generated by iptables-save v1.4.8 on Thu Jul 28 13:05:43 2011
    *filter
    :INPUT DROP [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    -A INPUT -s 192.168.1.0/24 -i br0 -j ACCEPT
    -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A FORWARD -i eth0 -o Br0 -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A FORWARD -i br0 -o eth0 -j ACCEPT
    -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A OUTPUT -j ACCEPT
    COMMIT
    # Completed on Thu Jul 28 13:05:43 2011
    **********************************************
    what commands do you think i should issue to allow the 22000 forwarding? thanks for your help! very much appreciated =]

  2. #2
    Something like:
    Code:
    -A PREROUTING -p tcp -m tcp --dport 22000 -j DNAT --to-destination 192.168.1.111:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •