Verified Commit 57f0b251 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

Basic dns in isp-common

parent 74051ebe
Image definitions for NSFarm
============================
# Image definitions for NSFarm
This directory contains definitions of images used in NSFarm. Images define
content of container used during testing.
......@@ -14,6 +14,7 @@ It is expected that `NAME.sh` file has on first line shebang and on second line
the name of a base image to be used and optional attributes. It is suggested to
continue with comment block with description of container use. This is an example
of such header:
```sh
#!/bin/bash
#images:alpine/3.10/amd64 char:/dev/net/tun
......@@ -22,15 +23,15 @@ of such header:
##################################################################################
```
Image naming limitations
------------------------
## Image naming limitations
Because of LXD requirements it is needed that image is named only with characters,
numbers and `-` where first leter has to be a character not a number.
This is a limitation of image name having to be a valid hostname.
Base image
----------
## Base image
The base idea of images is that we can stack images on top of each other and that
makes it easier to have common base and additional scripts that do only minimal
changes to it. This concept is base image. In definition file `NAME.sh` this is
......@@ -44,13 +45,14 @@ It is suggested to base you image on some other NSFarm image or if you really ne
then on Alpine Linux. The reason is to preserve minimal size and fast environment
execution/preparation.
Image attributes
----------------
## Image attributes
Every image can also specify additional attributes that would be used when
container is spawned. The attributes have in general format `TYPE:VALUE` and are
separated by spaces.
The following types are defined:
* `char`: this specifies that given Unix character device should be accessible in
container. The value is path to required device.
......@@ -59,11 +61,18 @@ that. At the same time specifying the same attribute again is going to create
duplicate. Depending on an attribute this can be either wrong or good thing but in
most cases wrong.
Image preparation
-----------------
## Image preparation
The image is prepared in following way:
* Container with base image is created
* `NAME.sh` script is copied to it to `/tmp/nsfarm-img.sh`
* Content of directory named same way as definition script is merged to container
* Script `/nsfarm-init.sh` is run inside container
* Image is created from container
### Copied files and folder permissions and ownership
When files and folders are copied from `imgs/NAME` directory, the script doesn't
copy permissions nor ownership, therefore **these must be set in initial shell**
**script**.
......@@ -18,6 +18,15 @@ awall enable isp isp-iperf3
# Activate firewall itself
awall activate --force
## DNS service
# Install and activate bind
apk add bind
rc-update add named
# Changing premissions to folders copied to container
# - the permissions are not managed when copying by nsfarm (see README.md)
chown :named /etc/bind
chmod a+r /etc/bind/named.conf
## Additonal service
# iperf3 for benchmarking tests
apk add iperf3 iperf3-openrc
......
options {
directory "/var/bind";
recursion yes;
listen-on { any; };
listen-on-v6 { any; };
};
......@@ -2,7 +2,7 @@ start 172.16.1.100
end 172.16.1.254
max_leases 64
interface wan
opt dns 1.1.1.1
opt dns 172.16.1.1
opt subnet 255.240.0.0
opt router 172.16.1.1
opt lease 864000
......@@ -162,7 +162,7 @@ def fixture_basic_isp(lxd, board, client_board, wan):
client_board.run("uci set network.wan.ipaddr='172.16.1.42'")
client_board.run("uci set network.wan.netmask='255.240.0.0'")
client_board.run("uci set network.wan.gateway='172.16.1.1'")
client_board.run("uci set network.wan.dns='1.1.1.1'") # TODO configure to ISP
client_board.run("uci set network.wan.dns='172.16.1.1'")
client_board.run("uci commit network")
client_board.run("/etc/init.d/network restart")
client_board.run(f"while ! ip link show {board.wan} | grep -q ' state UP '; do sleep 1; done")
......
......@@ -26,7 +26,7 @@ class TestStatic(common.InternetTests):
client_board.run("uci set network.wan.ipaddr='172.16.1.42'")
client_board.run("uci set network.wan.netmask='255.240.0.0'")
client_board.run("uci set network.wan.gateway='172.16.1.1'")
client_board.run("uci set network.wan.dns='1.1.1.1'") # TODO configure to ISP
client_board.run("uci set network.wan.dns='172.16.1.1'")
client_board.run("uci commit network")
client_board.run("/etc/init.d/network restart")
client_board.run(f"while ! ip link show {board.wan} | grep -q ' state UP '; do sleep 1; done")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment