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
493b5da1
Commit
493b5da1
authored
May 02, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BAC: Factor creating new hosts into xnewhost
parent
91d7694b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
namespace_demo/lib.sh
namespace_demo/lib.sh
+17
-0
namespace_demo/topo-B-A-C.sh
namespace_demo/topo-B-A-C.sh
+4
-17
No files found.
namespace_demo/lib.sh
View file @
493b5da1
...
...
@@ -2,6 +2,23 @@
PID
=
$$
# `xnewhost <name>` creates new virtual host.
xnewhost
()
{
local
X
=
$1
# lo
xunshare
$X
--
ip
link set
lo up
# private /var/run so that e.g. smcrouted can be started
xnsenter
$X
--
mount
-t
tmpfs none /var/run
# open terminal inside the host for play
local
nterm
=
${
2
:-
1
}
for
i
in
`
seq
$nterm
`
;
do
xnsenter
$X
--
xfce4-terminal
--title
=
$X$i
&
done
}
# `xunshare <dir> ...` -- unshare net/mount/... namespaces to be referenced by dir
xunshare
()
{
ref
=
$1
...
...
namespace_demo/topo-B-A-C.sh
View file @
493b5da1
...
...
@@ -25,10 +25,10 @@
cycle
=
n
[
"
$1
"
=
"-cycle"
]
&&
cycle
=
y
#
lo on everything
x
unshare A
--
ip
link set
lo up
x
unshare B
--
ip
link set
lo up
x
unshare C
--
ip
link set
lo up
#
set up hosts
x
newhost A 2
x
newhost B
x
newhost C
# links
xlink B A
# B-A
...
...
@@ -58,16 +58,3 @@ 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
xnsenter B
--
mount
-t
tmpfs none /var/run
xnsenter C
--
mount
-t
tmpfs none /var/run
# open terminals in A B C for play
xnsenter B
--
xfce4-terminal
--title
=
B &
xnsenter C
--
xfce4-terminal
--title
=
C &
xnsenter A
--
xfce4-terminal
--title
=
A &
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