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
294aa6c8
Commit
294aa6c8
authored
May 02, 2022
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add square configuration
parent
334a148f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
0 deletions
+133
-0
namespace_demo/topo-square.sh
namespace_demo/topo-square.sh
+133
-0
No files found.
namespace_demo/topo-square.sh
0 → 100755
View file @
294aa6c8
#!/bin/bash -ex
# topo square creates the following network topology:
#
#
# A --------- br0 -------- B
# | ab ba |
# |ac bd|
# | |
# | |
# | |
# br1 br3
# | |
# | |
# | |
# |ca db|
# | cd dc |
# C ---------- br2 ------- D
#
#
#
# should be run under unshare -mrun .
# use nsenter --net={A,B,C,D} to enter into network namespace of A/B/C/D.
#
# Based on https://github.com/troglobit/smcroute/tree/master/test
rm
-f
A B C D
touch
A B C D
PID
=
$$
# A-br0-B
unshare
--net
=
B
--mount
=
B
--
ip
link set
lo up
nsenter
--net
=
B
--
ip
link
add ba
type
veth peer BA
nsenter
--net
=
B
--
ip
link set
BA netns
$PID
nsenter
--net
=
B
--
ip
link set
ba up
ip
link set
BA up
unshare
--net
=
A
--
ip
link set
lo up
nsenter
--net
=
A
--
ip
link
add ab
type
veth peer AB
nsenter
--net
=
A
--
ip
link set
AB netns
$PID
nsenter
--net
=
A
--
ip
link set
ab up
ip
link set
AB up
ip
link
add br0
type
bridge
# vlan_filtering 1 mcast_snooping 0
ip
link set
BA master br0
ip
link set
AB master br0
ip
link set
br0 up
# A-br1-C
nsenter
--net
=
A
--
ip
link
add ac
type
veth peer AC
nsenter
--net
=
A
--
ip
link set
AC netns
$PID
nsenter
--net
=
A
--
ip
link set
ac up
ip
link set
AC up
unshare
--net
=
C
--
ip
link set
lo up
nsenter
--net
=
C
--
ip
link
add ca
type
veth peer CA
nsenter
--net
=
C
--
ip
link set
CA netns
$PID
nsenter
--net
=
C
--
ip
link set
ca up
ip
link set
CA up
ip
link
add br1
type
bridge
# vlan_filtering 1 mcast_snooping 0
ip
link set
CA master br1
ip
link set
AC master br1
ip
link set
br1 up
# C-br2-D
nsenter
--net
=
C
--
ip
link
add
cd type
veth peer CD
nsenter
--net
=
C
--
ip
link set
CD netns
$PID
nsenter
--net
=
C
--
ip
link set cd
up
ip
link set
CD up
unshare
--net
=
D
--
ip
link set
lo up
nsenter
--net
=
D
--
ip
link
add dc
type
veth peer DC
nsenter
--net
=
D
--
ip
link set
DC netns
$PID
nsenter
--net
=
D
--
ip
link set
dc up
ip
link set
DC up
ip
link
add br2
type
bridge
# vlan_filtering 1 mcast_snooping 0
ip
link set
CD master br2
ip
link set
DC master br2
ip
link set
br2 up
# B-br3-D
nsenter
--net
=
B
--
ip
link
add bd
type
veth peer BD
nsenter
--net
=
B
--
ip
link set
BD netns
$PID
nsenter
--net
=
B
--
ip
link set
bd up
ip
link set
BD up
nsenter
--net
=
D
--
ip
link
add db
type
veth peer DB
nsenter
--net
=
D
--
ip
link set
DB netns
$PID
nsenter
--net
=
D
--
ip
link set
db up
ip
link set
DB up
ip
link
add br3
type
bridge
# vlan_filtering 1 mcast_snooping 0
ip
link set
BD master br3
ip
link set
DB master br3
ip
link set
br3 up
# addresses
nsenter
--net
=
B
--
ip addr add 10.0.0.1/24 dev ba
nsenter
--net
=
A
--
ip addr add 10.0.0.2/24 dev ab
nsenter
--net
=
C
--
ip addr add 20.0.0.1/24 dev ca
nsenter
--net
=
A
--
ip addr add 20.0.0.2/24 dev ac
nsenter
--net
=
B
--
ip addr add 30.0.0.1/24 dev bd
nsenter
--net
=
D
--
ip addr add 30.0.0.2/24 dev db
nsenter
--net
=
C
--
ip addr add 40.0.0.1/24 dev
cd
nsenter
--net
=
D
--
ip addr add 40.0.0.2/24 dev dc
# multicast routing
#nsenter --net=B -- ip route add 224.0.0.0/4 dev b1
#nsenter --net=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
#nsenter --net=A -- ip route append 224.0.0.0/4 dev a2 # to _both_ a1 and a2
# pim-dm
sed
-e
's/IF0/ab/g'
-e
's/IF1/ac/g'
pim-dm.yaml.tmpl
>
pim-dm_A.yaml
sed
-e
's/IF0/ba/g'
-e
's/IF1/bd/g'
pim-dm.yaml.tmpl
>
pim-dm_B.yaml
sed
-e
's/IF0/ca/g'
-e
's/IF1/cd/g'
pim-dm.yaml.tmpl
>
pim-dm_C.yaml
sed
-e
's/IF0/dc/g'
-e
's/IF1/db/g'
pim-dm.yaml.tmpl
>
pim-dm_D.yaml
# we need to mount private /var/run in each namespace so that pim-dm can be started
#nsenter --net=A -- pim-dm -config pim-dm_A.yaml &
#nsenter --net=B -- pim-dm -config pim-dm_B.yaml &
#nsenter --net=C -- pim-dm -config pim-dm_C.yaml &
#nsenter --net=D -- pim-dm -config pim-dm_D.yaml &
# open terminals in A B C D for play
nsenter
--net
=
A
--
xfce4-terminal
--title
=
A &
nsenter
--net
=
B
--
xfce4-terminal
--title
=
B &
nsenter
--net
=
C
--
xfce4-terminal
--title
=
C &
nsenter
--net
=
D
--
xfce4-terminal
--title
=
D &
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