diff options
Diffstat (limited to 'nfv-installer')
-rw-r--r-- | nfv-installer/docker-pxe-ramboot/Dockerfile | 16 | ||||
-rw-r--r-- | nfv-installer/docker-pxe-ramboot/README | 41 | ||||
-rw-r--r-- | nfv-installer/docker-pxe-ramboot/dhcpd.conf | 6 | ||||
-rwxr-xr-x | nfv-installer/docker-pxe-ramboot/entrypoint.sh | 6 | ||||
-rw-r--r-- | nfv-installer/docker-pxe-ramboot/pxe.cfg | 9 |
5 files changed, 78 insertions, 0 deletions
diff --git a/nfv-installer/docker-pxe-ramboot/Dockerfile b/nfv-installer/docker-pxe-ramboot/Dockerfile new file mode 100644 index 0000000..f515cd3 --- /dev/null +++ b/nfv-installer/docker-pxe-ramboot/Dockerfile | |||
@@ -0,0 +1,16 @@ | |||
1 | FROM ubuntu:16.04 | ||
2 | |||
3 | RUN apt-get update && \ | ||
4 | apt-get install -y isc-dhcp-server tftpd-hpa wget | ||
5 | |||
6 | RUN touch /var/lib/dhcp/dhcpd.leases | ||
7 | |||
8 | RUN wget http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/netboot.tar.gz && \ | ||
9 | mkdir /netboot && \ | ||
10 | tar -zxf netboot.tar.gz -C /netboot && \ | ||
11 | cp /netboot/debian-installer/amd64/pxelinux.0 /var/lib/tftpboot/pxelinux.0 && \ | ||
12 | cp /netboot/debian-installer/amd64/boot-screens/vesamenu.c32 /var/lib/tftpboot/ | ||
13 | |||
14 | COPY ./entrypoint.sh /entrypoint.sh | ||
15 | |||
16 | ENTRYPOINT ["/entrypoint.sh"] | ||
diff --git a/nfv-installer/docker-pxe-ramboot/README b/nfv-installer/docker-pxe-ramboot/README new file mode 100644 index 0000000..1504968 --- /dev/null +++ b/nfv-installer/docker-pxe-ramboot/README | |||
@@ -0,0 +1,41 @@ | |||
1 | |||
2 | This container starts a DHCP server and a TFTP server which can be used for booting boards through PXE. | ||
3 | |||
4 | 1. Build the container | ||
5 | - cd into this folder | ||
6 | - run: | ||
7 | docker build . -t <CONTAINER_NAME> | ||
8 | |||
9 | 2. Start a container with both the DHCP server and TFTP server configured for PXE booting: | ||
10 | - 4 files are needed: | ||
11 | - dhcpd.conf - configuration file for the DHCP server (an example is provided in the git repository) | ||
12 | - pxe.cfg - configuration file for the PXE server (an example is provided in the git repository) | ||
13 | - bzImage - kernel for the board | ||
14 | - rootfs.ext4 - root filesystem for the board | ||
15 | - Edit dhcpd.conf to match the DHCP server configuration that is needed | ||
16 | - Set an IP address to the interface (named INTERFACE_NAME below) where the DHCP server will be advertised on | ||
17 | - Run: | ||
18 | docker run -it --net=host --privileged \ | ||
19 | -v <path to dhcpd.conf>:/etc/dhcp/dhcpd.conf \ | ||
20 | -v <path to pxe.cfg>:/var/lib/tftpboot/pxelinux.cfg/default \ | ||
21 | -v <path to bzImage>:/var/lib/tftpboot/bzImage \ | ||
22 | -v <path to rootfs.ext4>:/var/lib/tftpboot/rootfs.ext4 \ | ||
23 | <CONTAINER_NAME> <INTERFACE_NAME> | ||
24 | |||
25 | Given that all the required files are in the current working directory and that the container is named "nfv-pxe-boot", a practical example for running on eth2 would be: | ||
26 | docker run -it --net=host --privileged \ | ||
27 | -v $(pwd)/dhcpd.conf:/etc/dhcp/dhcpd.conf \ | ||
28 | -v $(pwd)/pxe.cfg:/var/lib/tftpboot/pxelinux.cfg/default \ | ||
29 | -v $(pwd)/bzImage:/var/lib/tftpboot/bzImage \ | ||
30 | -v $(pwd)/rootfs.ext4:/var/lib/tftpboot/rootfs.ext4 \ | ||
31 | nfv-pxe-boot eth2 | ||
32 | |||
33 | The -v parameter mounts a file specified at the left of the colon character to the destination specified at the right of the colon character. For example "-v $(pwd)/bzImage:/var/lib/tftpboot/bzImage" evaluates $(pwd)/bzImage and will map the file to /var/lib/tftpboot/bzImage in the container. | ||
34 | |||
35 | Boot the board with network booting enabled and it should load the configuration set in pxe.cfg. | ||
36 | |||
37 | 3. Start a container with only the DHCP server running: | ||
38 | - Only dhcpd.conf is needed | ||
39 | - Set an IP address to the interface (named INTERFACE_NAME below) where the DHCP server will be advertised on | ||
40 | - Run: | ||
41 | docker run -it --net=host --privileged -v <path to dhcpd.conf>:/etc/dhcp/dhcpd.conf <INTERFACE NAME> | ||
diff --git a/nfv-installer/docker-pxe-ramboot/dhcpd.conf b/nfv-installer/docker-pxe-ramboot/dhcpd.conf new file mode 100644 index 0000000..21df511 --- /dev/null +++ b/nfv-installer/docker-pxe-ramboot/dhcpd.conf | |||
@@ -0,0 +1,6 @@ | |||
1 | default-lease-time 600; | ||
2 | max-lease-time 7200; | ||
3 | subnet 192.168.1.0 netmask 255.255.255.0 { | ||
4 | range 192.168.1.100 192.168.1.200; | ||
5 | filename "/var/lib/tftpboot/pxelinux.0"; | ||
6 | } | ||
diff --git a/nfv-installer/docker-pxe-ramboot/entrypoint.sh b/nfv-installer/docker-pxe-ramboot/entrypoint.sh new file mode 100755 index 0000000..0930cb9 --- /dev/null +++ b/nfv-installer/docker-pxe-ramboot/entrypoint.sh | |||
@@ -0,0 +1,6 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | echo "Starting DHCP on interface: $1" | ||
3 | |||
4 | /usr/sbin/dhcpd --no-pid $1 | ||
5 | nohup in.tftpd -L& | ||
6 | /bin/bash | ||
diff --git a/nfv-installer/docker-pxe-ramboot/pxe.cfg b/nfv-installer/docker-pxe-ramboot/pxe.cfg new file mode 100644 index 0000000..ee26ae3 --- /dev/null +++ b/nfv-installer/docker-pxe-ramboot/pxe.cfg | |||
@@ -0,0 +1,9 @@ | |||
1 | default vesamenu.c32 | ||
2 | |||
3 | MENU TITLE Enea NFV Access Install | ||
4 | MENU COLOR title 0 #80ffffff #00000000 std | ||
5 | |||
6 | label Run RAMFS | ||
7 | menu label ^Run RAMFS | ||
8 | kernel bzImage | ||
9 | append root=/dev/ram0 initrd=rootfs.ext4 ramdisk_size=2000000 console=ttyS0,115200 earlyprintk=ttyS0,115200 | ||