Need to "cheat" my router to make it think IP X.X.X.X is through another gateway.
ProgrammingThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.