Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 580
  • Last Modified:

iptable REDIRECT problem

hi expets;

i have two linux box

i use first computer on office , but second linux box is on the net
i need redirect my office computer (port 1232) to remote server ssh 88.88.88.88:22

i want to use ssh connection command line like `ssh localhost -p 88` to connect remote server sshd

im using this iptables line

iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 1232 -j REDIRECT --to 88.88.88.88:22


[Note: my computer connected via adsl modem on net my gateway 10.0.0.2 ]

but doesnt's work

wherei s wrong

Thanks ..
0
nedimk
Asked:
nedimk
1 Solution
 
sudev_shettyCommented:
iptables -t nat -A PREROUTING -p tcp -s 0/0 --dport 1232 -j DNAT --to-destination 88.88.88.88:22
iptables -t nat -A OUTPUT -p tcp -s 0/0 --dport 1232 -j DNAT --to-destination 88.88.88.88:22

try this
0
 
nedimkAuthor Commented:
ok i try this but doesnt work

iptables -t nat -L output ;

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DNAT       tcp  --  anywhere             anywhere            tcp dpt:1232 to:88.88.88.88:22

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
DNAT       tcp  --  anywhere             anywhere            tcp dpt:1232 to:88.88.88.88:22

Thanks ..
0
 
jar3817Commented:
Just so you know, iptables REDIRECT is for internal redirection, to different ports on the same machine, you can't redirect to a different machine.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now