mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 07:00:43 +00:00
* Allow a netmask to be specified for each interface.
svn path=/nixos/trunk/; revision=8099
This commit is contained in:
parent
36d4802ea6
commit
935042365c
|
@ -203,7 +203,7 @@
|
|||
example = [
|
||||
{ name = "eth0";
|
||||
ipAddress = "131.211.84.78";
|
||||
netmask = "255.255.255.128";
|
||||
subnetMask = "255.255.255.128";
|
||||
}
|
||||
];
|
||||
description = "
|
||||
|
|
|
@ -8,6 +8,7 @@ let
|
|||
# !!! use XML
|
||||
names = map (i: i.name) interfaces;
|
||||
ipAddresses = map (i: i.ipAddress) interfaces;
|
||||
subnetMasks = map (i: if i ? subnetMask then i.subnetMask else "default") interfaces;
|
||||
|
||||
in
|
||||
|
||||
|
@ -31,12 +32,18 @@ start script
|
|||
# Configure the manually specified interfaces.
|
||||
names=(${toString names})
|
||||
ipAddresses=(${toString ipAddresses})
|
||||
subnetMasks=(${toString subnetMasks})
|
||||
|
||||
for ((n = 0; n < \${#names[*]}; n++)); do
|
||||
name=\${names[$n]}
|
||||
ipAddress=\${ipAddresses[$n]}
|
||||
subnetMask=\${subnetMasks[$n]}
|
||||
echo \"Configuring interface $name...\"
|
||||
${nettools}/sbin/ifconfig \"$name\" \"$ipAddress\" || true
|
||||
extraFlags=
|
||||
if test \"$subnetMask\" != default; then
|
||||
extraFlags=\"$extraFlags netmask $subnetMask\"
|
||||
fi
|
||||
${nettools}/sbin/ifconfig \"$name\" \"$ipAddress\" $extraFlags || true
|
||||
done
|
||||
|
||||
# Set the nameservers.
|
||||
|
|
Loading…
Reference in a new issue