Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
multicast-study
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
multicast-study
Commits
91d7694b
Commit
91d7694b
authored
May 02, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BAC: Add -cycle option so that both linear and triangle topologies could be tested
linear: B--A--C triangle: B-----A \ / \ / C
parent
58707f40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
namespace_demo/lib.sh
namespace_demo/lib.sh
+2
-0
namespace_demo/topo-B-A-C.sh
namespace_demo/topo-B-A-C.sh
+24
-4
No files found.
namespace_demo/lib.sh
View file @
91d7694b
...
...
@@ -6,6 +6,7 @@ PID=$$
xunshare
()
{
ref
=
$1
shift
echo
"create
$ref
"
rm
-rf
"
$ref
"
mkdir
"
$ref
"
touch
$ref
/mnt
$ref
/net
...
...
@@ -29,6 +30,7 @@ xlink() {
B
=
$2
a
=
"
${
A
,,
}
"
# A -> a
b
=
"
${
B
,,
}
"
# B -> b
echo
"link
$A
-
$B
"
xnsenter
$A
--
ip
link
add
$a
-
$b
type
veth peer br
$A$B
.
$a
xnsenter
$A
--
ip
link set
br
$A$B
.
$a
netns
$PID
...
...
namespace_demo/topo-B-A-C.sh
View file @
91d7694b
#!/bin/bash -e
x
#!/bin/bash -e
# topo B-A-C creates the following network topology:
#
#
# ns:B
ns:A
ns:C
# ns:B
ns:A
ns:C
#
# B ---
br0 --- A --- br1
--- C
# b-a
a-b a-c
c-a
# B ---
-- A --
--- C
# b-a
a-b a-c
c-a
#
#
# if run with -cycle, it also creates B-C link:
#
#
# B ............... C
# | |
# '-------------------'
#
# should be run under unshare -mrun .
# use xnsenter {A,B,C} to enter into namespaces of A/B/C.
#
...
...
@@ -15,6 +22,8 @@
.
lib.sh
cycle
=
n
[
"
$1
"
=
"-cycle"
]
&&
cycle
=
y
# lo on everything
xunshare A
--
ip
link set
lo up
...
...
@@ -24,13 +33,19 @@ xunshare C -- ip link set lo up
# links
xlink B A
# B-A
xlink A C
# A-C
[
$cycle
=
y
]
&&
xlink B C
set
-x
# addresses
xnsenter B
--
ip addr add 10.0.0.1/24 dev b-a
xnsenter A
--
ip addr add 10.0.0.2/24 dev a-b
xnsenter C
--
ip addr add 20.0.0.1/24 dev c-a
xnsenter A
--
ip addr add 20.0.0.2/24 dev a-c
if
[
$cycle
=
y
]
;
then
xnsenter B
--
ip addr add 30.0.0.1/24 dev b-c
xnsenter C
--
ip addr add 30.0.0.2/24 dev c-b
fi
# multicast routing
xnsenter B
--
ip route add 224.0.0.0/4 dev b-a
...
...
@@ -39,6 +54,11 @@ xnsenter C -- ip route add 224.0.0.0/4 dev c-a
xnsenter A
--
ip route add 224.0.0.0/4 dev a-b
# NOTE on A 224.0.0.0/4 is routed
xnsenter A
--
ip route append 224.0.0.0/4 dev a-c
# to _both_ a-b and a-c
if
[
$cycle
=
y
]
;
then
xnsenter B
--
ip route append 224.0.0.0/4 dev b-c
xnsenter C
--
ip route append 224.0.0.0/4 dev c-b
fi
# mount private /var/run so that smcrouted can be started
xnsenter A
--
mount
-t
tmpfs none /var/run
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment