From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Robert P. J. Day" Subject: Re: how to (cross)connect two (physical) eth ports for ping test? Date: Sun, 19 Aug 2018 04:29:47 -0400 (EDT) Message-ID: References: <20180818191025.GA11187@lunn.ch> <20180818204520.GC8729@1wt.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Cc: Andrew Lunn , Linux kernel netdev mailing list To: Willy Tarreau Return-path: Received: from cpanel4.indieserve.net ([199.212.143.9]:45094 "EHLO cpanel4.indieserve.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbeHSLmh (ORCPT ); Sun, 19 Aug 2018 07:42:37 -0400 In-Reply-To: <20180818204520.GC8729@1wt.eu> Sender: netdev-owner@vger.kernel.org List-ID: On Sat, 18 Aug 2018, Willy Tarreau wrote: > On Sat, Aug 18, 2018 at 09:10:25PM +0200, Andrew Lunn wrote: > > On Sat, Aug 18, 2018 at 01:39:50PM -0400, Robert P. J. Day wrote: > > > > > > (i'm sure this has been explained many times before, so a link > > > covering this will almost certainly do just fine.) > > > > > > i want to loop one physical ethernet port into another, and just > > > ping the daylights from one to the other for stress testing. my fedora > > > laptop doesn't actually have two unused ethernet ports, so i just want > > > to emulate this by slapping a couple startech USB/net adapters into > > > two empty USB ports, setting this up, then doing it all over again > > > monday morning on the actual target system, which does have multiple > > > ethernet ports. > > > > > > so if someone can point me to the recipe, that would be great and > > > you can stop reading. > > > > > > as far as my tentative solution goes, i assume i need to put at > > > least one of the physical ports in a network namespace via "ip netns", > > > then ping from the netns to the root namespace. or, going one step > > > further, perhaps putting both interfaces into two new namespaces, and > > > setting up forwarding. > > > > Namespaces is a good solution. Something like this should work: > > > > ip netns add namespace1 > > ip netns add namespace2 > > > > ip link set eth1 netns namespace1 > > ip link set eth2 netns namespace2 > > > > ip netns exec namespace1 \ > > ip addr add 10.42.42.42/24 dev eth1 > > > > ip netns exec namespace1 \ > > ip link set eth1 up > > > > ip netns exec namespace2 \ > > ip addr add 10.42.42.24/24 dev eth2 > > > > ip netns exec namespace2 \ > > ip link set eth2 up > > > > ip netns exec namespace1 \ > > ping 10.42.42.24 > > > > You might also want to consider iperf3 for stress testing, depending > > on the sort of stress you need. > > FWIW I have a setup somewhere involving ip rule + ip route which > achieves the same without involving namespaces. It's a bit hackish > but sometimes convenient. I can dig if someone is interested. sure, i'm interested ... always educational to see different solutions. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca/dokuwiki Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ========================================================================