bercko21
asked on
How do i redirect all traffic from public IP to another public ip?
Hi,
I have a machine in a shared hosting, it listen to varies udp ports.
I like to move it to a private cage, but the IP address can't move with it.
is there any way, maybe using linux or such,
to do a simple redirect to all traffic coming to the original IP to the new IP address?
I've checked IPTABLES, but I'm still not sure how can it be done...
Thanks!
I have a machine in a shared hosting, it listen to varies udp ports.
I like to move it to a private cage, but the IP address can't move with it.
is there any way, maybe using linux or such,
to do a simple redirect to all traffic coming to the original IP to the new IP address?
I've checked IPTABLES, but I'm still not sure how can it be done...
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Blaz for your help!
By ports or all trafiic, both are fine,
I've tried typing the solution you brought and I'm getting "Bad argument `NEW,ESTABLISHED'"
any ideas regarding it?
By ports or all trafiic, both are fine,
I've tried typing the solution you brought and I'm getting "Bad argument `NEW,ESTABLISHED'"
any ideas regarding it?
I think I made a typo. The rule should read:
iptables -t filter -A FORWARD -d <your hosting box IP> -p udp --dport 2000 -m state --state NEW,ESTABLISHED -j ACCEPT
Note the double hypen before state.
iptables -t filter -A FORWARD -d <your hosting box IP> -p udp --dport 2000 -m state --state NEW,ESTABLISHED -j ACCEPT
Note the double hypen before state.
ASKER
Thanks!
I notice the typo, it didn't make a difference...
I still trying it here, but so far It's not working for some reason....
I notice the typo, it didn't make a difference...
I still trying it here, but so far It's not working for some reason....
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I believe that I gave a working configuration to solve the question in comment #23708908. The only problem asker was having should be resolved by Nopius's comment #23733446 and the asker did not report any problems with the solution afterwards.
iptables -t filter -A FORWARD -d <your hosting box IP> -m state -state NEW,ESTABLISHED -j ACCEPT
...
iptables -t nat -A PREROUTING -d <linux box IP> -j DNAT --to-destination <your hosting box IP>
iptables -t nat -A POSTROUTING -d <your hosting box IP> -j SNAT --to-source <linux box IP>