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
nexedi
multicast-study
Commits
9e784c62
Commit
9e784c62
authored
May 02, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
B-A-C: Also organized dedicated mount namespace for each host
So that smcrouted could be run separately on each.
parent
975a462a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
33 deletions
+54
-33
namespace_demo/topo-B-A-C.sh
namespace_demo/topo-B-A-C.sh
+54
-33
No files found.
namespace_demo/topo-B-A-C.sh
View file @
9e784c62
...
@@ -9,25 +9,41 @@
...
@@ -9,25 +9,41 @@
#
#
#
#
# should be run under unshare -mrun .
# should be run under unshare -mrun .
# use
nsenter --net={A,B,C} to enter into network namespace
of A/B/C.
# use
xnsenter {A,B,C} to enter into namespaces
of A/B/C.
#
#
# Based on https://github.com/troglobit/smcroute/tree/master/test
# Based on https://github.com/troglobit/smcroute/tree/master/test
rm
-f
A B C
rm
-
r
f
A B C
touch
A B C
mkdir
A B C
PID
=
$$
PID
=
$$
# `xunshare <dir> ...` -- unshare net/mount/... namespaces to be referenced by dir
xunshare
()
{
ref
=
$1
shift
touch
$ref
/mnt
$ref
/net
unshare
--mount
=
$ref
/mnt
--net
=
$ref
/net
"
$@
"
}
# `xnsenter <dir> ...` -- nsenter net/mount/... namespaces to be referenced by dir
xnsenter
()
{
ref
=
$1
shift
nsenter
--mount
=
$ref
/mnt
--net
=
$ref
/net
--wd
=
.
"
$@
"
}
# B-br0-A
# B-br0-A
unshare
--net
=
B
--
ip
link set
lo up
xunshare
B
--
ip
link set
lo up
nsenter
--net
=
B
--
ip
link
add b1
type
veth peer B1
xnsenter
B
--
ip
link
add b1
type
veth peer B1
nsenter
--net
=
B
--
ip
link set
B1 netns
$PID
xnsenter
B
--
ip
link set
B1 netns
$PID
nsenter
--net
=
B
--
ip
link set
b1 up
xnsenter
B
--
ip
link set
b1 up
ip
link set
B1 up
ip
link set
B1 up
unshare
--net
=
A
--
ip
link set
lo up
xunshare
A
--
ip
link set
lo up
nsenter
--net
=
A
--
ip
link
add a1
type
veth peer A1
xnsenter
A
--
ip
link
add a1
type
veth peer A1
nsenter
--net
=
A
--
ip
link set
A1 netns
$PID
xnsenter
A
--
ip
link set
A1 netns
$PID
nsenter
--net
=
A
--
ip
link set
a1 up
xnsenter
A
--
ip
link set
a1 up
ip
link set
A1 up
ip
link set
A1 up
ip
link
add br0
type
bridge
# vlan_filtering 1 mcast_snooping 0
ip
link
add br0
type
bridge
# vlan_filtering 1 mcast_snooping 0
...
@@ -36,15 +52,15 @@ ip link set A1 master br0
...
@@ -36,15 +52,15 @@ ip link set A1 master br0
ip
link set
br0 up
ip
link set
br0 up
# A-br1-C
# A-br1-C
nsenter
--net
=
A
--
ip
link
add a2
type
veth peer A2
xnsenter
A
--
ip
link
add a2
type
veth peer A2
nsenter
--net
=
A
--
ip
link set
A2 netns
$PID
xnsenter
A
--
ip
link set
A2 netns
$PID
nsenter
--net
=
A
--
ip
link set
a2 up
xnsenter
A
--
ip
link set
a2 up
ip
link set
A2 up
ip
link set
A2 up
unshare
--net
=
C
--
ip
link set
lo up
xunshare
C
--
ip
link set
lo up
nsenter
--net
=
C
--
ip
link
add c1
type
veth peer C1
xnsenter
C
--
ip
link
add c1
type
veth peer C1
nsenter
--net
=
C
--
ip
link set
C1 netns
$PID
xnsenter
C
--
ip
link set
C1 netns
$PID
nsenter
--net
=
C
--
ip
link set
c1 up
xnsenter
C
--
ip
link set
c1 up
ip
link set
C1 up
ip
link set
C1 up
ip
link
add br1
type
bridge
# vlan_filtering 1 mcast_snooping 0
ip
link
add br1
type
bridge
# vlan_filtering 1 mcast_snooping 0
...
@@ -54,27 +70,32 @@ ip link set br1 up
...
@@ -54,27 +70,32 @@ ip link set br1 up
# addresses
# addresses
nsenter
--net
=
B
--
ip addr add 10.0.0.1/24 dev b1
xnsenter
B
--
ip addr add 10.0.0.1/24 dev b1
nsenter
--net
=
A
--
ip addr add 10.0.0.2/24 dev a1
xnsenter
A
--
ip addr add 10.0.0.2/24 dev a1
nsenter
--net
=
C
--
ip addr add 20.0.0.1/24 dev c1
xnsenter
C
--
ip addr add 20.0.0.1/24 dev c1
nsenter
--net
=
A
--
ip addr add 20.0.0.2/24 dev a2
xnsenter
A
--
ip addr add 20.0.0.2/24 dev a2
# multicast routing
# multicast routing
nsenter
--net
=
B
--
ip route add 224.0.0.0/4 dev b1
xnsenter
B
--
ip route add 224.0.0.0/4 dev b1
nsenter
--net
=
C
--
ip route add 224.0.0.0/4 dev c1
xnsenter
C
--
ip route add 224.0.0.0/4 dev c1
nsenter
--net
=
A
--
ip route add 224.0.0.0/4 dev a1
# NOTE on A 224.0.0.0/4 is routed
xnsenter
A
--
ip route add 224.0.0.0/4 dev a1
# NOTE on A 224.0.0.0/4 is routed
nsenter
--net
=
A
--
ip route append 224.0.0.0/4 dev a2
# to _both_ a1 and a2
xnsenter
A
--
ip route append 224.0.0.0/4 dev a2
# to _both_ a1 and a2
# mount private /var/run so that smcrouted can be started
# mount private /var/run so that smcrouted can be started
# we start will start it only in A, so keeping /var/run shared to everywhere,
xnsenter A
--
mount
-t
tmpfs none /var/run
# even if dirty, is ok.
xnsenter B
--
mount
-t
tmpfs none /var/run
mount
-t
tmpfs none /var/run
xnsenter C
--
mount
-t
tmpfs none /var/run
echo
echo
echo
xnsenter B
--
pwd
# open terminals in A B C for play
# open terminals in A B C for play
nsenter
--net
=
B
--
xfce4-terminal
--title
=
B &
xnsenter
B
--
xfce4-terminal
--title
=
B &
nsenter
--net
=
C
--
xfce4-terminal
--title
=
C &
xnsenter
C
--
xfce4-terminal
--title
=
C &
nsenter
--net
=
A
--
xfce4-terminal
--title
=
A &
xnsenter
A
--
xfce4-terminal
--title
=
A &
nsenter
--net
=
A
--
xfce4-terminal
--title
=
A2 &
xnsenter
A
--
xfce4-terminal
--title
=
A2 &
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