LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-10-2015, 09:53 AM   #1
Yazeed98
LQ Newbie
 
Registered: May 2014
Posts: 29

Rep: Reputation: Disabled
Iptables redirect to IP:PORT


Hello LQ, I want to redirect gameserver(CS-SERVER) to IP:PORT with iptables I have tried this
http://www.debuntu.org/how-to-redire...sing-iptables/

But after putting Can't view that server response.
Here is example:

Real-Ip before redirect:
https://i.gyazo.com/42ce7e282853cefc...d138d3e467.png

After redirect:
https://i.gyazo.com/d20af9cb07b0cf01...0e85f65ca1.png

-Thanks alot
 
Old 08-10-2015, 02:14 PM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
How about showing us what you did instead of showing screen shots?

Show me the command you typed to add the rules to your firewall and also show your firewall rules .
 
Old 08-10-2015, 02:23 PM   #3
Yazeed98
LQ Newbie
 
Registered: May 2014
Posts: 29

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by lazydog View Post
How about showing us what you did instead of showing screen shots?

Show me the command you typed to add the rules to your firewall and also show your firewall rules .
Sure
iptables -t nat -A PREROUTING -p udp --dport 27015-j DNAT --to-destination ip:27015
iptables -t nat -A POSTROUTING -j MASQUERADE
 
Old 08-11-2015, 10:58 AM   #4
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
OK so you most likely have more then one interface on this box correct?
If so then you need to tell the rules which interface that should be applied to.
If eth0 is your WAN port then you need to do this:

(you should always wrap your code in code tags)

Code:
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 27015-j DNAT --to-destination ip:27015
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
with iptables, how-to redirect outgoing mail from port 25 to port 587 thumbelina Linux - Networking 12 03-19-2012 08:26 AM
Port redirect with help of IPTABLES EgoX Linux - Networking 1 09-06-2010 02:45 AM
Iptables redirect ip and port adrigo Linux - Server 8 07-16-2010 02:30 PM
debian iptables squid - redirect port 80 to port 8080 on another machine nickleus Linux - Networking 1 08-17-2006 12:59 AM
Redirect port with iptables |DeJoTa| Linux - Networking 0 07-11-2003 01:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration