Linux - Networking This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
09-03-2009, 02:30 PM
|
#1
|
Member
Registered: Feb 2007
Location: /home
Distribution: Kubuntu and CentOS
Posts: 214
Rep:
|
pass traffic externally across two local interfaces?
I have a box with two interfaces. I want to send traffic out one network interface, on to the network, and have the traffic's destination be the other interface.
Example (this doesnt work how I want it to, but is essentially what I want to achieve):
ifconfig eth0 192.168.1.1/24
ifconfig eth1 192.168.1.2/24
route add -host 192.168.1.1/32 dev eth1
route add -host 192.168.1.2/32 dev eth0
From the machine ping 192.168.1.1
Sniff the network, see ICMP traffic leaving eth1 with a destination of 192.168.1.1, see ICMP replies leaving eth0 with a destination of 192.168.1.2
How can I go about doing this?
|
|
|
09-03-2009, 03:33 PM
|
#2
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,228
|
mebbe put a server using eth1, set eth0 as default route? A crossover cable might be helpful.
Things do this all the time with 127.0.0.1. I take it you are up to throughput tests, or something really weird.
We do collect nutty stories, you know ;-)
|
|
|
09-03-2009, 03:49 PM
|
#3
|
Member
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891
Rep:
|
Why would you do this? The only reason I can think of is that you want to test your routers. The easy way is just to run virtualbox and assign the second nic to a virtual host.
|
|
|
09-03-2009, 04:05 PM
|
#4
|
Member
Registered: Feb 2007
Location: /home
Distribution: Kubuntu and CentOS
Posts: 214
Original Poster
Rep:
|
Business kid:
Thanks for the response. Yes, I am going to be doing some throughput testing across different devices. As these devices are switches, a cross over cable wont help much. As for the suggested routing, I don't see that will be any better solution than what I suggested for routing in my original example.
Granted I am not a kernel expert, but I believe that what is happening is the kernel is taking a short cut. My guess is that the kernel looks at the IP destination and recognizes it to be a local interface. Then the kernel just gives the packet to that interface, instead of looking at the routing table. If this is truly the case, I need to stop the kernel from doing this pre-emptive routing.
I am currently looking at iptables, hoping that my solution can be found there.
any comments or observations are welcome.
|
|
|
09-03-2009, 04:15 PM
|
#5
|
Member
Registered: Feb 2007
Location: /home
Distribution: Kubuntu and CentOS
Posts: 214
Original Poster
Rep:
|
baldy:
In the past, virtualization is how I solved this problem; 1 host machine with 2 interfaces, 2 vm instances, each vm instance has 1 of the 2 interfaces.
This time I will have A LOT of interfaces and an box that probably cant handle 2 (or more) vm instances.
This box will be a tool, for pushing bandwidth across wireless and wired devices.
|
|
|
09-04-2009, 04:12 AM
|
#6
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,228
|
My concern would be that the more hacking you do, the further away from a normal situation you get.
Why not use a second box?
|
|
|
09-04-2009, 10:50 AM
|
#7
|
Member
Registered: Feb 2007
Location: /home
Distribution: Kubuntu and CentOS
Posts: 214
Original Poster
Rep:
|
Ya I'm leaning towards that solution as well.
|
|
|
09-05-2009, 04:02 AM
|
#8
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,228
|
It occurs to me as worth trying to remove the 'lo' interface allowing networking to 127.0.0.1 and have one last shot at doing it on a single box.
|
|
|
09-05-2009, 05:56 AM
|
#9
|
LQ Newbie
Registered: Mar 2005
Posts: 8
Rep:
|
Not sure if it is possible, but you can also try this.
[Host-A IP]<--- NET-A--->[RTR]<--- NET-B --->[Host-B IP]
Here Host A and Host B are IPs on 2 NICs.
Here instead of sending traffic from Host-A to Host-B, send the traffic from Host-A to NET-B (may be just a single /32 host in NET-B) and from Host-B to NET-A.
On the router in the middle (or DUT), route the traffic for NET-A towards Host-A and for NET-B towards Host-B.
On Host-A, do a destination NAT for NET-A IP to Host-A IP.
On Host-B, do a destination NAT for NET-B IP to Host-B IP.
On Host-A, do a source NAT for Host-A IP to NET-A IP
On Host-B, do a source NAT for Host-B IP to NET-B IP
You should be able to do this with simple routes and NATs using IPTABLES.
|
|
|
All times are GMT -5. The time now is 11:41 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|