LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-06-2014, 08:17 AM   #1
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
forcing packet to be send via device


I have several routers A,B,C,... located in remote sites behind firewall(s) and main host X (with public IP).

The routers A,B,C,... are connected to X with various tunnels creating star-like topology with X being a central point.

In general it is possible to communicate between each A,B,C,... router and X.

Routers A,B,C,.. are used as a connection points for mobile measurent devices.

Due to the configuration difficulty each measurement device can have only one pre-configured local unique IP from the class 192.168.10.0/24.

Any of the measurment device can be attached/detached to any of the A,B,C,... routers at any moment.

When the measurement device is attached to the network it starts to send a series of UDP packets.

I can see these packets from currently attached devices at X host.

I am able also to detect which way the device is sending data i.e. which the router is involved in the communication i.e. which tunnel is in use.

But I have problem to send back the reply to the device(s) since I am not able to use fixed routing policy.

The constant routing policy is not adequte since for a moment the device can be moved to another location(s) and connected to another router (btw: the measurment devices are using wifi as a media for communication with the routers so location change and establishing new network access is very easy)

The solution would be the possiblity of sending the reply packet(s) via programmatically defined interface rather than relying on constant routing table.

The question:
Is it possible to send any packet along with extra information about the interface which should be used as a route?

I would like to avoid the necessity of permanent routing table change each time the measurment device is moved to another location.

In other words: how to force a packet to be sent via device without respective entry in routing table?

Any suggestions will be appreciated.
 
Old 07-09-2014, 04:26 PM   #2
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 38
It sounds like an uncommon thing but perhaps a hub vs a switch may work. This way the traffic is sent to all routers, the one that sees it will reply.
 
Old 07-09-2014, 04:50 PM   #3
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Original Poster
Rep: Reputation: 32
Of course bridge-like solutions will work but I am interested in sending packets directly to the destination only (i.e. via interface the measurement device being involved in communication) rather than "brodcasting" them to all.

Let's imagine that someone incorrectly configured two measurement devices (with same IPs).

Having the method of sending packet via specific interface I am able to communicate with both of them despite IP conflict...

What is more I can programmatically detect and report this conflict.
 
Old 07-09-2014, 05:06 PM   #4
kentyler
Member
 
Registered: Dec 2008
Location: Newark Ohio
Distribution: Fedora Core
Posts: 270

Rep: Reputation: 38
Without using some sort of Linux software in a Linux router that was designed to do exactly what you want to do by detecting packets and creating dynamic routes then you have exhausted your options as stated in the posts above.

I've been a network engineer for 30+yrs so..
 
Old 07-09-2014, 05:27 PM   #5
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
How sophisticated are your measurement devices? Any chance they could autonomously open/maintain a reverse ssh tunnel to X? Then when you want to connect to a device, you don't care about what its IP is or what router it's behind, you just connect through its tunnel.

This is what I do on our remote systems. It gets past all of the nastyness of hopping through intermediate machines, port forwarding, etc. As soon as the system boots up, it opens a reverse ssh tunnel to one of the servers at our office, with a port that's unique to that device (based on serial number). I don't care where the device is or what network it's behind, to connect to it I just connect to its tunnel. These are pretty advanced devices running a relatively modern 60+ MB embedded Linux distro with lots of bells and whistles, though.

Last edited by suicidaleggroll; 07-09-2014 at 05:29 PM.
 
Old 07-10-2014, 02:41 AM   #6
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Original Poster
Rep: Reputation: 32
Thanks a lot for suggestion but it will not work for me.

The devices are not designed for any software changes. I am happy that they are equipped with wifi and are able to smoothly reconnect.

Therefore it is a must to use intermediate routers which forward data to/from device in the way which is possible at a site (the tunnel type depends on policy of the internet service provider).
More "sofisticated" functions are done at routers.
And it works with the problem of "back transmission" which forces me to permanently mangle routes.

Therefore I've placed the post in programming section with hope to get answer on topic question: how to force the packet to be sent via selected interface?

Last edited by dorian33; 07-10-2014 at 02:48 AM.
 
  


Reply

Tags
routing



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
SFTP argument to pass to send self IP address in sftp packet send to establish con. vjdjsingh Linux - Networking 4 04-26-2014 02:35 AM
Forcing a reset on a USB device Jeff91 Linux - Hardware 1 06-08-2009 09:54 AM
Forcing Device ID logic-phyber Fedora 5 07-16-2006 05:59 PM
how to send datas to HID device?why I can only send two bytes data to HID device? wch_zj Linux - Software 1 01-05-2006 07:14 AM

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

All times are GMT -5. The time now is 04:39 PM.

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