From: Willy Tarreau <w@1wt.eu>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Robert P. J. Day" <rpjday@crashcourse.ca>,
Linux kernel netdev mailing list <netdev@vger.kernel.org>
Subject: Re: how to (cross)connect two (physical) eth ports for ping test?
Date: Sat, 18 Aug 2018 22:45:21 +0200 [thread overview]
Message-ID: <20180818204520.GC8729@1wt.eu> (raw)
In-Reply-To: <20180818191025.GA11187@lunn.ch>
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.
Regards,
Willy
next prev parent reply other threads:[~2018-08-18 23:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-18 17:39 how to (cross)connect two (physical) eth ports for ping test? Robert P. J. Day
2018-08-18 19:10 ` Andrew Lunn
2018-08-18 20:45 ` Willy Tarreau [this message]
2018-08-19 8:29 ` Robert P. J. Day
2018-08-19 15:55 ` Roman Mashak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180818204520.GC8729@1wt.eu \
--to=w@1wt.eu \
--cc=andrew@lunn.ch \
--cc=netdev@vger.kernel.org \
--cc=rpjday@crashcourse.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).