Linux network architecture - local network vs. LAN network rule
Hello,
I have a question linked to the local delivery of packets for Linux Kernel. My question is linked to network features. I've two ethernet interfaces (eth0 and eth1), I want to send a packet from eth0 to eth1 and force it to be routed on the LAN network by a router or another computer. (as shown below) On the computer 2, I've launched wireshark and a simple C program which listen on a UDP port and redirect the UDP message to another Ip address (simple ip redirection) Code:
+++++++++++ Is it possible to force the Linux Kernel to send it on the "outside" network? If yes, how can I do it? After reading Linux network architecture articles on google, I've thought to modify the ip_rcv / ip_route_input functions in order to force it to go on the LAN Network. Thanks for your help. |
Hi, and welcome!
Yes, you're correct: the kernel normally routes such packets internally, without sending them out on the wire. I believe you can change this with some setting changes and appropriate routing, though. First, let's look at routing. You have to force the traffic out of the system. Let's assume eth0 has IP address 192.168.1.1, and eth1 has IP 192.168.1.2. Fix the routing with: Code:
route add -host 192.168.1.2 dev eth0 Code:
sysctl -w net.ipv4.conf.eth0.accept_local=1 References: - https://www.kernel.org/doc/Documenta.../ip-sysctl.txt - https://stackoverflow.com/questions/...al-doesnt-work Good luck! |
Thanks a lot for your reply and the references.
I'll check it and let you know if it's work or not. |
All times are GMT -5. The time now is 09:03 AM. |