Can anyone tell me how to do this?
Hello all,
Can anyone tell me how to do this so that I may ask some questions afterword's in hopes to learn a little more about iptables.
This is what I would like to try. I think this would get me to the next level.
My devil-Box is at 172.16.12.130 and I want all ssh request to this .130 address, to go to address
172.16.12.212. How do I do this? All machines are
on the 172.16.12.x subnet for right now.
Thanks in advance
Dominic
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
Quoted 4 lines · Dominic Iadicicco
Hello all,
My devil-Box is at 172.16.12.130 and I want all ssh request to this .130 address, to go to address 172.16.12.212.
go to : it's the easy part :
iptables -A PREROUTING -t nat -d 172.16.12.130 -p tcp -dport 22 \\
-j DNAT --to 172.16.12.212
well that's for go to. But let say A try to connect to 172.16.12.130 then 172.16.12.212 receive a connection from 1 and answer to A which wait answer from 172.16.12.130. bad day for him.
The solution is to change source address of packets going to 172.16.12.212 :
iptables -A POSTROUTING -t nat -d 172.16.12.212 -p tcp --dport 22 \\
-j SNAT --to 172.16.12.130
thus we have the following :
A talks to 172.16.12.130
packet arrive to 172.16.12.212 with source 172.16.12.130
packet return to 172.16.12.130
which reemit to A.
BR,
Signature · 2 lines
Eric Leblond <[email protected]> INL
Quoted 5 lines · Dominic Iadicicco
Hello all,
Can anyone tell me how to do this so that I may ask some questions afterword's in hopes to learn a little more about iptables.
learning more about iptables is a nice goal to have. sometimes i wish it was just as glamorous for people to want to learn more about routing and the OSI model, before becoming super l33t firewall gurus...but i digress...
Quoted 7 lines
This is what I would like to try. I think this would get me to the next level.
My devil-Box is at 172.16.12.130 and I want all ssh request to this .130 address, to go to address
172.16.12.212. How do I do this? All machines are
on the 172.16.12.x subnet for right now.
iptables -t nat -A PREROUTING -p tcp --dport 22 \
-d 172.16.12.130 -j DNAT --to-destination 172.16.12.212
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPTiptables -A FORWARD -p tcp -d 172.16.12.212 -j ACCEPT
iptables -t nat -A POSTROUTING -p tcp --dport 22 \
-d 172.16.12.212 -j SNAT --to-source 172.16.12.130sysctl -w net.ipv4.ip_forward=1
-j
Signature · 1 line
Jason Opperisano <[email protected]>
Eric:
Where should I put?
"iptables -A POSTROUTING -t nat -d 172.16.12.212 -p
Quoted 2 lines
tcp --dport 22 \\
-j SNAT --to 172.16.12.130"
Should that command also be executed on the same
machine as the previous?
Thanks
Dom
Quoted 25 lines · --- Eric Leblond
Quoted 2 lines · Dominic Iadicicco
Hello all,
My devil-Box is at 172.16.12.130 and I want allssh
Quoted 2 lines
request to this .130 address, to go to address
172.16.12.212.go to : it's the easy part :
iptables -A PREROUTING -t nat -d 172.16.12.130 -p tcp -dport 22 \\
-j DNAT --to 172.16.12.212well that's for go to. But let say A try to connect to 172.16.12.130 then
172.16.12.212 receive a connection from 1 and answer to A which wait
answer from 172.16.12.130. bad day for him. The solution is to change source address of packets going to
172.16.12.212 :
iptables -A POSTROUTING -t nat -d 172.16.12.212 -p tcp --dport 22 \\
-j SNAT --to 172.16.12.130
Quoted 13 lines
thus we have the following :
A talks to 172.16.12.130
packet arrive to 172.16.12.212 with source
172.16.12.130
packet return to 172.16.12.130
which reemit to A.BR,
Signature · 2 lines
Eric Leblond <[email protected]> INL
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
Quoted 3 lines · Dominic Iadicicco
Eric:
Should that command also be executed on the same
machine as the previous?
yes.
take a paper and write carrefully the life of a packet on its way in and back.
BR,
Signature · 2 lines
Eric Leblond <[email protected]> INL
I got it. :)
It worked.
I am starting to get it a little more now.
It is almost like a phone switch board.
a send line and a receive line.
I am sure I will have more questions later.
Thank you. Eric and Jason Operisano, Both of your post have helped me learn alot.
Quoted 6 lines · --- Eric Leblond
Quoted 3 lines · Dominic Iadicicco
Eric:
Should that command also be executed on the same
machine as the previous?
Quoted 12 lines
yes.
take a paper and write carrefully the life of a
packet on its way in and
back.BR,
Signature · 2 lines
Eric Leblond <[email protected]> INL
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com