LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-02-2007, 04:32 PM   #1
iiv
Member
 
Registered: Jun 2007
Location: Russia, Moscow Region
Distribution: Slackware
Posts: 167

Rep: Reputation: 30
iptables TTL change does not work


There are two linux boxes on my network. 192.168.168.51 is a router and has a vpn-connection, 192.168.168.50 is a guest
this is done on 192.168.168.51:
Code:
echo 1 > /proc/sus/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.168.50 -o ppp0 -j MASQUERADE
iptables -t mangle -A POSTROUTING -s 192.168.168.50 -o ppp0 -j TTL --ttl-inc 1
this on 192.168.168.50:
Code:
ip route add default via 192.168.168.51
ping somehost from 192.168.168.51:
Code:
64 bytes from somehost: icmp_seq=1 ttl=61 time=4.33 ms
and ping somehost form 192.168.168.50:
Code:
64 bytes from somehost: icmp_seq=1 ttl=60 time=5.59 ms
So, ttls differ, but should be equal.

Yes, I am trying to hide from my ISP, though it is legal for my case, don't want them to spot me. Please help.
kernels are 2.6.23 for 192.168.168.51 and 2.6.23.8 for 192.168.168.50

Last edited by iiv; 12-02-2007 at 04:39 PM.
 
Old 12-03-2007, 06:28 AM   #2
krock923
Member
 
Registered: Jul 2004
Posts: 171

Rep: Reputation: 30
Aren't you seeing the echo reply? I believe that what you are doing changes the ttl on the echo request. It makes perfect sense that the ttl is different on the reply, since it is going through a router, which as you know will decrement the ttl. But, to see if it's working, you need to watch the ping from 192.168.168.50 as it leaves 192.168.168.51
 
Old 12-03-2007, 08:52 AM   #3
iiv
Member
 
Registered: Jun 2007
Location: Russia, Moscow Region
Distribution: Slackware
Posts: 167

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by krock923 View Post
Aren't you seeing the echo reply? I believe that what you are doing changes the ttl on the echo request. It makes perfect sense that the ttl is different on the reply, since it is going through a router, which as you know will decrement the ttl. But, to see if it's working, you need to watch the ping from 192.168.168.50 as it leaves 192.168.168.51
Hm... Forgot that packets are returning, not emerging... So, i did on 192.168.168.51:
Code:
iptables -t mangle -A POSTROUTING -d 192.168.168.50 -j TTL --ttl-inc 1
and it did the trick backwards.


Is chain POSTROUTING only for passing through packets? Or does it work for local?
 
Old 12-03-2007, 08:57 AM   #4
krock923
Member
 
Registered: Jul 2004
Posts: 171

Rep: Reputation: 30
I believe that it is only for packets that are forwarded, but I am not one hundred percent sure of that.
 
  


Reply

Tags
iptables, ttl


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
How to change the TTL Value? Chiranjib Pal Linux - Networking 11 08-17-2007 09:17 PM
change ttl number in a router pusrob Linux - Networking 4 08-16-2007 07:56 AM
change TTL luboiron Slackware 1 12-18-2006 06:27 PM
TTL change Cubiq Linux - Networking 11 08-13-2006 03:50 PM
How to change TTL value? etvagonema Linux - Networking 2 04-19-2004 11:55 AM


All times are GMT -5. The time now is 01:47 AM.

Main Menu
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