Networking Forums

Networking Forums > Computer Networking > Linux Networking > Old TCP connections after IP address change

Reply
Thread Tools Display Modes

Old TCP connections after IP address change

 
 
Mario Moder
Guest
Posts: n/a

 
      06-08-2005, 10:42 PM
Hi,

my system (Debian Sid x86, Linux Kernel 2.6.10) gets a new dynamic IP
address on interface ppp0 (connected to a DSL modem on eth0) every 24
hours because I use pppd (with pppoe plugin) with the "persist"
option, so I am connected all the time.

There are several messaging systems running (bitlbee with ICQ and
Jabber, X-Chat, linphone) which must stay connected to a server. When
the ppp0 connection is terminated by my DSL provider, pppd triggers a
new connection after a few seconds and I get a new dynamic IP address
on ppp0. But the client applications need about 20 minutes (!) to
recognize that the old connection is broken and that they need to
reconnect to their servers with the new IP. This is too long for a
serious usage, especially for my voIP phone.

Is there a way to make the obsolete TCP/IP connections with the old IP
address "timeout" faster? 1-3 minutes would be acceptable.

My suggestion was that the client apps should check themselves for IP
change at a short interval but this is no acceptable solution in my
opinion. It should be done at a lower level of the network, perhaps at
the TCP level. Since nearly all apps need 20 minutes to recognize the
broken connection I guess it is the Linux networking system (the TCP
stack?) which is responsible for this.

There are several settings that you can change in /proc/sys/net/ipv4/
but I don't know which or if this helps at all concerning my problem.
Setting /proc/sys/net/ipv4/ip_dynaddr to 1 does not seem to help.

I wonder if nobody else has this problem as there are so many DSL
users out there... Perhaps I searched google groups for the wrong
keywords.

Mario

--
http://oddfellow.endofinternet.org/
 
Reply With Quote
 
 
 
 
Clifford Kite
Guest
Posts: n/a

 
      06-10-2005, 02:16 AM
Mario Moder <(E-Mail Removed)> wrote:

> My suggestion was that the client apps should check themselves for IP
> change at a short interval but this is no acceptable solution in my
> opinion. It should be done at a lower level of the network, perhaps at
> the TCP level. Since nearly all apps need 20 minutes to recognize the
> broken connection I guess it is the Linux networking system (the TCP
> stack?) which is responsible for this.


> There are several settings that you can change in /proc/sys/net/ipv4/
> but I don't know which or if this helps at all concerning my problem.
> Setting /proc/sys/net/ipv4/ip_dynaddr to 1 does not seem to help.


For TCP read about /proc/sys/net/ipv4/tcp_keepalive_* files in the
linux source file Documentation/filesystems/ip-sysctl.txt and see
if some combination of those might do what you want. The times are
stored in the keepalive_{time,intvl} files are in seconds.

-- Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
/* The generation of random numbers is too important to be left
to chance. */
 
Reply With Quote
 
Grant Coady
Guest
Posts: n/a

 
      06-10-2005, 02:47 AM
On Thu, 9 Jun 2005 21:16:23 -0500, Clifford Kite <(E-Mail Removed)> wrote:
>
> > There are several settings that you can change in /proc/sys/net/ipv4/
> > but I don't know which or if this helps at all concerning my problem.
> > Setting /proc/sys/net/ipv4/ip_dynaddr to 1 does not seem to help.

>
> For TCP read about /proc/sys/net/ipv4/tcp_keepalive_* files in the
> linux source file Documentation/filesystems/ip-sysctl.txt and see
> if some combination of those might do what you want. The times are
> stored in the keepalive_{time,intvl} files are in seconds.


You guys still missing the point, properly configured linux running
modem in _bridge_ mode (PPPoE) will see the IP change and drop all
current TCP connections... If you being wimpy and plugging into
ADSL modem in 'windows' mode, you deserve what you get )

See: netfilter.org.

--Grant.

 
Reply With Quote
 
Mario Moder
Guest
Posts: n/a

 
      06-10-2005, 08:10 AM
Grant Coady wrote:
>
> You guys still missing the point, properly configured linux running
> modem in _bridge_ mode (PPPoE) will see the IP change and drop all


Well I don't get your point now. Quoting from the DSL-Howto:

"Important! You need to know beforehand how your ISP is setup for
connecting to his network. To re-iterate, the two main possibilities
are Bridged/DHCP and PPPoE. These are mutually exclusive
implementations."

My ISP only uses PPPoE. What do you mean with "_bridge_ mode (PPPoE)"?

> current TCP connections... If you being wimpy and plugging into
> ADSL modem in 'windows' mode, you deserve what you get )


And what do you mean with "windows" mode? PPPoE?

> See: netfilter.org.


I looked at this side and I know netfilter/iptables but I did not find
information about my problem.

Greetings,

Mario


--
http://oddfellow.endofinternet.org/
 
Reply With Quote
 
Clifford Kite
Guest
Posts: n/a

 
      06-10-2005, 01:54 PM
Grant Coady <(E-Mail Removed)> wrote:
> On Thu, 9 Jun 2005 21:16:23 -0500, Clifford Kite <(E-Mail Removed)>
> wrote:
>> For TCP read about /proc/sys/net/ipv4/tcp_keepalive_* files in the
>> linux source file Documentation/filesystems/ip-sysctl.txt and see
>> if some combination of those might do what you want. The times are
>> stored in the keepalive_{time,intvl} files are in seconds.


> You guys still missing the point, properly configured linux running
> modem in _bridge_ mode (PPPoE) will see the IP change and drop all
> current TCP connections... If you being wimpy and plugging into
> ADSL modem in 'windows' mode, you deserve what you get )


How about expanding this so we can understand what you really mean.
As the OP pointed out in his follow-up there is Bridged/DHCP and PPPoE
ADSL, and you seem to lumped them together. Most ISPs are now using
PPPoE because it's to their advantage to do so; it offers little,
if any, benefit to the consumer. And I have no idea what "windows
mode" means - but then I don't do Windows.

> See: netfilter.org.


Maybe you could point us toward what part(s) can be configured to
help with this?

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
 
Reply With Quote
 
Grant Coady
Guest
Posts: n/a

 
      06-10-2005, 04:12 PM
On Fri, 10 Jun 2005 08:54:15 -0500, Clifford Kite <(E-Mail Removed)> wrote:
>
> > You guys still missing the point, properly configured linux running
> > modem in _bridge_ mode (PPPoE) will see the IP change and drop all
> > current TCP connections... If you being wimpy and plugging into
> > ADSL modem in 'windows' mode, you deserve what you get )

>
> How about expanding this so we can understand what you really mean.
> As the OP pointed out in his follow-up there is Bridged/DHCP and PPPoE
> ADSL, and you seem to lumped them together. Most ISPs are now using
> PPPoE because it's to their advantage to do so; it offers little,
> if any, benefit to the consumer. And I have no idea what "windows
> mode" means - but then I don't do Windows.


Windows mode: Plug PC into adsl modem and hope for the best
PPPoE: as an end-user, I have little control over ISP, they use it.
Your Bridged/DHCP seems a contradiction, if you running dhcp client
to connect to modem, you running 'windows mode', see?
If you switch the modem into bridge mode, and run PPPoE in linux
box you in full control of connection: 'non-windows mode'.

> Maybe you could point us toward what part(s) can be configured to
> help with this?


iptables: NAT: MASQUERADE vs SNAT, example:

#######################################
# NAT table
# ``````````
# Perform SNAT or MASQUERADE for localnet to world connections

# Difference between SNAT and MASQUERADE?
# SNAT is more efficient for static public IP address and established
# connections will survive a reconnect. MASQUERADE is for dynamic IP
# and established connections are dropped when ADSL goes down as a new
# and probably different IP address is expected on next connection.

function install_nat_table ()
{
# exit if we running local mode -- no connection to world
test "$FIREWALL_MODE" == "local" && return

report " nat: "
if test -n "$IP_WORLD"; then
# Source Network Address Translation for static public IP
iptables -t nat -A POSTROUTING -o $X_WORLD \
-j SNAT --to-source $IP_WORLD
FIREWALL_MODE="world-SNAT"
else
# Masquerade for dynamic public Internet Protocol address
iptables -t nat -A POSTROUTING -o $X_WORLD -j MASQUERADE
FIREWALL_MODE="world-MASQUERADE"
fi
}

--Grant.
 
Reply With Quote
 
Clifford Kite
Guest
Posts: n/a

 
      06-10-2005, 05:36 PM
Grant Coady <(E-Mail Removed)> wrote:
> On Fri, 10 Jun 2005 08:54:15 -0500, Clifford Kite <(E-Mail Removed)>
> wrote:
>>
>> > You guys still missing the point, properly configured linux running
>> > modem in _bridge_ mode (PPPoE) will see the IP change and drop all
>> > current TCP connections... If you being wimpy and plugging into
>> > ADSL modem in 'windows' mode, you deserve what you get )

>>
>> How about expanding this so we can understand what you really mean.
>> As the OP pointed out in his follow-up there is Bridged/DHCP and PPPoE
>> ADSL, and you seem to lumped them together. Most ISPs are now using
>> PPPoE because it's to their advantage to do so; it offers little,
>> if any, benefit to the consumer. And I have no idea what "windows
>> mode" means - but then I don't do Windows.


> Windows mode: Plug PC into adsl modem and hope for the best


That I do understand, but not when "Windows mode" is implicitly
designated as a type of ADSL.

> PPPoE: as an end-user, I have little control over ISP, they use it.


Yes, you have to use what the ISP offers. I understand that.

> Your Bridged/DHCP seems a contradiction, if you running dhcp client
> to connect to modem, you running 'windows mode', see?


No, I don't see. Bridged ADSL (no PPPoE) requires DHCP to get your
dynamic IP address. PPPoE uses PPP IPCP to get your IP address.
In fact the reason PPPoE will never get beyond an "Informational"
RFC is that DHCP already existed and PPPoE isn't necessary at all.

> If you switch the modem into bridge mode, and run PPPoE in linux
> box you in full control of connection: 'non-windows mode'.


Huh?!?

>> Maybe you could point us toward what part(s) can be configured to
>> help with this?


> iptables: NAT: MASQUERADE vs SNAT, example:


> #######################################
> # NAT table
> # ``````````
> # Perform SNAT or MASQUERADE for localnet to world connections


> # Difference between SNAT and MASQUERADE?
> # SNAT is more efficient for static public IP address and established
> # connections will survive a reconnect. MASQUERADE is for dynamic IP
> # and established connections are dropped when ADSL goes down as a new
> # and probably different IP address is expected on next connection.


Well, it does say "established connections will survive a reconnect
with SNAT" but I don't see how that is possible unless a *static*
client IP address is being used. The writer likely had a static IP
address in mind for SNAT but that's mind-set; it can also be used with
dynamic IP addresses - I'm doing it right now over a regular landline
PPP connection, i.e., SNAT using dynamic IP addresses. But have a TCP
connection automatically reestablished itself upon acquiring a different
IP address should the PPP connection go down? I don't think so.

If someone _knows_ that a TCP connection can survive when a different
dynamic IP address replaces a dynamic IP address in the middle of a TCP
connection then please speak up and explain, in detail, how. I'm always
ready to learn.

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
/* 97.3% of all statistics are made up. */
 
Reply With Quote
 
Grant Coady
Guest
Posts: n/a

 
      06-10-2005, 09:08 PM
On Fri, 10 Jun 2005 12:36:48 -0500, Clifford Kite <(E-Mail Removed)> wrote:
>
> Well, it does say "established connections will survive a reconnect
> with SNAT" but I don't see how that is possible unless a *static*
> client IP address is being used.

That _is_ the point I'm making.

> The writer likely had a static IP
> address in mind for SNAT but that's mind-set; it can also be used with
> dynamic IP addresses - I'm doing it right now over a regular landline
> PPP connection, i.e., SNAT using dynamic IP addresses.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--> no can do,
TCP connection lost on IP change, by definition of TCP

Thus you have lingering TCP connections on IP change. Clear now?

> But have a TCP
> connection automatically reestablished itself upon acquiring a different
> IP address should the PPP connection go down? I don't think so.

^^^^^^^^^^^^^^^^^--> me
neither, you miss the point. Visit netfilter.org.

--Grant.
 
Reply With Quote
 
Clifford Kite
Guest
Posts: n/a

 
      06-11-2005, 12:51 PM
Grant Coady <(E-Mail Removed)> wrote:
> On Fri, 10 Jun 2005 12:36:48 -0500, Clifford Kite <(E-Mail Removed)>
> wrote:
>>
>> Well, it does say "established connections will survive a reconnect
>> with SNAT" but I don't see how that is possible unless a *static*
>> client IP address is being used.

> That _is_ the point I'm making.


Okay, then we agree on that. In fact I now think we agree on almost
everything despite some differences in opinion about some terminology
and some mis-interpretations of what the other said by both of us.

Neither of us helps the OP by continual bickering. You posted a
function from a script from netfilter.org which doesn't appear to
directly contribute to solving the OP's problem (I'm referring to
the function not the script). I pointed him to keepalive_* files in
/proc, which I've since come to realize won't do any good unless his
applications can enable TCP keepalive probes and TCP on the server
end implements keepalive code.

I'll offer a couple more suggestions for the OP to consider and then
I'm outta here.

A script that tests for a change of IP address and sends a SIGTERM
signal to all running applications with TCP connections when there
is a change might work, depending on how the applications react
to SIGTERM. You also might (no guarantee) get a better answer by
posting on comp.protocols.tcp-ip.

--
Clifford Kite Email: "echo xvgr_yvahk-(E-Mail Removed)|rot13"
PPP-Q&A links, downloads: http://ckite.no-ip.net/
/* Bluffing in a poker game can win big; bluffing in a newsgroup
only attracts sharks. */
 
Reply With Quote
 
Mario Moder
Guest
Posts: n/a

 
      06-11-2005, 06:07 PM
Clifford Kite wrote:
> the function not the script). I pointed him to keepalive_* files in
> /proc, which I've since come to realize won't do any good unless his
> applications can enable TCP keepalive probes and TCP on the server
> end implements keepalive code.


After reading the spare information [1] about these files, I agree
with you. After all, I do also think the linux networking and tcp/ip
settings need no change, although it's good to know that some settings
_can_ be tweaked for special cases. I don't consider my problem a
special case because I guess there are many DSL users with dynamic IP
address assignment and forced 24h-disconnect by the provider, at least
in Germany.

Since there was missing information from my side, I want to fill this
gap: My ADSL modem is connected through eth0 and I use pppd on my
linux box to establish the PPPoE connection. No router or firewall in
between.

> I'll offer a couple more suggestions for the OP to consider and then
> I'm outta here.


Thank you ;-)

> A script that tests for a change of IP address and sends a SIGTERM
> signal to all running applications with TCP connections when there
> is a change might work, depending on how the applications react


That's the idea that was first in my mind because I already know
applications which do indeed react in such way when receiving a
SIGTERM or SIGHUP signal. I also know apps which do check for server
connection every minute.

Conclusion from my side: If an application needs 20 minutes to realize
that the server is not responding on a certain TCP connection, it's
not the networks fault.

> to SIGTERM. You also might (no guarantee) get a better answer by
> posting on comp.protocols.tcp-ip.


Uhh! The guys there will raise a sunken smile if I tell them to change
the TCP/IP protocol because some apps don't react on IP address change
;-)

Seriously, I will look what I can do at the application level before I
ask there about the best tcp/ip settings for my case.

Thanks for your replies.

Mario



[1] http://ipsysctl-tutorial.frozentux.n...tml/index.html

--
http://oddfellow.endofinternet.org/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mac Address Change JDavidson Wireless Internet 28 06-19-2006 08:58 PM
permanently change wireless network connections bwalt Wireless Networks 0 03-15-2006 01:26 PM
change MAC address can change IP address of a machine? apngss@yahoo.com Linux Networking 7 01-05-2006 11:09 PM
change MAC address can change IP address of a machine? apngss@yahoo.com Wireless Internet 7 01-05-2006 11:09 PM
How to change MAX number of network connections whoha Linux Networking 5 02-09-2005 12:30 PM



1 2 3 4 5 6 7 8 9 10 11