Nerveware


Network services

ISC dhcp server

Installation

$ apt install isc-dhcp-server $ systemctl disbale isc-dhcp-server $ echo 'INTERFACES="eth0"' >> /etc/default/isc-dhcp-server

/etc/dhcp/dhcpd.conf

default-lease-time 600; max-lease-time 7200; ddns-update-style none; subnet 192.168.138.0 netmask 255.255.255.0 { range 192.168.138.10 192.168.138.254; option subnet-mask 255.255.255.0; option broadcast-address 192.168.138.255; option routers 192.168.138.1; } host some-node { hardware ethernet 00:11:22:33:44:66; fixed-address 192.168.138.9; } $ systemctl start isc-dhcp-server

View leases

$ dhcp-lease-list

TFTP server

Installation

$ apt-get install tftpd-hpa

/etc/default/tftpd-hpa

TFTP_USERNAME="tftp" TFTP_DIRECTORY="/srv/tftp" TFTP_ADDRESS="0.0.0.0:69" TFTP_OPTIONS="--secure" /etc/init.d/tftpd-hpa start

Download a file

$ tftp -g -r $file $ip

NFS

Installation

$ apt-get install nfs-kernel-server

/etc/exports

/srv/nfs *(rw,nohide,insecure,no_subtree_check,async,no_root_squash) exportfs -a

DNS

Writing in progress. Section might be incomplete

Installation

$ apt-get install bind9

/etc/bind/named.conf.default-zones

# Rest of file above.. zone "mywebsite.nl." { type master; file "/etc/bind/zones/db.mywebsite"; };

/etc/bind/zones/db.mywebsite

; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA mywebsite.nl. root.mywebsite.nl. ( 2 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS mywebsite.nl. @ IN A 192.168.138.1 @ IN AAAA ::1 ;mywebsite.nl IN MX 10 mail. $ named-checkzone mywebsite.nl /etc/bind/zones/db.mywebsite $ systemctl reload bind9

NTP

Client: Alter /usr/lib/ntp/ntp-systemd-wrapper to run ntpd -g to correct time regardless of the offset. If this doesn't fix it, place "ntpd -gq" before the exec (because whatever..).

server 192.168.138.9 prefer driftfile /var/lib/ntp/ntp.drift statsdir /var/log/ntpstats/ restrict 127.0.0.1 restrict ::1 disable auth broadcastclient

Server:

server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 driftfile /var/lib/ntp/ntp.drift logfile /var/log/ntp.log restrict default kod nomodify notrap nopeer noquery limited restrict -6 default kod nomodify notrap nopeer noquery limited restrict 192.168.138.0 mask 255.255.255.0 restrict 127.0.0.1

Interfaces and other stuff

Tar through ssh

$ tar -czf - /srv/nfs/rootfs/ | ssh user@192.168.26.79 "tar -xzf - -C /srv/nfs/"

CAN interface

Enable CAN interface on 125kbp/s and generate data as ID a8 with data length 8.

$ ip link set can0 type can bitrate 125000 $ ip link set up can0 $ cangen can0 -I 0xa8 -L 8 -v