Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything 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.
Hi all,
I'm writing a simple netfilter hook module to redirect the traffic thru a tunnel between 2 machines (B and C)
Assume that i dont want to config netfilter/iptable to do anything.
The path looks like:
A-----B-------C----D
Assume on A, i add a route to forward packet (from A<->D) to B
and on D, i add a route to forward packet (from A<->D) to C
My module will be running on machines B and C.
Here are the steps what i do in my module (running on B and C)
On machine B:
1. capture packet at NF_IP_PRE_ROUTING
2. receive packet from A->D
3. append one more ip/tcp headers from B->C to the packet
4. send it out
On machine C:
after i receive the packet, i will
5. remove the external ip/tcp headers
6. send it out to D
My question is at steps 3 and 5, after append/remove the packet and recalc the checksum, do i have to do something else relate to the socket/sock owner?
Are you going to do the whole processing (appending headers and removing them) in the module or you plan to get it all out via sockets (on B and C)? Also, what kind of encapsulation do you think about? Remember, more complicated protocols mean more processing needed from your module. I think that IP over IP would be enough in most cases.
You don't have to use any specific function to send it. You'll probably write a target. It doesn't really matter. What matters is the result (code) returned by your functions.
You just need to fill the packet (and the checksums). No need to run more things, with an exception, of course, when you need a specific thing done.
BTW In 2.6 there's ipt_REDIRECT. It may be interesting for you.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.