LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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-23-2002, 05:46 PM   #1
Cubiq
Member
 
Registered: Jan 2002
Location: Europe, Romania
Distribution: Slackware 9.1
Posts: 81

Rep: Reputation: 15
TTL change


I want to change the TTL field of the packets who go out from my Linux box. I tried
iptables -t nat -A POSTROUTING -j TTL --ttl-set xxx
and when I set xxx to any positive number(i tried for example 150) all I cant get it's an error who says that cannot find chain/match/... and smth.!!!
why???? the syntax seem quite good to me???
I have iptables 1.2.7 and kernel 2.4.20-pre2!
 
Old 08-25-2002, 08:18 PM   #2
estel
LQ Newbie
 
Registered: Aug 2002
Distribution: slackware 8.0
Posts: 21

Rep: Reputation: 15
From the iptables manpage:

TTL
This target is used to modify the time to live field in the IP header. It is only valid in the mangle table.

nat != mangle
 
Old 08-27-2002, 05:10 PM   #3
Cubiq
Member
 
Registered: Jan 2002
Location: Europe, Romania
Distribution: Slackware 9.1
Posts: 81

Original Poster
Rep: Reputation: 15
ooops! sorry... bad posting... of course -t mangle...!!! I give:
iptables -t mangle -A POSTROUTING -j TTL --tll-set xxx
what is really strange is that if I say --ttl-dec 0 it says that 'decreasing by 0?' and whan I give a positive natural value it says: 'iptables: No chain/target/match by that name'!!!
what the HELL???
 
Old 08-27-2002, 05:22 PM   #4
estel
LQ Newbie
 
Registered: Aug 2002
Distribution: slackware 8.0
Posts: 21

Rep: Reputation: 15
Can you actually copy and paste the line? Cause I can't tell whether '--tll-set' is what you're actually trying (which of course won't work), or whether that's just a typo.
 
Old 08-27-2002, 11:01 PM   #5
estel
LQ Newbie
 
Registered: Aug 2002
Distribution: slackware 8.0
Posts: 21

Rep: Reputation: 15
Also, again according to the tables section of the iptables manpage:

mangle
This table is used for specialized packet alteration. It has two built-in chains: PREROUTING (for altering incoming packets before routing) and OUTPUT (for altering locally-generated packets before routing).

Note postrouting is missing. Have you tried -A OUTPUT? (I would test it out for you but I don't have TTL target compiled.
 
Old 08-28-2002, 06:38 AM   #6
Cubiq
Member
 
Registered: Jan 2002
Location: Europe, Romania
Distribution: Slackware 9.1
Posts: 81

Original Poster
Rep: Reputation: 15
the mangle table has 5 built-in chains:
PREROUTING, INPUT, FORWARD, OUTPUT, POSTROUTING and I've tried -A OUTPUT and the result was the same!!!
 
Old 08-29-2002, 01:07 PM   #7
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 47
Been there.

There is a kernel patch needed for the -j TTL target.
It adds another netfilter option before you compile a new kernel...

Check http://www.netfilter.org/documentati...-base.html#TTL for more details.
and you need to enter
iptables -t mangle -I PREROUTING -i ethinternal -j TTL --ttl-set xxx
EVERY forwarded packet has to come into the box via mangle prerouting, so it's done there. For locally generated packets use the OUTPUT chain.

You will need to adjust the --ttl-set xxx value to make them match. There is a different decrement in each chain.

Regards,
Peter

Last edited by peter_robb; 08-29-2002 at 01:15 PM.
 
Old 08-29-2002, 04:53 PM   #8
Cubiq
Member
 
Registered: Jan 2002
Location: Europe, Romania
Distribution: Slackware 9.1
Posts: 81

Original Poster
Rep: Reputation: 15
if you are so kind to instruct me how to apply the patch I'll be very greatfull...!!!
 
Old 08-30-2002, 03:22 AM   #9
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 47
WOW,
how to compile a new kernel?

Best start on the netfilter site and read the two help files about the TTL target.
It's a fairly big subject making a custom kernel.

Regards,
Peter
 
Old 08-30-2002, 04:55 PM   #10
Cubiq
Member
 
Registered: Jan 2002
Location: Europe, Romania
Distribution: Slackware 9.1
Posts: 81

Original Poster
Rep: Reputation: 15
thanks for advice but I know how to compile a new kernel... but the problem is that I really don't know how to patch him with that patch-o-matic. I've read those help files and... I'm still ... confused! Something is missing...!!! please be so kind and give me some hints...(maybe I should transfer the thread to Software forum... should I?!)
 
Old 08-31-2002, 07:36 AM   #11
Cubiq
Member
 
Registered: Jan 2002
Location: Europe, Romania
Distribution: Slackware 9.1
Posts: 81

Original Poster
Rep: Reputation: 15
problem solved! thanks for help! I've downloaded patch-o-matic form www.netfilter.org and that's all..!
 
Old 08-13-2006, 04:50 PM   #12
How_to_set_TTL
LQ Newbie
 
Registered: Aug 2006
Posts: 1

Rep: Reputation: 0
Will this configuration work?

I don't mean to gravedig maliciously, but I understand that if I type the following in console as root

iptables -t mangle -A PREROUTING -i eth0 -j TTL --ttl-set 64
iptables -t mangle -A OUTPUT -j TTL --ttl-set 64


Then all packets will leave my machine with a TTL equal to 63 ?

Am I correct? Will packets routed from PCs within my internal network be have indistinguishable TTL from those generated by the gateway?

I'm runninng SUSE 10.0 a 2.6.x kernel
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
IP TTL help SBK_bg Linux - Networking 2 09-29-2005 10:18 AM
Dns TTL (?) JJX Linux - Networking 0 11-03-2004 03:52 PM
TTL for kernel 2.6.6 kingka Linux - Networking 2 06-03-2004 02:01 PM
How to change TTL value? etvagonema Linux - Networking 2 04-19-2004 12:55 PM
TTL way to high! Athlon_Jedi Linux - Networking 21 05-24-2003 09:50 AM


All times are GMT -5. The time now is 11:56 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration