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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
12-07-2012, 09:30 AM
|
#1
|
|
LQ Newbie
Registered: Oct 2012
Posts: 28
Rep: 
|
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.
|
|
|
|
12-08-2012, 05:43 AM
|
#2
|
|
Member
Registered: Jul 2003
Location: On the Beaches of Super Sunny Southern San Clemente, California USA
Distribution: Slackware - duh!
Posts: 513
Rep: 
|
Does this help?
Code:
..........................ROUTER--------internet
.............................|
..............---------------------------------
...............|...........|.............|............|
.............PC1........PC2...------S-----....PC5
.................................|.............|
...............................PC3 ........PC4
S=switch.
|
|
|
|
12-08-2012, 06:59 AM
|
#3
|
|
LQ Newbie
Registered: Oct 2012
Posts: 28
Original Poster
Rep: 
|
Last edited by franmf; 12-08-2012 at 07:00 AM.
|
|
|
|
12-08-2012, 07:41 AM
|
#4
|
|
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Kubuntu
Posts: 1,045
|
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.
|
|
|
|
12-08-2012, 11:29 AM
|
#5
|
|
LQ Newbie
Registered: Oct 2012
Posts: 28
Original Poster
Rep: 
|
Quote:
Originally Posted by eSelix
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.
|
|
|
|
12-08-2012, 07:32 PM
|
#6
|
|
Member
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 351
Rep:
|
I did not understand your questions well. But, is this what you want? http://en.wikipedia.org/wiki/ARP_spoofing
|
|
|
|
12-09-2012, 09:00 AM
|
#7
|
|
LQ Newbie
Registered: Oct 2012
Posts: 28
Original Poster
Rep: 
|
I think that is not what I want.
To sum up, I need to send a broadcast where I can modify IP SOURCE field.
|
|
|
|
12-11-2012, 10:48 AM
|
#8
|
|
LQ Newbie
Registered: Oct 2012
Posts: 28
Original Poster
Rep: 
|
Does anyone know how to create a broadcast packet from a raw socket? maybe I'll be able to do something from that
|
|
|
|
12-11-2012, 05:47 PM
|
#9
|
|
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Kubuntu
Posts: 1,045
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:19 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|