LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2012, 09:30 AM   #1
franmf
LQ Newbie
 
Registered: Oct 2012
Posts: 28

Rep: Reputation: Disabled
Need to "cheat" my router to make it think IP X.X.X.X is through another gateway.


Hi, I'm finishing my degree project. What I have to do left is to "cheat" my router in order to make it think IP X.X.X.X is through another gateway.

I'm doing a sniffer in C, which has to sniff every packet passing through the router, and detect where they go to. If they go to any PC in the private net, and that PC is asleep, the sniffer itself WAKES IT UP.

so, supposing I have the next net:

http://img443.imageshack.us/img443/999/sinttulo2de.png

If PC4 fells asleep, when PC3 sends a packet to PC4, this frame doesn't go to the router, because S has its own arp table and knows where has to go the packet to. If PC4 is asleep and PC3 sends a packet to PC4, my sniffer will never detect that packet. If I make that broadcast, S will think PC4 is going UP, so will send the packet from PC3 to PC4 up there, and the router will sniff it.

You have to know that the proccessor is in the router and my sniffer is executed in that proccessor. That's the reason why I need to send the packets up there.

So my question is, how can I create a Broadcast packet? and how can I send it? thank you.

Sorry for my english, is quite hard for me to explain such things. Thanks in advanced.

edit: the draw cant be seing as expected. Doing a new one.

Last edited by franmf; 12-08-2012 at 07:00 AM.
 
Old 12-08-2012, 05:43 AM   #2
tallship
Member
 
Registered: Jul 2003
Location: On the Beaches of Super Sunny Southern San Clemente, California USA
Distribution: Slackware - duh!
Posts: 534
Blog Entries: 3

Rep: Reputation: 118Reputation: 118
Question

Does this help?

Code:
..........................ROUTER--------internet
.............................|
..............---------------------------------
...............|...........|.............|............|
.............PC1........PC2...------S-----....PC5
.................................|.............|
...............................PC3 ........PC4
S=switch.
 
Old 12-08-2012, 06:59 AM   #3
franmf
LQ Newbie
 
Registered: Oct 2012
Posts: 28

Original Poster
Rep: Reputation: Disabled
http://img443.imageshack.us/img443/999/sinttulo2de.png

the draw was not important, sorry anywany

Last edited by franmf; 12-08-2012 at 07:00 AM.
 
Old 12-08-2012, 07:41 AM   #4
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Can you specify, that you can do anything with this PC which start communication (for example PC3) or you can only make changes on router? If latter then you can't force PC3 to send broadcast or send packets to computer on the same network through router.
 
Old 12-08-2012, 11:29 AM   #5
franmf
LQ Newbie
 
Registered: Oct 2012
Posts: 28

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by eSelix View Post
Can you specify, that you can do anything with this PC which start communication (for example PC3) or you can only make changes on router? If latter then you can't force PC3 to send broadcast or send packets to computer on the same network through router.
I'll explain the best I can. the router has it's own arp table, and the router has a different one. The arp table knows which IPs are connected to which gateway. So if the switcher(the arp table from the switcher, I mean) think PC4 is through gateway 1 it will send the packets to that gateway. If that happens, the packets will never pass through the router, which is the same, through the proccessor, where my sniffer is executing.

If each time PC4 fells asleep, the router detects it (I've already done that) and sends a broadcast to any PC connected in the private net making them think that PC4 is himself. So each time any PC will send a packet to PC4, they will guide them to the router and not to the real gateway and my sniffer will be able to detect that any PC is sending packets to PC4, so it can wake PC4 up. Once a packet arrives to the router asking if he is PC4, and the router says ( NO, I AM THE ROUTER STUPID :P ), then PC3 will send a broadcast asking who is really PC4.

Of course, that first packets will get lost, and the PCX will have to send them again, but that is not a problem.

edit: sot what I need is to know HOW can I create that broadcast packet making all PCs to know that PC4 is the router, when it isn't.
 
Old 12-08-2012, 07:32 PM   #6
sarin
Member
 
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2

Rep: Reputation: 34
I did not understand your questions well. But, is this what you want? http://en.wikipedia.org/wiki/ARP_spoofing
 
Old 12-09-2012, 09:00 AM   #7
franmf
LQ Newbie
 
Registered: Oct 2012
Posts: 28

Original Poster
Rep: Reputation: Disabled
I think that is not what I want.

To sum up, I need to send a broadcast where I can modify IP SOURCE field.
 
Old 12-11-2012, 10:48 AM   #8
franmf
LQ Newbie
 
Registered: Oct 2012
Posts: 28

Original Poster
Rep: Reputation: Disabled
Does anyone know how to create a broadcast packet from a raw socket? maybe I'll be able to do something from that
 
Old 12-11-2012, 05:47 PM   #9
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
You create broadcast packet by changing destination IP to broadcast IP, for example 192.168.1.255 in 192.168.1.0/24 network and setting all "1" on MAC address. But I don't think it will help you. If you change IP, then you lose information about real destination.

If you want exactly that: "make all PCs and switches on network which want to send packets to PC4 - send it to Router" then ARP spoofing is the answer. This is not a proper way to accomplish your task, because for example some PCs might be protected against address spoofing or alert their administrators.
 
  


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
kernel make error: "vmlinux.o no such file ..." and make -d "Reaping losing ..." micscherer Linux - Kernel 3 06-12-2012 07:29 AM
Quick, Easy "Security Cheat Sheet" for new Centos 5.4 VPS? paulsm4 Linux - Security 5 04-26-2010 02:19 PM
Where should I configure the default gateway, "ifcfg-eth0" or "network"? huntkey Linux - Server 5 01-05-2009 09:41 AM
discovered easy "cheat" to get slackware installed with raid nemestrinus LinuxQuestions.org Member Success Stories 0 01-02-2007 11:51 PM
Constant errors during "make" or "make install" with SUSE 10.1 Alpha 4 TehFlyingDutchman Linux - Software 3 12-30-2005 06:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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