?
Solved

Linux Packet Forwarding

Posted on 2008-11-06
4
Medium Priority
?
959 Views
Last Modified: 2010-04-21
Can linux forward packets back through the same interface they came?  If so, how can this be accomplished with routes?  Thanks.
0
Comment
Question by:MainStaySolutions
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
easyDK earned 500 total points
ID: 22901083
May be helpfull to get at least part of topology, but generally said, it is possible to route thru the same interface. If we do have two networks directly connected:
route add -net xx.xx.xx.0 netmask y.y.y.0 dev eth0
route add -net aa.aa.aa.0 netmask b.b.b.0 dev eth0

If there's gateway to one of the networks on the way, use
route add -net xx.xx.xx.0 netmask y.y.y.0 gw zz.zz.zz.zz

Don't forget to switch on packet forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
0
 
LVL 43

Assisted Solution

by:ravenpl
ravenpl earned 500 total points
ID: 22902917
Yes it can, use normal routing rules.
But mind, that if the connection gets SNATed or DNATed on the router as well - both actions are required SNAT and DNAT.
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 22902924
Oh, one more thing, linux by default does not route such packets, but sends redirect to the sending device (so it knows there shorter path). To disable this
for f in /proc/sys/net/ipv4/conf/*/send_redirects; do echo 0 > $f; done
0
 

Author Closing Comment

by:MainStaySolutions
ID: 31514145
Thank you for the quick response.
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
Fine Tune your automatic Updates for Ubuntu / Debian
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses
Course of the Month14 days, 8 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question