LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-07-2011, 02:12 PM   #1
jiecenzhao
LQ Newbie
 
Registered: May 2011
Posts: 13

Rep: Reputation: 0
Unable to route traffic based on packet content


Hello

My linux machine is connected to the outside internet, and I have a minecraft server running on an internal machine (192.168.1.201).
Right now, I am forwarding port 80 on the linux machine to 192.168.1.30, which is working.
iptables -t nat -I PREROUTING -i eth0 -d 192.168.1.30 -j DNAT --to-destination 192.168.1.201
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j DNAT --to 192.168.1.201

______________________________

I want to filter out the GET/POST requests and forward them to port 8080. I can't seem to get that working.

I've tried this:

iptables -A INPUT -d 192.168.1.30 -p tcp --dport 80 -m string --algo bm --string 'GET' -j REDIRECT --to-ports 8080
 
Old 05-08-2011, 02:37 PM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
try
Code:
-A PREROUTING -d 192.168.1.30 -p tcp -m tcp --dport 80 -m string --string "GET" --algo bm -j REDIRECT --to-ports 8080
there's no REDIRECT in INPUT chain.
 
  


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
[HELP] redirect traffic to spesific port based on Traffic Content using iptables summersgone Linux - Server 2 06-22-2009 11:26 AM
FC4 Routing error - unable to route inet traffic TotalLinuxNoob Linux - Networking 2 09-04-2006 07:35 PM
Can I route web traffic to 2 different hosts based on URL under 1 IP Address? Marshalle Linux - Networking 5 05-14-2005 03:02 AM
Need Linux machine to route / packet forward rdd Linux - Networking 3 06-24-2004 09:59 AM
get msg from the packet passed through in a Linux route using C becky_starr Programming 12 02-18-2004 08:25 AM

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

All times are GMT -5. The time now is 11:15 PM.

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