@@ -40,6 +40,33 Set default system locale and keyboard layout. This setting can also be changed | |||||
40 | ##### `TIMEZONE`="Europe/Berlin" |
|
40 | ##### `TIMEZONE`="Europe/Berlin" | |
41 | Set default system timezone. All available timezones can be found in the `/usr/share/zoneinfo/` directory. This setting can also be changed inside the running OS using the `dpkg-reconfigure tzdata` command. |
|
41 | Set default system timezone. All available timezones can be found in the `/usr/share/zoneinfo/` directory. This setting can also be changed inside the running OS using the `dpkg-reconfigure tzdata` command. | |
42 |
|
42 | |||
|
43 | #### Networking settings | |||
|
44 | These settings are used to set up networking configuration in `/etc/systemd/network/eth.network`. | |||
|
45 | ||||
|
46 | #####`ENABLE_DHCP`=true | |||
|
47 | Set the system to use DHCP. When set to "true", the following `NET_*` settings (used for static configuration) are ignored. | |||
|
48 | ||||
|
49 | #####`NET_ADDRESS`="" | |||
|
50 | Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24". | |||
|
51 | ||||
|
52 | #####`NET_GATEWAY`="" | |||
|
53 | Set the IP address for the default gateway. | |||
|
54 | ||||
|
55 | #####`NET_DNS_1`="" | |||
|
56 | Set the IP address for the first DNS server. | |||
|
57 | ||||
|
58 | #####`NET_DNS_2`="" | |||
|
59 | Set the IP address for the second DNS server. | |||
|
60 | ||||
|
61 | #####`NET_DNS_DOMAINS`="" | |||
|
62 | Set the default DNS search domains to use for non fully qualified host names. | |||
|
63 | ||||
|
64 | #####`NET_NTP_1`="" | |||
|
65 | Set the IP address for the first NTP server. | |||
|
66 | ||||
|
67 | #####`NET_NTP_2`="" | |||
|
68 | Set the IP address for the second NTP server. | |||
|
69 | ||||
43 | #### Basic system features: |
|
70 | #### Basic system features: | |
44 | ##### `ENABLE_CONSOLE`=true |
|
71 | ##### `ENABLE_CONSOLE`=true | |
45 | Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system. |
|
72 | Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system. |
@@ -46,6 +46,18 PASSWORD=${PASSWORD:=raspberry} | |||||
46 | DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"} |
|
46 | DEFLOCAL=${DEFLOCAL:="en_US.UTF-8"} | |
47 | TIMEZONE=${TIMEZONE:="Europe/Berlin"} |
|
47 | TIMEZONE=${TIMEZONE:="Europe/Berlin"} | |
48 |
|
48 | |||
|
49 | # Network settings | |||
|
50 | ENABLE_DHCP=${ENABLE_DHCP:=true} | |||
|
51 | # NET_* settings are ignored when ENABLE_DHCP=true | |||
|
52 | # NET_ADDRESS is an IPv4 or IPv6 address and its prefix, separated by "/" | |||
|
53 | NET_ADDRESS=${NET_ADDRESS:=""} | |||
|
54 | NET_GATEWAY=${NET_GATEWAY:=""} | |||
|
55 | NET_DNS_1=${NET_DNS_1:=""} | |||
|
56 | NET_DNS_2=${NET_DNS_2:=""} | |||
|
57 | NET_DNS_DOMAINS=${NET_DNS_DOMAINS:=""} | |||
|
58 | NET_NTP_1=${NET_NTP_1:=""} | |||
|
59 | NET_NTP_2=${NET_NTP_2:=""} | |||
|
60 | ||||
49 | # APT settings |
|
61 | # APT settings | |
50 | APT_PROXY=${APT_PROXY:=""} |
|
62 | APT_PROXY=${APT_PROXY:=""} | |
51 | APT_SERVER=${APT_SERVER:="ftp.debian.org"} |
|
63 | APT_SERVER=${APT_SERVER:="ftp.debian.org"} | |
@@ -272,6 +284,10 cat <<EOM >$R/etc/hosts | |||||
272 | 127.0.0.1 localhost |
|
284 | 127.0.0.1 localhost | |
273 | 127.0.1.1 ${HOSTNAME} |
|
285 | 127.0.1.1 ${HOSTNAME} | |
274 | EOM |
|
286 | EOM | |
|
287 | if [ "$NET_ADDRESS" != "" ] ; then | |||
|
288 | NET_IP=$(echo ${NET_ADDRESS} | cut -f 1 -d'/') | |||
|
289 | sed -i "s/^127.0.1.1/${NET_IP}/" $R/etc/hosts | |||
|
290 | fi | |||
275 |
|
291 | |||
276 | # Set up IPv6 hosts |
|
292 | # Set up IPv6 hosts | |
277 | if [ "$ENABLE_IPV6" = true ] ; then |
|
293 | if [ "$ENABLE_IPV6" = true ] ; then | |
@@ -289,6 +305,7 cat <<EOM >$R/etc/network/interfaces | |||||
289 | # please configure your networks in '/etc/systemd/network/' |
|
305 | # please configure your networks in '/etc/systemd/network/' | |
290 | EOM |
|
306 | EOM | |
291 |
|
307 | |||
|
308 | if [ "$ENABLE_DHCP" = true ] ; then | |||
292 | # Enable systemd-networkd DHCP configuration for interface eth0 |
|
309 | # Enable systemd-networkd DHCP configuration for interface eth0 | |
293 | cat <<EOM >$R/etc/systemd/network/eth.network |
|
310 | cat <<EOM >$R/etc/systemd/network/eth.network | |
294 | [Match] |
|
311 | [Match] | |
@@ -300,7 +317,23 EOM | |||||
300 |
|
317 | |||
301 | # Set DHCP configuration to IPv4 only |
|
318 | # Set DHCP configuration to IPv4 only | |
302 | if [ "$ENABLE_IPV6" = false ] ; then |
|
319 | if [ "$ENABLE_IPV6" = false ] ; then | |
303 | sed -i "s/=yes/=v4/" $R/etc/systemd/network/eth.network |
|
320 | sed -i "s/^DHCP=yes/DHCP=v4/" $R/etc/systemd/network/eth.network | |
|
321 | fi | |||
|
322 | else # ENABLE_DHCP=false | |||
|
323 | cat <<EOM >$R/etc/systemd/network/eth.network | |||
|
324 | [Match] | |||
|
325 | Name=eth0 | |||
|
326 | ||||
|
327 | [Network] | |||
|
328 | DHCP=no | |||
|
329 | Address=${NET_ADDRESS} | |||
|
330 | Gateway=${NET_GATEWAY} | |||
|
331 | DNS=${NET_DNS_1} | |||
|
332 | DNS=${NET_DNS_2} | |||
|
333 | Domains=${NET_DNS_DOMAINS} | |||
|
334 | NTP=${NET_NTP_1} | |||
|
335 | NTP=${NET_NTP_2} | |||
|
336 | EOM | |||
304 | fi |
|
337 | fi | |
305 |
|
338 | |||
306 | # Enable systemd-networkd service |
|
339 | # Enable systemd-networkd service |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant