LinuxQuestions.org
Visit Jeremy's Blog.
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 04-13-2005, 09:24 AM   #1
Soulstealer
Member
 
Registered: Dec 2004
Location: Necropolis
Distribution: FreeBSD
Posts: 47

Rep: Reputation: 15
Question "stealth" routing HOWTO


Hi, guys
I was wondering how can I achieve such routing as the FreeBSD's ipstealth.
In other words, how can I make my linux to route like FreeBSD with ipstealth option compiled? I want my linux kernel not to touch the TTL value when routing internet. Can anyone tell me ? In *BSD is easy, but in linux ?

thank you
 
Old 04-13-2005, 10:55 AM   #2
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
Hack /usr/src/linux/net/ip_forward.c, comment ip_decrease_ttl(iph); and recompile your kernel.

If you're trying to hide it from tracert (that is, Microsoft's traceroute) you can DROP ICMP type 11. That will only work against tracert though (the *NIX traceroute uses UDP).

HTH
 
Old 04-13-2005, 11:07 AM   #3
Soulstealer
Member
 
Registered: Dec 2004
Location: Necropolis
Distribution: FreeBSD
Posts: 47

Original Poster
Rep: Reputation: 15
Thank you!
I only need the TTL value untouched, I don't care about traceroute.

I have to recompile only the bzImage not the modules, right ?
 
Old 04-13-2005, 11:14 AM   #4
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
Depends on how your kernel config is set up. I'd do both (not knowing what you have as modules), but you can try the bzImage first. The worst it can do is not work (or panic the machine ) ...

Out of morbid curiosity -- If you're not trying to hide from traceroute, what's the point?

Last edited by sigsegv; 04-13-2005 at 11:16 AM.
 
Old 04-13-2005, 11:59 AM   #5
Soulstealer
Member
 
Registered: Dec 2004
Location: Necropolis
Distribution: FreeBSD
Posts: 47

Original Poster
Rep: Reputation: 15
OK, I've test it.
It works, but not quite...
First let me tell you why I'm doing this.
So...receive every packet from my ISP with TTL=0, originally this prevents NAT-ing,
I've patched my kernel with patch-o-matic for TTL target supprt and set the TTL to some other value so my machines behind the router have internet now.
But the "TTL target support" exercise is too boring, I need something quick and easy
In FreeBSD is very easy, just compile the kernel with ipstealth and everything is fine
So I want something like ipstealth in linux

sigsegv, I've test that you told
and it's work when there is some value different from zero
I set the TTL to 128 and a machine behind the router receives TTL=127
that was before
with my new kernel
the machine receives 128
but when I flush iptables, the TTL goes back to zero and the machines behind the router don't receive anything...
With FreeBSD they received same as the router (TTL=0)

any idea what's wrong ?

thank you
 
Old 04-13-2005, 04:46 PM   #6
stonux
Member
 
Registered: Oct 2003
Distribution: SuSE, RH
Posts: 55

Rep: Reputation: 15
Code:
        /*
         *      According to the RFC, we must first decrease the TTL field. If
         *      that reaches zero, we must reply an ICMP control message telling
         *      that the packet's lifetime expired.
         */

        iph = skb->nh.iph;
        rt = (struct rtable*)skb->dst;

        if (iph->ttl <= 1)
                goto too_many_hops;
2 ugly things:
- there is a goto command
- (iph->ttl <= 1) also triggers for ttl=0 and ttl=1
Comment out
Code:
        if (iph->ttl <= 1)
                goto too_many_hops;
too, to ignore ttl (dangerous!! may cause packets to loop infinitely on your network, especially if you do it on more than one machine or the machine sends junk to itself).
 
Old 04-13-2005, 05:14 PM   #7
Soulstealer
Member
 
Registered: Dec 2004
Location: Necropolis
Distribution: FreeBSD
Posts: 47

Original Poster
Rep: Reputation: 15
stonux, these two lines are just condition
if TTL=0/1 it sends ICMP for expiration or something...
this have nothing to do with the IP header
and there is no reason of "looping infinitely"
sorry, but I thing you are generally wrong
read again my previous post
 
Old 04-14-2005, 03:20 AM   #8
Soulstealer
Member
 
Registered: Dec 2004
Location: Necropolis
Distribution: FreeBSD
Posts: 47

Original Poster
Rep: Reputation: 15
Come on guys
I don't believe that noone knows!
 
Old 04-17-2005, 11:17 AM   #9
stonux
Member
 
Registered: Oct 2003
Distribution: SuSE, RH
Posts: 55

Rep: Reputation: 15
I'm not talking at an endless loop in the code.
I'm talking about packets endlessly loop on the network.
The reason why TTL has been introduced is not to prevent
ISP customers from NATting :-).
I just suspect that this "if" statement drops the packets.
 
Old 04-18-2005, 07:06 AM   #10
Soulstealer
Member
 
Registered: Dec 2004
Location: Necropolis
Distribution: FreeBSD
Posts: 47

Original Poster
Rep: Reputation: 15
Man, sorry, but I think you are nuts
I know what you mean!
But you are wrong.
How do you imagine this:
Quote:
packets endlessly loop on the network.
?

And about ISPs...
they don't really care about the reason why TTL field exists in the IP header. They just use it to prevent most of the clients to use NAT (although I can't see a method or technique an ISP can use to prevent some advanced UNIX user to NAT, but OK, let them set TTL=0 )

stonux, no offence meant !
I just don't agree with you
sorry
 
  


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
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 11:26 AM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM
have to ping gateway to "kickstart" net connection and routing bPrompter Linux - Networking 0 01-19-2005 02:56 PM
"stealth" system process slamming cpu 360 Linux - General 4 11-24-2004 12:04 PM
Howto disable "Graphical Login" or "Standard Login?" the_gripmaster Red Hat 1 07-08-2004 02:55 PM

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

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