LinuxQuestions.org
Review your favorite Linux distribution.
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 06-15-2010, 01:00 AM   #1
smart_shell
Member
 
Registered: May 2009
Location: NYC
Distribution: Ubuntu 10.04 LTS
Posts: 52

Rep: Reputation: 0
Redirect iptables


Hi,
We have the network, 10.19.0.0/24 GW(10.19.0.222 centos) and two irc servers
one 10.19.0.7
two 10.19.0.222
I need to change connection from 10.19.0.220:6667 to 10.19.0.7:6667 on GW(10.19.0.222 iptables FW).
i did:
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 6667 -j DNAT --to-destination 10.19.0.7:6667
iptables -t nat -A POSTROUTING -p tcp --dst 10.9.0.7 --dport 6667 -j SNAT --to-source 10.19.0.222
but no result.
Please help.
Thnx
 
Old 06-15-2010, 07:46 AM   #2
vehl_g1
LQ Newbie
 
Registered: Jun 2007
Posts: 1

Rep: Reputation: 1
Wink

Quote:
Originally Posted by smart_shell View Post
Hi,
We have the network, 10.19.0.0/24 GW(10.19.0.222 centos) and two irc servers
one 10.19.0.7
two 10.19.0.222
I need to change connection from 10.19.0.220:6667 to 10.19.0.7:6667 on GW(10.19.0.222 iptables FW).
i did:
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 6667 -j DNAT --to-destination 10.19.0.7:6667
iptables -t nat -A POSTROUTING -p tcp --dst 10.9.0.7 --dport 6667 -j SNAT --to-source 10.19.0.222
but no result.
Please help.
Thnx
Just use this command, it's send all requests from eth0 with dst port 6667 to 10.19.0.7 and check the 10.19.0.7 to listen that port .
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 6667 -j DNAT --to-destination 10.19.0.7

Last edited by vehl_g1; 06-15-2010 at 07:47 AM.
 
Old 06-15-2010, 10:17 PM   #3
smart_shell
Member
 
Registered: May 2009
Location: NYC
Distribution: Ubuntu 10.04 LTS
Posts: 52

Original Poster
Rep: Reputation: 0
Sorry guys, i had to add the rule for FORWARD. Now everything work fine. Thnx
 
  


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
Lipipq(iptables) . How do I redirect captured packet to another address with iptables inet905 Programming 0 05-25-2010 01:20 AM
an example on iptables with redirect emmendes Linux - Security 6 11-25-2008 04:31 PM
iptables to redirect ip genderbender Linux - Networking 1 04-06-2008 01:53 AM
iptables redirect sanjibgupta Linux - Networking 3 05-18-2007 03:16 AM
iptables redirect bhartnett Linux - Networking 1 09-26-2001 09:11 PM

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

All times are GMT -5. The time now is 12:27 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