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 07-02-2010, 11:24 AM   #1
bronco
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
IPTables / Existing Sessions Question


Hi... I two servers set up: 192.168.1.150 and 192.168.1.160

Initially, I want all traffic to be served by server 150. So for this purpose I am leaving the IPTables on .150 empty.

At a point in time, I want to forward all incoming traffic to be served by .160 instead.
I have accomplished this using these commands (on .150):

iptables -t nat -A PREROUTING -j DNAT --to 192.168.1.160
iptables -t nat -I POSTROUTING -j MASQUERADE

My problem is that if I have an open SSH connection to .150 (prior to adding the rules), the packets are still handled by .150 after adding the rules.. e.g. my SSH session stays active. I want these packets to be forwarded to .160, which would effectively disconnect the SSH session. I do not want the packets flat out dropped, I just want them forwarded on in whatever state they are in.

If I try a new SSH session, it is properly forwarded to .160

Any help would be appreciated to get these packets from the existing session forwarded.

Thank you!
 
Old 07-02-2010, 04:24 PM   #2
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
Anything wrong with dropping packets and returning an error?
 
Old 07-02-2010, 06:22 PM   #3
bronco
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Yes... I need to redirect the packets if at all possible.
My end goal is to perform a live migration of a Xen domU that exists within a private network on physical machine .150 over to physical machine .160. The session should still be valid if I can redirect the packets correctly.
 
Old 07-06-2010, 02:37 PM   #4
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
The Xen DomU will have it's own IP addresses, I don't see how an SSH connection to 192.168.1.150 is relevant. It should just work if they are on the same Ethernet network.

Leave iptables alone, you will break connections that way.
 
Old 07-06-2010, 06:59 PM   #5
bronco
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Solved

Thanks for the advice... I have accomplished what I need by removing the appropriate conntrack entry.
 
Old 07-07-2010, 01:35 AM   #6
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by bronco View Post

My problem is that if I have an open SSH connection to .150 (prior to adding the rules), the packets are still handled by .150 after adding the rules.. e.g. my SSH session stays active...

Thank you!
You can't change anything while connection is open or active. Because iptables module "nf_conntrack" remember it. And it is very important for open connection to stay unchangeable.
 
  


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
Virtualizing an existing Ubuntu 904/WinXP installation -- Question screwbottle Linux - Virtualization and Cloud 9 12-28-2009 09:20 AM
root account: how to log off all existing sessions fzanella Linux - Newbie 4 08-31-2009 06:36 PM
PHP security question: sessions vs cookies vharishankar Programming 10 03-06-2006 01:19 AM
IPTABLES how to add/edit/delete rules in existing chain? debug019 Linux - Newbie 1 11-11-2004 02:48 PM
Question about Upgrading from existing Linux install option in Fedora krestofre Fedora 2 11-12-2003 01:52 PM

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

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