Skip to content

Commit 95ddd17

Browse files
committed
mtu: move general files to files/, add /etc/hosts
This commit refactors the structure of the tutorial container folder to have: * `docker/`: Dockerfile and other build stuff * `files/`: non-scenario related files * `scenario*/`: scenario related During build, files are mapped 1:1 to /, and scenario* are copied (manually) to /bp. This commit also adds a custom /etc/hosts (overwritten at entrypoint.sh) for convenience.
1 parent d766d87 commit 95ddd17

File tree

9 files changed

+24
-3
lines changed

9 files changed

+24
-3
lines changed

tutorials/net/mtu/docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN apt update && apt install -y --no-install-recommends \
2121
&& rm -rf /var/lib/apt/lists/*
2222

2323
RUN mkdir /bp
24-
COPY . /bp
25-
COPY .bashrc /root/.bashrc
24+
COPY scenario1 /bp/scenario1
25+
COPY files/ /
2626
WORKDIR /root
2727
CMD ["/bp/entrypoint.sh"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ log_debug(){
2424
_log "DBG" "${1}"
2525
}
2626

27+
setup_etc_hosts(){
28+
cp -f /bp/hosts /etc/hosts
29+
}
30+
2731
# $1 namespace name
2832
_check_ns(){
2933
if ! ${SUDO} ip netns exec ${1} true >/dev/null 2>&1 ; then
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set -euo pipefail
55
cd /bp
66
source common.sh
77

8+
setup_etc_hosts
9+
810
#
911
# $1 scenario (default: scenario1)
1012
#

tutorials/net/mtu/files/bp/hosts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
127.0.0.1 localhost
2+
::1 localhost ip6-localhost ip6-loopback
3+
fe00:: ip6-localnet
4+
ff00:: ip6-mcastprefix
5+
ff02::1 ip6-allnodes
6+
ff02::2 ip6-allrouters
7+
8+
192.168.0.2 host1
9+
192.168.2.2 host2
10+
11+
192.168.0.1 routerx.ens1
12+
192.168.1.1 routerx.ens2
13+
14+
192.168.1.2 routery.ens1
15+
192.168.2.1 routery.ens2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ shell(){
5959
fi
6060
_check_ns "${1}"
6161

62-
ip netns exec ${1} bash --rcfile /bp/.bashrc -i
62+
ip netns exec ${1} bash --rcfile /root/.bashrc -i
6363
}
6464

6565
_shell_completion(){

0 commit comments

Comments
 (0)