Loading s7nsa_06_infrastructure...
s7nsa_machine.py A 9991 s7nsa_machine.py B 9992 s7nsa_machine.py C 9993 s7nsa_machine.py D teacher:9999 9991 9992 9993 # substitute teacher
192.168.10.2 A 192.168.20.2 B 192.168.30.2 C 192.168.10.1 D
XX=1234 # substitute with your host number cat <<EOF >/etc/named.conf options { dnssec-validation no; listen-on-v6 { none; }; allow-transfer { 127.0.0.1; }; directory "/var/named"; }; zone "s7nsa-${XX}.lab" IN { type master; file "s7nsa-${XX}.lab.zone"; }; EOF
XX=1234 # substitute with your host number SERIAL=`date '+%Y%m%d'`01 cat <<EOF >/var/named/s7nsa-${XX}.lab.zone \$TTL 1H @ IN SOA ns admin ( ${SERIAL} 1H 15M 1W 1H ) @ IN NS ns ns IN A 192.168.10.2 A IN A 192.168.10.2 proxy IN CNAME A B IN A 192.168.20.2 C IN A 192.168.30.2 www IN CNAME C D IN A 192.168.10.1 router IN CNAME D EOF chown root:named /var/named/s7nsa-${XX}.lab.zone
XX=1234 # substitute with your host number cat <<EOF >/etc/resolv.conf nameserver 127.0.0.1 search s7nsa-${XX}.lab EOF
XX=1234 # substitute with your host number cat <<EOF >/etc/resolv.conf nameserver 192.198.10.2 search s7nsa-${XX}.lab EOF
zone "168.192.in-addr.arpa" IN { type master; file "168.192.zone"; };
XX=1234 # substitute with your host number SERIAL=`date '+%Y%m%d'`01 cat <<EOF >/var/named/168.192.zone \$TTL 1H @ IN SOA ns.s7nsa-${XX}.lab. admin.s7nsa-${XX}.lab. ( ${SERIAL} 1H 15M 1W 1H ) @ IN NS ns.s7nsa-${XX}.lab. 2.10 IN PTR A.s7nsa-${XX}.lab. 2.20 IN PTR B.s7nsa-${XX}.lab. 2.30 IN PTR C.s7nsa-${XX}.lab. 1.10 IN PTR D.s7nsa-${XX}.lab. 1.20 IN PTR D.s7nsa-${XX}.lab. 1.30 IN PTR D.s7nsa-${XX}.lab. EOF chown root:named /var/named/168.192.zone
XX=1234 # substitute with your host number MAC_C="aa:bb:cc:dd:ee:ff" # substitute with MAC address of C/eth0 cat <<EOF >/etc/kea/kea-dhcp4.conf { "Dhcp4": { "interfaces-config": { "interfaces": [ "eth0" ], "service-sockets-max-retries": 200000, "service-sockets-retry-wait-time": 1000 }, "ddns-generated-prefix": "client", "ddns-replace-client-name": "always", "subnet4": [ { "id": 1, "subnet": "192.168.20.0/24", "option-data": [ { "name": "routers", "data": "192.168.20.1" }, { "name": "domain-name-servers", "data": "192.168.10.2" }, { "name": "domain-name", "data": "s7nsa-${XX}.lab" } ], "pools": [ { "pool": "192.168.20.100 - 192.168.20.254" } ] }, { "id": 2, "subnet": "192.168.30.0/24", "option-data": [ { "name": "routers", "data": "192.168.30.1" } ], "reservations": [ { "hw-address": "${MAC_C}", "ip-address": "192.168.30.2", "hostname": "C" } ] } ] } } EOF
cat <<'EOF' >>/etc/systemd/system/dhcp-helper.service [Unit] Description=daemon for DHCP relay agent
[Service] Type=forking PIDFile=/run/dhcp-helper.pid ExecStart=/usr/bin/dhcp-helper -r /run/dhcp-helper.pid -s 192.168.10.2
[Install] WantedBy=multi-user.target EOF
XX=1234 # substitute with your host number cat <<EOF >/etc/named.conf options { dnssec-validation no; listen-on-v6 { none; }; allow-transfer { 127.0.0.1; }; directory "/var/named"; }; zone "s7nsa-${XX}.lab" IN { type master; file "s7nsa-${XX}.lab.zone"; }; EOF
SERIAL=`date '+%Y%m%d'`01 cat <<EOF >/var/named/s7nsa-${XX}.lab.zone \$TTL 1H @ IN SOA ns admin ( ${SERIAL} 1H 15M 1W 1H ) @ IN NS ns ns IN A 100.64.9.3 www IN A 100.64.9.2 EOF chown root:named /var/named/s7nsa-${XX}.lab.zone
allow-recursion { 127.0.0.1; 192.168.10.0/24; 192.168.20.0/24; };
forwarders { 100.64.0.254; }; forward only;
zone "." IN { type hint; file "named.root"; };
rm -rf /srv/http mkdir -p /srv/http/cgi-bin /var/log/nginx cp SHARED/index.html /srv/http cp SHARED/login.cgi /srv/http/cgi-bin chmod +x /srv/http/cgi-bin/login.cgi chown -R http:http /srv/http /var/log/nginx cp SHARED/nginx_http.conf /etc/nginx/nginx.conf systemctl enable --now nginx.service