summaryrefslogtreecommitdiffstats
path: root/source/n/network-scripts
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2021-03-01 20:10:44 +0000
committer Eric Hameleers <alien@slackware.com>2021-03-02 08:59:52 +0100
commit07ac5d43e50cb2039f37b4e9447c4e52789c9fb2 (patch)
tree9b2ebc687d19203f8b4ebe1ab2a0b6c485454a3b /source/n/network-scripts
parentfa458b65d9d4c5e933622574d999915ecda37a25 (diff)
downloadcurrent-07ac5d43e50cb2039f37b4e9447c4e52789c9fb2.tar.gz
current-07ac5d43e50cb2039f37b4e9447c4e52789c9fb2.tar.xz
Mon Mar 1 20:10:44 UTC 202120210301201044
a/e2fsprogs-1.46.2-x86_64-1.txz: Upgraded. a/etc-15.0-x86_64-14.txz: Rebuilt. /etc/hosts: added IPv6 loopback addresses. a/hwdata-0.345-noarch-1.txz: Upgraded. ap/hplip-3.20.6-x86_64-7.txz: Rebuilt. Fixed desktop file to show category and icon properly. Thanks to upnort and ArTourter. d/git-2.30.1-x86_64-3.txz: Rebuilt. Make sure the bash-completion file is installed in the proper location. Thanks to Robby Workman. d/python-setuptools-54.0.0-x86_64-1.txz: Upgraded. d/vala-0.50.4-x86_64-1.txz: Upgraded. l/imagemagick-7.0.11_2-x86_64-1.txz: Upgraded. l/python-pillow-8.1.1-x86_64-1.txz: Upgraded. n/network-scripts-15.0-noarch-13.txz: Rebuilt. Well, apparently there was a newer branch of this than the one that was sitting in my usual pending queue, so here it is. This also includes some additional documentation on the new features. NOTE: In order to use SLAAC to configure IPv6, you'll need to have USE_SLAAC[x]="yes" for the interface in rc.inet1.conf. This is to ensure that nobody is surprised to find their machine fully exposed to the internet - better safe than sorry. Thanks to Darren "Tadgy" Austin and Robby Workman. n/wireless_tools-30.pre9-x86_64-4.txz: Rebuilt. This package contains some updates to rc.wireless and rc.wireless.conf. Thanks to Darren "Tadgy" Austin. xfce/mousepad-0.5.3-x86_64-1.txz: Upgraded.
Diffstat (limited to 'source/n/network-scripts')
-rw-r--r--source/n/network-scripts/README.IPv6182
-rw-r--r--source/n/network-scripts/README.VLANs52
-rw-r--r--source/n/network-scripts/README.bonding129
-rw-r--r--source/n/network-scripts/README.networking554
-rw-r--r--source/n/network-scripts/manpages/rc.inet1.82
-rw-r--r--source/n/network-scripts/manpages/rc.inet1.conf.594
-rw-r--r--source/n/network-scripts/modprobe.d/modprobe.d/bonding.conf9
-rw-r--r--source/n/network-scripts/modprobe.d/modprobe.d/ipv6.conf8
-rwxr-xr-xsource/n/network-scripts/network-scripts.SlackBuild8
-rw-r--r--source/n/network-scripts/scripts/netconfig751
-rw-r--r--source/n/network-scripts/scripts/rc.inet1128
-rw-r--r--source/n/network-scripts/scripts/rc.inet1.conf67
12 files changed, 1512 insertions, 472 deletions
diff --git a/source/n/network-scripts/README.IPv6 b/source/n/network-scripts/README.IPv6
new file mode 100644
index 000000000..fe4be5fcf
--- /dev/null
+++ b/source/n/network-scripts/README.IPv6
@@ -0,0 +1,182 @@
+IPv6 for Slackware
+==================
+
+Features
+--------
+* Dual stack. Interfaces can be configured with an IPv4 address or an IPv6
+ address, or both.
+* Each interface can have single or multiple v4 and/or v6 IPs. Additional
+ v4 IPs are added as 'alias' interfaces, whereas v6 IPs are simply added
+ to the interface.
+* Optional StateLess Address Auto Configuration (SLAAC) of v6 IP addresses
+ (disabled by default).
+* DHCPv6 support for server controlled address configuration.
+* Fixed IP configuration of IPv6 interfaces.
+
+Configuration
+-------------
+v6 IPs can be configured via SLAAC, DHCP6 or statically using the following new
+options for rc.inet1.conf:
+ USE_SLAAC[x]="" Allow StateLess Address Auto Configuration of a
+ (potentially) globally routable v6 IP. With this option
+ set to "yes", the interface's v6 IP will ONLY be
+ configured via SLAAC, even if RA indicates DHCP6 is
+ available on the network - if SLAAC is not available on
+ the network, no IPv6 address will be assigned.
+
+ Since dhcpcd is capable of handling SLAAC as well as
+ DHCP, it is better practice to set USE_DHCP6[x]="yes" to
+ perform full auto configuration instead.
+
+ USE_DHCP6[x]="" Use dhcpcd to configure the interface. This will bring
+ up the interface using DHCP6, falling back to SLAAC (if
+ configured on the network), or will leave the interface
+ unconfigured after a timeout. When this option is set
+ to "yes", the USE_SLAAC[x] option is ignored.
+
+ This is the preferred option to configure an interface
+ dynamically - whether the network is setup for DHCP6 or
+ SLAAC, dhcpcd will be able to configure the interface.
+
+ IP6ADDRS[x]="" The static v6 IP addresses for the interface. This
+ option takes a list of v6 IP addresses and prefix
+ lengths in CIDR notation, in a space delimited list.
+ For example: IP6ADDRS[x]="a:b:c:d:e::1/48 1:2:3:4::5/64"
+
+ If a prefix length is not given (separated from the IP
+ address with a /), a length of 64 will be assumed, and
+ a warning emitted about the unset value.
+
+ When either the USE_DHCP6[x] or USE_SLAAC[x] options are
+ set to "yes", this setting is ignored - dynamic
+ configuration takes precedence over fixed IPs in
+ Slackware.
+
+ GATEWAY6="" The default IPv6 gateway for the network. This is a
+ IPv6 address in standard format.
+
+The following lesser used misc options have been added for use in rc.inet1.conf:
+ USE_RA[x]="" Normally, unless USE_SLAAC[x]="yes" is set, Router
+ Advertisment (RA) is disabled for the interface as it
+ can result in extraneous routes being added to the
+ routing table. With this option set to "yes", RA
+ packets will be accepted on the interface even when DHCP
+ or fixed IP addressing is used, and the routes
+ advertised by the router will be added to the table.
+
+ Conversely, if this option is explicitly set to "no", RA
+ will be disabled at all times - meaning SLAAC cannot be
+ performed even when USE_SLAAC[x]="yes" is set. The
+ default (unset) is to enable RA when SLAAC is in use,
+ and to disable it otherwise.
+
+ The use of this option should rarely be required as
+ rc.inet1 will do the right thing.
+
+ SLAAC_TIMEOUT[x]="" The time to wait (in seconds) for an interface to be
+ configured by SLAAC. When unset, the default is 15.
+ Some networks may require a longer period for the router
+ to broadcast an advertisement packet on the network.
+
+
+Disabling IPv6
+--------------
+For some use cases, where IPv6 support is not required at all, disabling IPv6
+may be a better option than leaving the interface unconfigured.
+
+There are two similar methods which can be used to disable IPv6. Both of the
+options involve creating (or replacing the content if it already exists) the
+file /etc/modprobe.d/ipv6.conf (which overrides any configuration in the
+/lib/modprobe.d/ipv6.conf file), and making the content as follows:
+ alias ipv6 off
+ alias net-pf-10 off
+Or:
+ install ipv6 /bin/true
+ install net-pf-10 /bin/true
+
+It is important to disable both the 'ipv6' and 'net-pf-10' modules since the
+module can be automatically loaded by each name.
+
+
+Changes from previous Slackware versions
+----------------------------------------
+* Previously, if the network the host is connecting to is configured for
+ StateLess Address Auto Configuration (SLAAC), the host would bring up an
+ interface with a (potentially) globally routable IPv6 address with no
+ configuration by the user. This has been changed so that all network
+ configuration must be explicitly enabled. Thus, interfaces will no longer
+ automatically come up with a valid IPv6 address on networks which support auto
+ configuration, without enabling the USE_SLAAC[x]="yes" option for the
+ interface. This is a security enhancement.
+
+* Unless RA is explicitly enabled using the USE_RA[x]="yes" option, rc.inet1 now
+ disables RA (via the accept_ra tunable in /proc) for an interface before
+ trying to add any IPs configured for it. This prevents RA on the network from
+ automatically adding any routes to the table. When USE_SLAAC[x]="yes" is set,
+ RA is implicitly re-enabled for the interface (since SLAAC and RA are usually
+ used together on a network), unless explicitly disabled with USE_RA[x]="no".
+ This is a change from previous versions of Slackware, which would auto
+ configure routes. This is a security enhancement in the same vein as above.
+
+* Interfaces will no longer be brought into the 'up' state unless they are
+ actually configured with an IP address. In previous versions, no matter
+ whether the interface was assigned an IP (either via DHCP or a fixed IP) or
+ not, the interface would be left in the 'up' state after executing 'rc.inet1
+ start'. This will no longer happen and is considered a clean-up of the
+ previous behaviour.
+
+* If no NETMASK[x] is set for an interface, rc.inet1 will now assume a
+ prefix/netmask of 24 (and will emit a warning). CIDR notation netmasks are now
+ recommended (with the leading / as optional), but the old style dotted-quad
+ notation is still accepted for IPv4. This is a configuration enhancement.
+
+* In previous versions, the IP aliases configuration for IPv4 assumed a netmask
+ of /32, making the interface only addressable by itself. Now, a netmask of
+ /24 is assumed where none is provided in the configuration. This is a bugfix.
+
+* Sometime during this -current cycle, the call to dhcpcd gained a hard coded -L
+ (disable use of IPv4LL addresses as last resort) parameter which effectively
+ rendered the DHCP_NOIPV4LL[x] option redundant - the use of -L was not
+ contingent upon the value of DHCP_NOIPV4LL[x]. The hard coded -L has been
+ removed from the dhcpcd command line, restoring the behaviour of 14.2 and the
+ usefulness of the DHCP_NOIPV4LL[x] option.
+
+
+Known issues
+------------
+* When being invoked without the -4 or -6 option (that is, when both USE_DHCP[x]
+ and USE_DHCP6[x] are set), dhcpcd will only wait until one type of IP is
+ obtained before backgrounding - it will not wait for both a v4 AND v6 to be
+ configured. This means there is no way to know if the interface has been
+ configured for both types of IP, as one type will continue to be sought in the
+ background; but may ultimately fail. This is an issue with the way dhcpcd
+ operates and not an issue with rc.inet1.
+
+* Changes in interface configuration type from DHCP to fixed IP or stateless
+ will cause an issue where the dhcpcd daemon fails to be stopped during a
+ restart or stop/start operation because rc.inet1 is unaware of how an
+ interface was previously configured - it can only stop the interface based
+ upon its current configuration. This is a by-product of the way the rc.inet1
+ script is coded (there is no record kept of the previous configuration type of
+ an interface) and is present (but doesn't seem to be documented anywhere) on
+ previous versions of Slackware. This particular issue is not specifically
+ related to IPv6, but is documented here for completeness.
+
+* When being killed in if_down(), dhcpcd requires some command line options to
+ match those which were used to invoke it - not only does the interface name
+ need to match, but also the use of -4/-6. This can cause a problem during a
+ restart or stop/start of the interface if the configuration for DHCP has
+ changed. This manifests itself in the same way as the issue detailed above
+ and is no more serious. In both cases, the end user must kill the dhcpcd
+ daemon manually. This issue is caused by the new way dhcpcd is invoked when
+ using/not using IPv6.
+
+
+Thanks
+------
+* Robby Workman, for the original iproute2 version of rc.inet1 and advice.
+* David Spencer, for advice, debating, and testing the SLAAC implementation.
+
+--
+Darren 'Tadgy' Austin.
+<darren (at) afterdark.org.uk>
diff --git a/source/n/network-scripts/README.VLANs b/source/n/network-scripts/README.VLANs
new file mode 100644
index 000000000..108c399e1
--- /dev/null
+++ b/source/n/network-scripts/README.VLANs
@@ -0,0 +1,52 @@
+VLANs (aka, 802.1q)
+===================
+
+Features
+--------
+* Simple configuration of VLAN interfaces using standard rc.inet1.conf
+ variables.
+* Utilises the new IFOPTS[x]="" paramter, which allows VLAN interface
+ specific configuration, supporting the use of any option.
+* VLAN interfaces can be built on top of bonds and virtual or physical
+ interfaces.
+
+
+Configuration
+-------------
+Configuring VLAN bound interfaces utilises the standard Slackware networking
+configuration syntax in rc.inet1.conf, with setting up an interface as simple
+as changing the IFNAME[x].
+
+VLAN interfaces can be configured quite simply in rc.inet1.conf, in the standard
+Slackware way of defining an interface. The key to the configuration is to use
+the correct IFNAME[x]="" setting for the underlying ethernet (or bond) interface
+and the tagged VLAN ID that should be exposed. For example:
+ IFNAME[0]="eth0.10"
+ IFOPTS[0]=""
+ IPADDR[0]="192.168.10.1"
+ NETMASK[0]="24"
+
+The VLAN ID is taken from the full interface name, which is comprised of the
+underlying interface name, a period (.) and then the VLAN ID to expose.
+The above example would use the physical interface 'eth0', and expose the VLAN
+with ID '10'.
+
+It is also possible to use a bond as the underlying interface, which allows
+link aggregated VLAN interfaces to be created for network redundancy.
+
+The interfaces support IPv4 and IPv6 IP addressing configured in the Slackware
+way in rc.inet1.conf.
+
+IFOPTS[x] is a pipe (|) delimited list of VLAN kernel module specific settings
+to be applied to the interface. The ip-link(8) man page contains details of
+exactly what settings can be used with this option (search for "VLAN Type
+Support"). For example:
+ VLANOPTS[x]="protocol 802.1ad | reorder_hdr off"
+
+Under normal circumstances, where a standard VLAN interface is required, no
+options should be supplied.
+
+
+--
+Darren 'Tadgy' Austin.
+<darren (at) afterdark.org.uk>
diff --git a/source/n/network-scripts/README.bonding b/source/n/network-scripts/README.bonding
new file mode 100644
index 000000000..5f14e50c2
--- /dev/null
+++ b/source/n/network-scripts/README.bonding
@@ -0,0 +1,129 @@
+Bonding (link aggregation)
+==========================
+
+Features
+--------
+* Full support of features offered by the bonding kernel module.
+* Selectable bonding mode using a single parameter in rc.inet1.conf.
+* Easy addition of interfaces to the bond using a parameter in rc.inet1.conf.
+* Custom bonding module options can be provided using the generic parameter
+ IFOPTS[x] in the configuration file.
+
+Configuration
+-------------
+Bonding interfaces can be configured via two new bond specific parameters in
+rc.inet1.conf, plus use of the generic IFOPTS[x] parameter. New parameters
+are:
+ BONDNICS[x]="" The space delimited list of interfaces to add to this
+ bond. The interfaces will be brought up and configured
+ while bringing up the interface, so do not need to be
+ previously defined in rc.inet1.conf. A bond can be
+ created with only 1 interface, but does not become
+ useful until at least 2 interfaces are configured.
+
+ BONDMODE[x]="" This parameter sets the bonding mode for this
+ interface. If not specified when BONDNICS[x] has been
+ used, the default is 'balance-rr'. See below for a
+ list of all bonding modes available.
+
+The following bond modes are available:
+ balance-rr This mode is also known as round-robin mode. Packets
+ are sequentially transmitted and received through each
+ interface one by one. This mode provides load
+ balancing functionality along with fault tolerance.
+ active-backup When in this mode only one interface set to active,
+ while all other interfaces are in the backup state. If
+ the active interface fails, a backup interface replaces
+ it as the only active interface in the bond. This mode
+ only provides fault tolerance, no load balancing.
+ This mode requires that the 'primary <interface>'
+ option be configured with the IFOPTS[x] parameter.
+ balance-xor The source MAC address uses exclusive or (XOR) logic
+ with the destination MAC address. This calculation
+ ensures that the same slave interface is selected for
+ each destination MAC address. This mode provides fault
+ tolerance and load balancing.
+ broadcast All packets are sent to all the slaved interfaces. This
+ mode provides fault tolerance, but may result in
+ duplicate packets arriving at the destination.
+ 802.3ad Also known as LACP. This mode creates aggregation
+ groups that share the same speed and duplex settings,
+ and it requires a switch that supports an IEEE 802.3ad.
+ This mode uses all interfaces to form the aggregation
+ group and provides fault tolerance and load balancing.
+ balance-tlb This mode ensures that the outgoing traffic
+ distribution is set according to the load on each
+ interface and that the current interface receives all
+ the incoming traffic. If the assigned interface fails
+ to receive traffic, another interface is assigned to
+ the receiving role. This provides fault tolerance and
+ load balancing.
+ balance-alb The receiving packets are load balanced through Address
+ Resolution Protocol (ARP) negotiation. This mode
+ provides fault tolerance and load balancing.
+
+Module specific interface options can be set using the the IFOPTS[x] paramter,
+which takes a pipe (|) delimited list of options for the interface. The
+following are the most useful options which can be set with IFOPTS[x]:
+ miimon Specifies the MII link monitoring frequency in milliseconds.
+ This determines how often the link state of each slaved
+ interface is checked for link failures. A value of zero
+ disables MII link monitoring, but this is NOT advised. A value
+ of 100 is a good starting point. The default value is 0, so be
+ sure to set this option with ALL modes.
+ lacp_rate This option specifies the rate at which the host will ask the
+ link partner to transmit LACPDU packets in 802.3ad mode.
+ Possible values are:
+ slow Transmit LACPDUs every 30 seconds.
+ fast Transmit LACPDUs every 1 second.
+ The default is slow, but fast is recommended.
+ primary The interface (eth0, eth2, ...) selecting which slave is the
+ primary device. The specified interface will always be the
+ active slave while it is available. Only when the primary is
+ off-line will alternate interfaces be used. This is useful
+ when one interface is preferred over another (e.g. when one
+ interface has higher throughput than another). This option
+ is only valid for active-backup, balance-tlb, and balance-alb
+ modes.
+ xmit_hash_policy
+ Selects the transmit hash policy to use for interface selection
+ in balance-xor, 802.3ad, and balance-tlb modes. Possible
+ values are:
+ layer2 Use XOR of source/dest hardware MAC addresses
+ and packet type ID fields to generate the hash.
+ This algorithm will place all traffic to a
+ particular network peer on the same slave.
+ layer2+3 Use a combination of layer2 and layer3 protocol
+ information (hardware MAC addresses and IP
+ addresses) to generate the hash.
+ This algorithm will place all traffic to a
+ particular network peer on the same slave.
+ This policy is intended to provide a more
+ balanced distribution of traffic than layer2
+ alone, especially in environments where a
+ layer3 gateway device is required to reach most
+ destinations.
+ layer3+4 This policy uses upper layer protocol
+ information, when available, to generate the
+ hash. This allows for traffic to a particular
+ network peer to span multiple slave interfaces,
+ although a single connection will not span
+ multiple slaves.
+ The default value is layer2. Additional (lesser used) policies
+ are available, and documented in kernel source documentation:
+ /usr/src/linux/Documentation/networking/bonding.txt
+
+The IFOPTS[x] option should always include the 'miimon' option - not using this
+option will result in network degradation.
+In 'active-backup' mode, the 'primary' option should also be supplied.
+When using '802.3ad mode', set "lacp_rate fast" for faster recovery from an
+interface failure.
+In other modes, the 'xmit_hash_policy' should be set.
+
+Full documentation of the bonding layer is available in the kernel source
+documentation: /usr/src/linux/Documentation/networking/bonding.txt.
+
+
+--
+Darren 'Tadgy' Austin.
+<darren (at) afterdark.org.uk>
diff --git a/source/n/network-scripts/README.networking b/source/n/network-scripts/README.networking
new file mode 100644
index 000000000..835db50aa
--- /dev/null
+++ b/source/n/network-scripts/README.networking
@@ -0,0 +1,554 @@
+Slackware Network Configuration
+===============================
+
+Networking in Slackware is configured by the /etc/rc.d/rc.inet1 script, and the
+configuration file /etc/rc.d/rc.inet1.conf. Wireless interfaces are configured
+just like any network interface, but accept many more configuration parameters.
+
+The rc.inet1.conf file contains a series of variable array definitions, with
+each array index corresponding to a single network interface. This means that
+each set of parameters with an index of 0 configure the first interface (since
+indexing starts at 0), parameters with an index of 1 configure the second
+interface, and so on. Not all parameters need to be set for each type of
+interface, or interface number. This is better illustrated with examples,
+which you will find in the documentation below.
+
+
+Starting and Stopping Interfaces
+--------------------------------
+The way to start networking (configuring all NICs, bringing the interfaces up,
+and creating a default route, if required) is by running the command:
+ /etc/rc.d/rc.inet1 start
+This command will configure all networking interfaces which are defined in the
+configuration file, and is used at boot time to bring networking up.
+
+The counterpart to this is the:
+ /etc/rc.d/rc.inet1 stop
+command, which will bring all networking to a stop. It is advised to use this
+with caution as it can make your host completely inaccessable from the network.
+
+Restarting the whole network (all available network interfaces) and resetting
+the default gateway (if set) is done in a similar fashion to starting it:
+ /etc/rc.d/rc.inet1 restart
+And will first deconfigure all interfaces, before bringing them back up - which
+is functionally equalivant to a 'stop' and 'start' operation.
+
+More specifically speaking, you can start/stop/restart any network interface on
+an individual basis using the commands:
+ /etc/rc.d/rc.inet1 <interface>_start
+ /etc/rc.d/rc.inet1 <interface>_stop
+ /etc/rc.d/rc.inet1 <interface>_restart
+where <interface> is the name of an existing network interface (eth0, eth1,
+wlan0, etc).
+
+
+Guided Networking Configuration
+-------------------------------
+The 'netconfig' script is capable of configuring basic networking parameters for
+the first ethernet interface of the system, and writing an annotated
+/etc/rc.d/rc.inet1.conf configuration file. 'netconfig' is usually invoked
+during installation to configure the first ethernet interface of your freshly
+installed system.
+
+'netconfig' is capable of configuring a set of IPv4 and/or IPv6 addresses for an
+interface, or setting the interface to be configured using DHCP (both DHCPv4 and
+DHCPv6) and IPv6 StateLess Address Auto Configuration (SLAAC). The default
+gateways and nameservers can also be configured through the guided interface.
+
+The option to use NetworkManager for interface configuration (instead of
+rc.inet1.conf) is also available.
+
+For most users with a single ethernet interface, and simple IP configuration
+requirements, 'netconfig' can completely configure the networking sub-system for
+you.
+
+
+Deprecated and New IPv4 Configuration Syntax
+--------------------------------------------
+With the release of Slackware 15.0, several parameters used in older
+rc.inet1.conf configurations have become deprecated and are substituted by a
+new, singular, IP parameter for v4 addresses.
+
+Specifically, the following parameters used in previous rc.inet1.conf
+configurations to configure IPv4 addresses have become deprecated:
+ IPADDR[x]=""
+ NETMASK[x]=""
+ IPALIASES[x]=""
+These parameters should no longer be used in new configurations.
+
+New configurations should use the updated syntax parameter:
+ IPADDRS[x]=""
+which can hold multiple, space delimited, IPv4 addresses with their CIDR
+masks in order to configure an interface.
+
+The format for the addresses specified in this new parameter is:
+ IP-address/mask
+For example:
+ IPADDRS[0]="192.168.0.1/24 10.10.10.10/8"
+which would be the equilivant of old syntax:
+ IPADDR[0]="192.168.0.1"
+ NETMASK[0]="255.255.255.0"
+ IPALIASES[0]="10.10.10.10/8"
+
+If a mask (in CIDR notation) is not provided with the IP address in IPADDRS, it
+is assumed to be /24 (aka, 255.255.255.0). A warning will also be emitted about
+the missing mask.
+
+rc.inet1 is fully backwards compatible with the older syntax - old configuration
+files will contiinue to be accepted for the foreseeable future, but 'netconfig'
+has been adjusted to output the new syntax.
+
+Notes:
+ * When DHCP or SLAAC is used to dynamically configure the interface, IP
+ addresses specified in IPADDRS will be added to the interface as alias IPs.
+ However, any address specified in IPADDR is *not* added to the interface in
+ order to maintain backwards semantics with the pre 15.0 rc.inet1.
+ * Should an rc.inet1.conf contain both the IPADDR and IPADDRS parameters
+ (without DHCP or SLAAC being in use) the addresses listed in IPADDRS will be
+ added to the interface after the IPADDR address is set.
+
+
+Manual Networking Configuration
+-------------------------------
+FIXME
+
+
+IPv6
+----
+ Overview
+ ~~~~~~~~
+
+ With the new IPv4 syntax detailed above, there is the addition of optional
+ configuration semantics for IPv6.
+
+ The IPv6 capabilities in Slackware 15.0+ are as follows:
+ * Dual stack. Interfaces can be configured with an IPv4 address or an IPv6
+ address, or both.
+ * Each interface can have single or multiple v4 and/or v6 IPs.
+ * Optional StateLess Address Auto Configuration (SLAAC) of v6 IP addresses,
+ for quick and easy IPv6 configuration on supported networks.
+ * DHCPv6 support for server controlled dynamic address configuration.
+ * Fixed IPv6 addresses configured interfaces.
+
+ 'netconfig' can be used for guided configuration of all of the above features,
+ or they can be configured manually using the options below.
+
+
+ IPv6 Parameters
+ ~~~~~~~~~~~~~~~
+ v6 IPs can be configured via SLAAC, DHCP6 or statically using the following
+ new options for rc.inet1.conf:
+ USE_SLAAC[x]="" Allow StateLess Address Auto Configuration of a
+ (potentially) globally routable v6 IP. With this
+ parameter set to "yes", the interface's v6 IP will ONLY
+ be configured via SLAAC, even if Router Advertisment
+ indicates DHCPv6 is available on the network - if SLAAC
+ is not available on the network, no IPv6 address will be
+ assigned.
+
+ Since 'dhcpcd' is capable of handling SLAAC as well as
+ DHCPv6, it is better practice to set USE_DHCP6[x]="yes"
+ to perform full auto configuration instead.
+
+ USE_DHCP6[x]="" Use 'dhcpcd' to configure the interface. This will
+ bring up the interface using DHCPv6, falling back to
+ SLAAC (if supported on the network), or will leave the
+ interface unconfigured after a timeout. When this
+ parameter is set to "yes", the USE_SLAAC[x] option is
+ ignored.
+
+ This is the preferred option to configure an interface
+ dynamically - whether the network is setup for DHCPv6 or
+ SLAAC, 'dhcpcd' will be able to configure the interface.
+
+ IP6ADDRS[x]="" The static v6 IP addresses for the interface. This
+ parameter takes a list of v6 IP addresses and prefix
+ lengths in CIDR notation, in a space delimited list.
+ For example: IP6ADDRS[x]="a:b:c:d:e::1/48 1:2:3:4::5/64"
+
+ If a prefix length is not given (separated from the IP
+ address with a /), a length of 64 will be assumed, and
+ a warning emitted about the unset value.
+
+ When either the USE_DHCP6[x] or USE_SLAAC[x] options are
+ set to "yes", the IP addresses listed in this parameter
+ are also added to the interface, but only upon sucessful
+ assigning of the dynamic IP address.
+
+ A static gateway can be configured using this parameter:
+ GATEWAY6="" The default IPv6 gateway for the network. This is a
+ single IPv6 address in standard format, without a
+ prefix suffix.
+
+ The following lesser used misc options can be used for tailouring of the IPv6
+ configuration process:
+ USE_RA[x]="" Normally, unless USE_SLAAC[x]="yes" is set, Router
+ Advertisment (RA) is disabled for the interface as it
+ can result in extraneous routes being added to the
+ routing table. With this option set to "yes", RA
+ packets will be accepted on the interface even when DHCP
+ or fixed IP addressing is used, and the routes
+ advertised by the router will be added to the table.
+
+ Conversely, if this parameter is explicitly set to "no",
+ RA will be disabled at all times - meaning SLAAC cannot
+ be performed even when USE_SLAAC[x]="yes" is set. The
+ default (unset) is to enable RA when SLAAC is in use,
+ and to disable it otherwise.
+
+ The use of this parameter should rarely be required as
+ rc.inet1 will do the right thing.
+
+ SLAAC_TIMEOUT[x]="" The time to wait (in seconds) for an interface to be
+ configured by SLAAC. When unset, the default is 15.
+ Some networks may require a longer period for the router
+ to broadcast an advertisement packet on the network, so
+ may need to increase this value.
+
+
+ Disabling IPv6
+ ~~~~~~~~~~~~~~
+ For some use cases, where IPv6 support is not required at all, disabling IPv6
+ may be a better option than leaving the interface unconfigured.
+
+ There are two similar methods which can be used to disable IPv6. Both of the
+ options involve creating (or replacing the content if it already exists in)
+ the file:
+ /etc/modprobe.d/ipv6.conf
+ (which overrides any configuration in the /lib/modprobe.d/ipv6.conf file),
+ with the content:
+ alias ipv6 off
+ alias net-pf-10 off
+ Or:
+ install ipv6 /bin/true
+ install net-pf-10 /bin/true
+
+ It is important to disable both the 'ipv6' and 'net-pf-10' modules since the
+ module can be automatically loaded by either name.
+
+
+ Changes From Previous Behaviour
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ * Previous to Slackware 15.0, if the network the host is connecting to is set
+ up for StateLess Address Auto Configuration (SLAAC), the host would bring up
+ an interface with a (potentially) globally routable IPv6 address with no
+ configuration by the user. This has been changed so that all network
+ configuration must be explicitly enabled. Thus, interfaces will no longer
+ automatically come up with a valid IPv6 address on networks which support
+ auto configuration, without enabling the USE_SLAAC[x]="yes" parameter for
+ the interface. This is a security enhancement.
+
+ * Unless RA is explicitly enabled using the USE_RA[x]="yes" option, rc.inet1
+ now disables RA (via the accept_ra tunable in /proc) for an interface before
+ trying to add any IPs configured for it. This prevents RA on the network
+ from automatically adding any routes to the table. When USE_SLAAC[x]="yes"
+ is set, RA is implicitly re-enabled for the interface (since SLAAC and RA
+ are usually used together on a network), unless explicitly disabled with
+ USE_RA[x]="no". This is a change from previous versions of Slackware, which
+ would auto configure routes without any user intevention. This is a
+ security enhancement.
+
+
+ Caveats
+ ~~~~~~~
+ * When being configured with the USE_DHCP[x]="yes" and USE_DHCP6[x]="yes"
+ parameters for an interface (that is, configured to obtain both a v4 and v6
+ addresses via DHCP), 'dhcpcd' will only wait until one type of IP is
+ obtained before backgrounding - it will not wait for both a v4 AND v6 to be
+ configured. This means there is no way to know if the interface has been
+ completely configured for both types of IP, as one type will continue to be
+ sought in the background; but MAY ultimately fail. This is an issue with
+ the way dhcpcd operates, not an issue with rc.inet1.
+
+
+Bonding / Link Aggregation
+--------------------------
+ Overview
+ ~~~~~~~~
+ Bonding (or Link Aggregation) is a teccnique for combining two or more
+ physical interfaces into a single, logical, interface; a logical interface
+ which has all the capabilities of a single physical interface.
+
+ The Slackware bonding options provide full support for the features offered by
+ the bonding kernel module, in the familiar Slackware parameter configuration
+ syntax. Included is the ability to select the bonding mode, easy addition of
+ interfaces to a bond using a new parameter in rc.inet1.conf, and the setting
+ of bonding module options via a new, generic, IFOPTS[x] parameter.
+
+ At this time 'netconfig' is unable to configure bonded interfaces, so they
+ must be configured manually with the parameters detailed below.
+
+
+ Bonding Parameters
+ ~~~~~~~~~~~~~~~~~~
+ Bonded interfaces can be configured via two new bond specific parameters for
+ use in rc.inet1.conf, plus the new, generic, IFOPTS[x] parameter. The new
+ bonding parameters are:
+ BONDNICS[x]="" The space delimited list of interfaces to add to this
+ bond. The interfaces will be brought up and configured
+ while bringing up the interface, so do not need to be
+ previously defined in rc.inet1.conf. A bond can be
+ created with only 1 interface, but does not become
+ useful until at least 2 interfaces are configured.
+
+ BONDMODE[x]="" This parameter sets the bonding mode for the logical
+ interface. If not specified when BONDNICS[x] has been
+ used, the default is 'balance-rr'. See below for a
+ list of all bonding modes available.
+
+
+ Bonding Modes
+ ~~~~~~~~~~~~~
+ When a bonded logical interface is created, it needs to operate in a
+ particular mode. By default that mode is 'balance-rr'. The following modes,
+ along with details of their functionallity, are available using the kernel
+ bonding driver:
+ 802.3ad Also known as LACP. This mode requires a switch that
+ supports an IEEE 802.3ad. The physical interfaces must
+ share the same speed and duplex settings and form a
+ logical interface which provides fault tolerance and
+ load balancing.
+ active-backup When in this mode only one interface set to active,
+ while all other interfaces are in the backup state. If
+ the active interface fails, a backup interface replaces
+ it as the only active interface in the bond. This mode
+ only provides fault tolerance, no load balancing.
+ This mode requires that the 'primary <interface>'
+ option be configured with the IFOPTS[x]="" parameter.
+ balance-alb The receiving packets are load balanced through Address
+ Resolution Protocol (ARP) negotiation. This mode
+ provides fault tolerance and load balancing.
+ balance-rr This mode is also known as round-robin mode. Packets
+ are sequentially transmitted and received through each
+ interface one by one. This mode provides load
+ balancing functionality along with fault tolerance.
+ This is the default mode of operation.
+ balance-tlb This mode ensures that outgoing traffic is distributed
+ according to the load on each physical interface. If
+ one interface fails to receive traffic, another
+ interface is assigned to the receiving role. This mode
+ provides fault tolerance and load balancing.
+ balance-xor The source MAC address uses eXclusive OR (XOR) logic
+ with the destination MAC address in order to determine
+ which physical interface the packet should be sent via.
+ This calculation ensures that the same physical (slave)
+ interface is selected for each destination host. If the
+ physical interface to be used is in a failed state, one
+ of the backup interfaces is used instead. This mode
+ provides fault tolerance and load balancing.
+ broadcast All packets are sent to all the physical (slaved)
+ interfaces at once. This mode provides fault tolerence
+ but may result in duplicate packets arriving at the
+ destination host, assuming they are not screened out by
+ networking hardware.
+
+
+ Bonding Options
+ ~~~~~~~~~~~~~~~
+ Bonding specific options can be set using the the IFOPTS[x]="" paramter (which
+ takes a pipe (|) delimited list of options) for the interface being
+ configured. The following are the most useful options (but not an exhaustive
+ list - see "Further Reading" below for more information) which can be set:
+ lacp_rate This option specifies the rate at which the host will
+ ask the switch to transmit LACPDU packets in 802.3ad
+ mode. Possible values are:
+ slow Transmit LACPDUs every 30 seconds.
+ fast Transmit LACPDUs every 1 second.
+ The default is slow, but fast is recommended for rapid
+ recovery after a physical link failure.
+ miimon Specifies the MII link monitoring frequency in
+ milliseconds. This determines how often the link state
+ of each physical (slaved) interface is checked for link
+ failures. A value of zero disables MII link monitoring,
+ but this is NOT advised. A value of 100 is a good
+ starting point. The default value is 0, so be sure to
+ set this option with ALL bonding modes.
+ primary The physical (slave) interface (eth0, eth1, etc) which
+ is to be used as the primary interface. The specified
+ interface will always be the active slave while it is
+ available. Only when the primary interface is off-line
+ will alternate interfaces be used. This is useful when
+ one interface is preferred over another (e.g. when one
+ interface has higher throughput than another). This
+ option is only valid for "active-backup", "balance-tlb",
+ and "balance-alb" bonding modes.
+ xmit_hash_policy Selects the transmit hash policy to use for interface
+ selection in "balance-xor", "802.3ad", and "balance-tlb"
+ bonding modes. Possible values are:
+ layer2 Use eXclusive OR (XOR) of source and
+ destination MAC addresses and packet
+ type ID fields to generate the hash.
+ This algorithm will place all traffic
+ to a particular destination on the
+ same phydivsl (slave) interface.
+ layer2+3 Use a combination of layer2 and
+ layer3 protocol information (MAC
+ addresses and IP addresses) to
+ generate the hash. This algorithm
+ will place all traffic to a particular
+ destination on the same physical
+ (slave) interface. This policy is
+ intended to provide a more balanced
+ distribution of traffic than layer2
+ alone.
+ layer3+4 This policy uses upper layer protocol
+ information, when available, to
+ generate the hash. This allows for
+ traffic to a particular destination to
+ span multiple physical (slave)
+ interfaces, although a single
+ connection will not span multiple
+ slaves.
+ The default value is layer2. Additional (lesser used)
+ policies are available - see the "Further Reading"
+ section below for further details.
+
+
+ Caveats
+ ~~~~~~~
+ * The IFOPTS[x]="" parameter should always include the 'miimon' option - not
+ using this option will result in network degradation.
+ * In "active-backup" mode, the "primary" option should also always be
+ supplied.
+ * When using "802.3ad" mode, set "lacp_rate fast" for faster recovery from an
+ interface failure. In other modes, the 'xmit_hash_policy' should be set.
+
+
+ Examples
+ ~~~~~~~~
+ FIXME: Add examples.
+
+
+ Further Reading
+ ~~~~~~~~~~~~~~~
+ Full documentation of the bonding layer is available in the kernel source
+ documentation at: /usr/src/linux/Documentation/networking/bonding.txt.
+
+
+VLANs (a.k.a, 802.1q)
+---------------------
+ Overview
+ ~~~~~~~~
+ Virtual LANs (VLANs) allow the segmentation of physical networks into
+ multiple, isolated, private virtual networks, whilst using shared network
+ switches and hardware.
+
+ VLANs work by applying tags to network frames to form virtual private LANs.
+ In this way, VLANs can keep network applications separate despite being
+ connected to the same physical network, and without requiring multiple sets of
+ cabling and networking devices to be deployed.
+
+ In essence, a VLAN is a collection of devices or network hosts that
+ communicate with one another as if they make up a single LAN, but utilising
+ shared network hardware.
+
+ Because VLAN frames are tagged with a VLAN ID, it is possible to 'cherry-pick'
+ those frames from the network by use of a VLAN interface on the host.
+
+ Slackware now allows configuration of such interfaces in order to allow a host
+ to join a specific VLAN or VLANs. The guided deployment in 'netconfig' has
+ been updated to support the creation of such VLAN interfaces.
+
+ The configuration in rc.inet1.conf for VLANs is a simple modification of the
+ existing support for declaration of a network interface using the standard
+ Slackware IFNAME[x] parameter. As shown in the examples below, VLANs
+ interfaces can be built on top on top of regular, physical, interfaces, or on
+ top of a bond interface to allow for link aggregation.
+
+ The new IFOPT[x] generic interface options parameter can be used to customise
+ the usage and configuration of the VLAN interfaces, but is not required in a
+ normal configuration setting.
+
+
+ Exposing VLANs
+ ~~~~~~~~~~~~~~
+ Configuring VLAN interfaces utilises the standard Slackware networking
+ configuration syntax in rc.inet1.conf; with setting up an interface as simple
+ as changing the IFNAME[x]="" parameter.
+
+ VLAN interfaces can be configured quite simply in rc.inet1.conf, in the
+ standard Slackware way of defining an interface. The key to the configuration
+ is to use the correct IFNAME[x]="" parameter for the underlying physical (or
+ bond) interface and the tagged VLAN ID that should be exposed. For example:
+ IFNAME[0]="eth0.10"
+ IFOPTS[0]=""
+ IPADDRS[0]="192.168.10.1/24"
+
+ The VLAN ID is taken from the full interface name, as set in the IFNAME[x]
+ parameter which is comprised of the underlying physical (or bond) interface
+ name, a period (.) and the VLAN ID to expose. The above example would use the
+ physical interface 'eth0', and expose the VLAN with ID 10, and configure the
+ interface with the IPv4 address 192.168.10.1 with a mask of 24.
+
+ IFOPTS[x]="" is a pipe (|) delimited list of VLAN kernel module specific
+ settings to be applied to the interface. The ip-link(8) man page contains
+ details of exactly what settings can be used with this option (search for
+ "VLAN Type Support"). For example:
+ IFOPTS[x]="protocol 802.1ad | reorder_hdr off"
+ Under normal circumstances, where a standard VLAN interface is required, no
+ options need be supplied.
+
+
+ Examples
+ ~~~~~~~~
+ FIXME: Add examples.
+
+
+Bridges
+-------
+
+
+Wireless (WiFi) Network Interfaces
+----------------------------------
+
+
+TUN/TAP
+-------
+
+
+Advanced networking configuration
+---------------------------------
+(stacking interface configs - bond, then VLAN, then bridge)
+
+ It is also possible to use a bond as the underlying interface, which allows
+ link aggregated VLAN interfaces to be created for network redundancy. For
+ example:
+ IFNAME[0]="bond0"
+ BONDNICS[0]="eth0 eth1"
+ BONDMODE[0]="active-backup"
+ IFOPTS[0]="miimon 100 | primary eth0"
+ IFNAME[1]="bond0.5"
+ IFNAME[2]="br0"
+ BRNICS[2]="bond0.5"
+ IPADDRS[2]="192.168.5.10/24"
+ IP6ADDRS[2]="a:b:c:d::1/64"
+ Would create a bond interface using the eth0 and eth1 physical ethernet
+ interfaces, in an "active-backup" redundancy configuration with the primary
+ interface being "eth0", exposing VLAN ID 5 and setting an IPv4 address of
+ "192.168.5.10" mask "24", plus an IPv6 address of "a:b:c:d::1" prefix "64"
+ for the interface.
+
+
+General Caveats
+---------------
+
+ The network interface definitions are stored in variable arrays. The bash shell has no facilities to retrieve the largest array index used. There-
+ fore, the rc.inet1 script makes the assumption that array indexes stay below the value of 6. Effectively this means that you can configure up to 6
+ network interfaces in rc.inet1.conf by default.
+
+ If you want to configure more than six network interfaces, you will have to edit the file /etc/rc.d/rc.inet1.conf and change the value `6' in the
+ line:
+ #MAXNICS="6"
+ (at the very bottom of the file) to a value that is larger than the largest index value you use, and uncomment the line.
+
+ The /etc/rc.d/rc.wireless script is not meant to be run on its own by the user!
+
+
+rc.inet1 does not keep a record of how an interface was configured. If the
+interface config is changed in rc.inet1.conf from, say, DHCP to static IP,
+restarting networking may fail because the previous type of interface config
+cannot be stopped (because its type is unknown). In this instance, it is easier
+to reboot to start from fresh. However, if reboot is not possible, it may be
+required to bring the interface down manually (either by deconfiguring the IPs,
+or killing dhcpcd) before trying to restart the interface.
+
diff --git a/source/n/network-scripts/manpages/rc.inet1.8 b/source/n/network-scripts/manpages/rc.inet1.8
index 4102eec69..648e0166e 100644
--- a/source/n/network-scripts/manpages/rc.inet1.8
+++ b/source/n/network-scripts/manpages/rc.inet1.8
@@ -112,7 +112,7 @@ Eric Hameleers <alien@slackware.com>
.br
Robby Workman <rworkman@slackware.com>
.br
-Darren 'Tadgy' Austin <darren@afterdark.org.uk>
+Darren 'Tadgy' Austin <darren@slackware.uk>
.SH "SEE ALSO"
.BR rc.inet1.conf(5),
.BR ip(8),
diff --git a/source/n/network-scripts/manpages/rc.inet1.conf.5 b/source/n/network-scripts/manpages/rc.inet1.conf.5
index e966eb7e6..8152b3494 100644
--- a/source/n/network-scripts/manpages/rc.inet1.conf.5
+++ b/source/n/network-scripts/manpages/rc.inet1.conf.5
@@ -26,40 +26,45 @@ and so forth. The default interface name can be overruled by the use of
the parameter
.B IFNAME.
.LP
-This is what a typical section of the file looks like for an interface that is
-configured to use DHCP, showing all parameters with the index number `0':
+This is what a typical section of the file looks like for an interface,
+showing all parameters with the index number `0':
.LP
-# Config information for eth0:
.br
-IPADDR[0]=""
+# IPv4 config options for eth0:
+.br
+IPADDRS[0]=""
+.br
+USE_DHCP[0]=""
+.br
+# IPv6 config options for eth0:
+.br
+IP6ADDRS[0]=""
+.br
+USE_SLAAC[0]=""
.br
-NETMASK[0]=""
+USE_DHCP6[0]=""
.br
-IPALIASES[0]=""
+# Generic options for eth0:
.br
-USE_DHCP[0]="yes"
+DHCP_HOSTNAME[0]=""
.LP
-Alternatively, here is an example for an interface that uses a static
-IPv4 address, an autoconfigured IPv6 address, and a non-default name
+Alternatively, here is an example for an interface that uses static
+IPv4 addresses, an autoconfigured IPv6 address, and a non-default name
.RI ( ath0
instead of
-.IR eth1 ),
-as well as additional IPv4 alias addresses.
+.IR eth1 ).
The parameter index is `1' in this case.
.LP
-# Config information for ath0:
.br
IFNAME[1]="ath0"
.br
-IPADDR[1]="192.168.3.11"
-.br
-NETMASK[1]="24"
+# IPv4 config options for ath0:
.br
-IPALIASES[1]="192.168.3.100/24"
+IPADDRS[1]="192.168.1.10/24 10.0.0.10/8"
.br
USE_DHCP[1]=""
.br
-GATEWAY="192.168.3.1"
+# IPv6 config options for ath0
.br
IP6ADDRS[1]=""
.br
@@ -67,6 +72,15 @@ USE_SLAAC[1]="yes"
.br
USE_DHCP6[1]=""
.br
+# Generic options for ath0:
+.br
+DHCP_HOSTNAME[1]=""
+
+.br
+# Gateway IP addresses:
+.br
+GATEWAY="192.168.1.1"
+.br
GATEWAY6=""
.br
.SH EXAMPLE VIRTUAL INTERFACE CREATION AND SETUP
@@ -85,7 +99,7 @@ VIRTIFUSER[0]="root"
.br
VIRTIFGROUP[0]="root"
.br
-.SH EXAMPLE BRIDGE INTERFACE CREATION
+.SH EXAMPLE BONDING INTERFACE CREATION
Link aggregation (bond) interfaces can be configured with the use of 3 new
parameters for use in rc.inet1.conf. The BONDNICS parameter should contain
the (space delimited) list of interfaces to include in the bond. The type
@@ -114,9 +128,13 @@ BONDMODE[0]="balance-rr"
.br
IFOPTS[0]="xmit_hash_policy layer2+3 | miimon 100"
.br
-IPADDR[0]="192.168.0.10"
+IPADDRS[0]="192.168.0.10/24"
+.br
+IP6ADDRS[0]="e1ff:fec8:ae47:d9ab::abc1/64"
.br
-NETMASK[0]="24"
+GATEWAY="192.168.0.1"
+.br
+GATEWAY6="e1ff:fec8:ae47:d9ab::1"
.LP
.SH EXAMPLE VLAN INTERFACE CREATION
VLAN interfaces can be configured in rc.inet1.conf, in the standard Slackware
@@ -131,9 +149,7 @@ IFNAME[0]="eth0.100"
.br
IFOPTS[0]=""
.br
-IPADDR[0]="192.168.100.10"
-.br
-NETMASK[0]="24"
+IPADDRS[0]="192.168.100.10/24"
.LP
The IFNAME of the interface contains the underlying ethernet device name
(eth0), a period (.), and the VLAN ID to be exposed.
@@ -160,9 +176,7 @@ BRNICS[5]="eth0 eth1 tun0"
.br
IFOPTS[5]=""
.br
-IPADDR[5]="192.168.0.10"
-.br
-NETMASK[5]="24"
+IPADDRS[5]="192.168.0.10/24"
.LP
The new generic IFOPTS parameter takes a pipe (|) delimited list of interface
type specific options, but does not need any options in order for a bridge
@@ -178,24 +192,11 @@ the parameters all have the array index `0':
.LP
# Config information for eth0:
.TP 25
-IPADDR[0]=""
-# Set this parameter to an actual IPv4 address if you want static IPv4
-address assignment. This is ignored if the USE_DHCP[0] parameter is set
-to "yes".
-.TP
-NETMASK[0]=""
-# The netmask for the IPv4 address set in IPADDR[0]. This should be in
-CIDR format with an optional leading /, e.g. "24" or "/16" - though the
-traditional dotted-quad format (e.g. "255.255.255.0") is still accepted.
-If this parameter is unset or empty, a netmask of "24" will be assumed.
-.TP
-IPALIASES[0]=""
-# Space separated list of additional IPv4 addresses to bind to the
-interface after initial configuration is complete. An optional
-netmask may be specified after the address in the form "1.2.3.4/24". If no
-netmask is specified the default of "/24" will be used. If USE_DHCP[0]
-is set to `yes' then additional IPv4 addresses will only be added if the
-DHCP client invocation is successful in obtaining a primary IPv4 address.
+IPADDRS[0]=""
+# Set this parameter to a space delimited list of IPv4 addresses and netmasks
+to bind to the interface, The netmask should be in CIDR style separated from
+the IP address with a /. E.g. "192.168.1.10/24 10.0.0.10/8". If the netmask
+is not provided, "/24" is assumed.
.TP
USE_DHCP[0]=""
# If set to "yes", we will run a DHCP client and have the IPv4 address
@@ -213,8 +214,7 @@ IP6ADDRS[0]=""
IPv6 addresses and prefix lengths in CIDR notation, in a space delimited
list. For example: IP6ADDRS[0]="a:b:c:d::1/48 1:2:3:4::5/64".
If a prefix length is not given (separated from the IP address with a /), a
-length of 64 will be assumed. This is ignored if either the USE_DHCP6[0]
-or USE_SLAAC[0] parameters is set to "yes".
+length of 64 will be assumed.
.TP
USE_SLAAC[0]=""
# With this parameter set to "yes", the interface's IPv6 address will be
@@ -383,6 +383,6 @@ Eric Hameleers <alien@slackware.com>
.br
Robby Workman <rworkman@slackware.com>
.br
-Darren 'Tadgy' Austin <darren@afterdark.org.uk>
+Darren 'Tadgy' Austin <darren@slackware.uk>
.SH "SEE ALSO"
.BR rc.inet1(8)
diff --git a/source/n/network-scripts/modprobe.d/modprobe.d/bonding.conf b/source/n/network-scripts/modprobe.d/modprobe.d/bonding.conf
new file mode 100644
index 000000000..c33faf65b
--- /dev/null
+++ b/source/n/network-scripts/modprobe.d/modprobe.d/bonding.conf
@@ -0,0 +1,9 @@
+##############################################################################
+# Do not edit this file; instead, copy it to /etc/modprobe.d/ and edit that
+##############################################################################
+#
+# Disable the automatic creation of a bond0 interface when module is loaded
+# Otherwise, /etc/rc.d/rc.inet1 will not be able to configure it
+#
+options bonding max_bonds=0
+options rtnl-link-bond max_bonds=0
diff --git a/source/n/network-scripts/modprobe.d/modprobe.d/ipv6.conf b/source/n/network-scripts/modprobe.d/modprobe.d/ipv6.conf
new file mode 100644
index 000000000..a0395a5ad
--- /dev/null
+++ b/source/n/network-scripts/modprobe.d/modprobe.d/ipv6.conf
@@ -0,0 +1,8 @@
+##############################################################################
+# Do not edit this file; instead, copy it to /etc/modprobe.d/ and edit that
+##############################################################################
+#
+# Disable IPv6 auto configuration (SLAAC) by default
+#
+options ipv6 autoconf=0
+options net-pf-10 autoconf=0
diff --git a/source/n/network-scripts/network-scripts.SlackBuild b/source/n/network-scripts/network-scripts.SlackBuild
index dca8ce9c6..4832d4db2 100755
--- a/source/n/network-scripts/network-scripts.SlackBuild
+++ b/source/n/network-scripts/network-scripts.SlackBuild
@@ -25,7 +25,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=network-scripts
VERSION=${VERSION:-15.0}
ARCH=noarch
-BUILD=${BUILD:-12}
+BUILD=${BUILD:-13}
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
@@ -74,6 +74,12 @@ mkdir -p $PKG/lib/modprobe.d/
cat $CWD/modprobe.d/bonding.conf > $PKG/lib/modprobe.d/bonding.conf
cat $CWD/modprobe.d/ipv6.conf > $PKG/lib/modprobe.d/ipv6.conf
+# Drop the documentation in /usr/doc/network-scripts-$VERSION:
+mkdir -p $PKG/usr/doc/network-scripts-$VERSION
+cp -a $CWD/README* $PKG/usr/doc/network-scripts-$VERSION
+chown -R root:root $PKG/usr/doc/network-scripts-$VERSION
+chmod 644 $PKG/usr/doc/network-scripts-$VERSION/*
+
mkdir -p $PKG/install
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
diff --git a/source/n/network-scripts/scripts/netconfig b/source/n/network-scripts/scripts/netconfig
index f3e9742fa..69c6d6edf 100644
--- a/source/n/network-scripts/scripts/netconfig
+++ b/source/n/network-scripts/scripts/netconfig
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# A script to do basic network configuration.
# Mostly written by Patrick Volkerding <volkerdi@slackware.com>.
# Modified to use /etc/rc.d/rc.inet1.conf Tue Aug 26 16:51:48 PDT 2003 <pjv>
@@ -13,17 +13,13 @@ write_config_files() {
# If we're doing loopback, we don't want 127.0.0.1 and 255.255.255.0 in
# rc.inet1.conf... it's better to leave the values null. However, since
# we use the IP in other places, we need to make a copy for here.
-RCIPCOPY=$IPADDR
-RCMASKCOPY=$NETMASK
-RCIP6COPY=$IPADDR6
-RCPREFIXCOPY=$PREFIX6
-if [ "$RCIPCOPY" = "127.0.0.1" ]; then
- RCIPCOPY=""
- RCMASKCOPY=""
+RCIPCOPY=("${IPADDRS[@]}")
+RCIP6COPY=("${IP6ADDRS[@]}")
+if [ "${RCIPCOPY[0]}" = "127.0.0.1/8" ]; then
+ RCIPCOPY=()
fi
-if [ "$RCIP6COPY" = "::1" ]; then
- RCIP6COPY=""
- RCPREFIXCOPY=""
+if [ "${RCIP6COPY[0]}" = "::1/128" ]; then
+ RCIP6COPY=()
fi
# echo "Creating /$RC..."
@@ -47,56 +43,53 @@ fi
# =============================================================================
-# IPv4 config information for eth0:
ENDFILE
if [ -n "$VLAN" ]; then
+ VLAN=".$(( 10#$VLAN ))"
echo "IFNAME[0]=\"eth0$VLAN\"" >>$RC
fi
/bin/cat << ENDFILE >> $RC
-IPADDR[0]="$RCIPCOPY"
-NETMASK[0]="$RCMASKCOPY"
-IPALIASES[0]=""
+# IPv4 config options for eth0$VLAN:
+IPADDRS[0]="${RCIPCOPY[@]}"
USE_DHCP[0]="$USE_DHCP"
-DHCP_HOSTNAME[0]="$DHCP_HOSTNAME"
-# IPv6 config information for eth0:
-IP6ADDRS[0]="`if [ ! \"$RCIP6COPY\" = \"\" ]; then echo \"$RCIP6COPY/$RCPREFIXCOPY\"; fi`"
+# IPv6 config options for eth0$VLAN:
+IP6ADDRS[0]="${RCIP6COPY[@]}"
USE_SLAAC[0]="$USE_SLAAC"
USE_DHCP6[0]="$USE_DHCP6"
+# Generic options for eth0$VLAN:
+DHCP_HOSTNAME[0]="$DHCP_HOSTNAME"
-# IPv4 config information for eth1:
-IPADDR[1]=""
-NETMASK[1]=""
-IPALIASES[1]=""
+# IPv4 config options for eth1:
+IPADDRS[1]=""
USE_DHCP[1]=""
-DHCP_HOSTNAME[1]=""
-# IPv6 config information for eth1:
+# IPv6 config options for eth1:
IP6ADDRS[1]=""
USE_SLAAC[1]=""
USE_DHCP6[1]=""
+# Generic options for eth1:
+DHCP_HOSTNAME[1]=""
-# IPv4 config information for eth2:
-IPADDR[2]=""
-NETMASK[2]=""
-IPALIASES[2]=""
+# IPv4 config options for eth2:
+IPADDRS[2]=""
USE_DHCP[2]=""
-DHCP_HOSTNAME[2]=""
-# IPv6 config information for eth2:
+# IPv6 config options for eth2:
IP6ADDRS[2]=""
USE_SLAAC[2]=""
USE_DHCP6[2]=""
+# Generic options for eth2:
+DHCP_HOSTNAME[2]=""
-# IPv4 config information for eth3:
-IPADDR[3]=""
-NETMASK[3]=""
-IPALIASES[3]=""
+# IPv4 config options for eth3:
+IPADDRS[3]=""
USE_DHCP[3]=""
-DHCP_HOSTNAME[3]=""
-# IPv6 config information for eth3:
+# IPv6 config options for eth3:
IP6ADDRS[3]=""
USE_SLAAC[3]=""
USE_DHCP6[3]=""
+# Generic options for eth3:
+DHCP_HOSTNAME[3]=""
# IPv4 default gateway IP address:
GATEWAY="$GATEWAY"
@@ -105,7 +98,7 @@ GATEWAY6="$GATEWAY6"
# =============================================================================
-# Example of how to configure a bond (link aggrigation) interface.
+# Example of how to configure a bond (link aggregation) interface.
# Note the addition of the BONDNICS and BONDMODE parameters.
# BONDNICS is a space delimited list of interfaces to add to this bond. The
# BONDNICS interfaces will be brought up and configured while bringing up the
@@ -124,9 +117,7 @@ GATEWAY6="$GATEWAY6"
#BONDNICS[0]="eth0 eth1"
#BONDMODE[0]="balance-rr"
#IFOPTS[0]="xmit_hash_policy layer2+3 | miimon 100"
-#IPADDR[0]="192.168.0.1"
-#NETMASK[0]="24"
-#IPALIASES[0]=""
+#IPADDRS[0]="192.168.0.1/24"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""
#IP6ADDRS[0]=""
@@ -144,9 +135,7 @@ GATEWAY6="$GATEWAY6"
# for a standard VLAN to be configured.
#IFNAME[0]="eth0.10"
#IFOPTS[0]=""
-#IPADDR[0]="192.168.10.1"
-#NETMASK[0]="24"
-#IPALIASES[0]=""
+#IPADDRS[0]="192.168.10.1/24"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""
#IP6ADDRS[0]=""
@@ -165,9 +154,7 @@ GATEWAY6="$GATEWAY6"
#IFNAME[0]="br0"
#BRNICS[0]="eth0"
#IFOPTS[0]=""
-#IPADDR[0]="192.168.0.1"
-#NETMASK[0]="24"
-#IPALIASES[0]=""
+#IPADDRS[0]="192.168.0.1/24"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""
@@ -197,9 +184,7 @@ GATEWAY6="$GATEWAY6"
# Uncomment the lines you need and fill in your data. You may not need all of
# these for your wireless network.
#IFNAME[4]="wlan0"
-#IPADDR[4]=""
-#NETMASK[4]=""
-#USE_DHCP[4]="yes"
+#IPADDRS[4]=""
#DHCP_HOSTNAME[4]="icculus-wireless"
#DHCP_KEEPRESOLV[4]="yes"
#DHCP_KEEPNTP[4]="yes"
@@ -215,21 +200,21 @@ GATEWAY6="$GATEWAY6"
#WLAN_WPADRIVER[4]="wext"
#WLAN_WPAWAIT[4]=30
-
# =============================================================================
# Some examples of additional network parameters that you can use.
#IFNAME[4]="wlan0" # Use a different interface name instead of
# the default 'eth4'
-#IPALIASES[4]="192.168.5.10/24" # A space delimited list of CIDR formatted IP
- # aliases to assign to the interface after it
- # has come up. If no /<prefix> is given after
- # the IP address, /24 will be used as default.
+#IFOPTS[4]="" # A pipe (|) delimited list of interface type
+ # specific options to apply. These options
+ # can be found in the ip-link(8) man page in
+ # the approprite section for the interface
+ # type being configured.
#HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address
#MTU[4]="" # The default MTU is 1500, but you might need
# 1360 when you use NAT'ed IPSec traffic.
#PROMISCUOUS[4]="yes" # Set promiscuous mode on the interface.
-#DHCP_TIMEOUT[4]=15 # The default timeout for the DHCP client to
+#DHCP_TIMEOUT[4]="15" # The default timeout for the DHCP client to
# wait for server resonse is 15 seconds, but
# you might want a shorter or longer wait.
#DHCP_KEEPRESOLV[4]="yes" # If you don't want /etc/resolv.conf overwritten
@@ -248,7 +233,7 @@ GATEWAY6="$GATEWAY6"
# Increase the timeout if required.
#USE_RA[4]="yes" # Accept router advertisements even when SLAAC
# is disabled on the interface.
-#WLAN_ESSID[4]=DARKSTAR # An example of how you can override _any_
+#WLAN_ESSID[4]="DARKSTAR" # An example of how you can override _any_
# parameter defined in rc.wireless.conf, by
# prepending 'WLAN_' to the parameter's name.
# Useful with multiple wireless interfaces.
@@ -262,19 +247,20 @@ GATEWAY6="$GATEWAY6"
#WLAN_WPADRIVER[4]="ndiswrapper"# Tell wpa_supplicant to specifically use the
# ndiswrapper driver (if you leave this empty
# the 'wext' driver is used by default)
-#WLAN_WPAWAIT[4]=30 # In case it takes long for the WPA association
+#WLAN_WPAWAIT[4]="30" # In case it takes long for the WPA association
# to finish, you can increase the wait time
# (defaults to 10 seconds)
# =============================================================================
-# Change this to "yes" for debugging output to stdout.
+# Change this to "yes" for debugging output to syslog (if available, stdout if
+# not).
DEBUG_ETH_UP="no"
# MAXNICS is the maximum number of interfaces that will be configured.
# You may need to increase the MAXNICS value if you have many interfaces, or
# you use multiple VLANs and/or bridges. The default is 6.
-# MAXNICS="6"
+#MAXNICS="6"
ENDFILE
#
############################################################################
@@ -310,17 +296,13 @@ chmod 644 $ETCNETWORKS
# "named" name server. Just add the names, addresses
# and any aliases to this file...
#
-# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
-# should NEVER be named with the name of the machine. It causes problems
-# for some (stupid) programs, irc and reputedly talk. :^)
-#
# For loopbacking.
127.0.0.1 localhost
::1 localhost
EOF
-[ -n "$IPADDR" ] && echo -e "$IPADDR\t\t$HOSTNM.$DOMAIN $HOSTNM" >>$HOSTS
-[ -n "$IPADDR6" ] && echo -e "$IPADDR6\t\t$HOSTNM.$DOMAIN $HOSTNM" >>$HOSTS
+[ -n "${IPADDRS[0]}" ] && echo -e "${IPADDRS[0]%%/*}\t\t$HOSTNM.$DOMAIN $HOSTNM" >>$HOSTS
+[ -n "${IP6ADDRS[0]}" ] && echo -e "${IP6ADDRS[0]%%/*}\t\t\t$HOSTNM.$DOMAIN $HOSTNM" >>$HOSTS
chmod 644 $HOSTS
#
############################################################################
@@ -356,17 +338,19 @@ fi
rm -f $TMP/tempmsg /cardfound
} # end write_config_files
-TMP=/var/log/setup/tmp
-if [ ! -d $TMP ]; then
- mkdir -p $TMP
- chmod 700 $TMP
-fi
+# Covert CIDR notation masks to old style dotted quad.
+cidr2mask() {
+ # https://forum.archive.openwrt.org/viewtopic.php?id=47986&p=1#p220781
+ set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+ [ $1 -gt 1 ] && shift $1 || shift
+ echo "${1-0}.${2-0}.${3-0}.${4-0}"
+}
-# This checks IP address syntax.
-# usage: syntax_check ADDRESS #-OF-EXPECTED-SEGMENTS (up to 4)
-# example: syntax_check 123.22.43.1 4
+# This checks IPv4 address syntax.
+# usage: syntax_check_v4 ADDRESS #-OF-EXPECTED-SEGMENTS (up to 4)
+# example: syntax_check_v4 123.22.43.1 4
# returns: 0=found correct 1=too many fields 2=non numeric field found
-syntax_check_color() {
+syntax_check_v4() {
RET_CODE=0
SCRATCH=$1
SCRATCH=`echo $SCRATCH | tr "." "/"`
@@ -387,11 +371,17 @@ syntax_check_color() {
fi
if [ "$3" = "WARN" -a ! "$RET_CODE" = "0" ]; then
cat << EOF > $TMP/tempmsg
-The value you have entered seems to be non-standard. We were
-expecting $2 groups of numbers seperated by dots, like: 127.0.0.1
-Please enter a valid value.
+The IP address you entered:
+ $1
+is not valid.
+
+There should be $2 groups of numbers seperated by dots, for example:
+ 192.168.1.1
+
+Please correct any mistakes in the IP.
EOF
- dialog --title "INVALID VALUE" --defaultno --msgbox "`cat $TMP/tempmsg`" 7 72
+ dialog --title "INVALID IP" --ok-button "Back" --msgbox \
+ "`cat $TMP/tempmsg`" 12 72
rm -r $TMP/tempmsg
else
if [ "$3" = "ECHO" ]; then
@@ -401,6 +391,29 @@ EOF
return $RET_CODE;
}
+# This does cursary checks to validate an IPv6 address.
+syntax_check_v6() {
+ # We can only do a basic validation of the entered address
+ # as regexes for IPv6 addresses are very complex.
+ if [[ "$1" =~ ^[0-9a-fA-F:]+$ ]] && [[ "$1" =~ :[0-9a-fA-F]{1,4}$ ]]; then
+ return 0
+ else
+ dialog --title "INVALID IP" --ok-button "Back" --msgbox \
+"The IP address you entered:
+ $1
+is not valid.
+
+Please enter a valid IPv6 address." 9 72
+ fi
+ return 1
+}
+
+TMP=/var/log/setup/tmp
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+ chmod 700 $TMP
+fi
+
# Figure out where we are... cheap hack.
if [ ! -e etc/slackware-version -a ! -e /etc/installer -a ! -e bin/bash ]; then
cd /
@@ -414,88 +427,116 @@ HOSTS=etc/hosts # Where hosts file is.
ETCNETWORKS=etc/networks # Where networks file is.
#
# defaults:
+IPADDRS=()
+IP6ADDRS=()
USE_DHCP="" # Use DHCP? "" == no.
USE_DHCP6=""
DHCP_HOSTNAME="" # This is our DHCP hostname.
NETWORK=127.0.0.0
-IPADDR=127.0.0.1
-NETMASK=24 # Use CIDR now.
-IPADDR6=::1
-PREFIX6=64
-# Main loop:
while [ 0 ]; do
-cat << EOF > $TMP/tempmsg
+ cat << EOF > $TMP/tempmsg
First, we'll need the name you'd like to give your host.
-Only the base hostname is needed right now. (not the domain)
+Only the base hostname is needed right now - not the domain.
+For example: darkstar
Enter hostname:
EOF
- dialog --title "ENTER HOSTNAME" --inputbox "`cat $TMP/tempmsg`" 11 65 \
- $HOSTNM 2> $TMP/SeThost
- if [ $? = 1 -o $? = 255 ]; then
+ dialog --title "ENTER HOSTNAME" --cancel-label "Exit" --inputbox \
+ "`cat $TMP/tempmsg`" 12 64 "$HOSTNM" 2> $TMP/SeThost
+ if [ $? = 1 -o $? = 255 ]; then
+ rm -f $TMP/SeThost $TMP/tempmsg
+ exit
+ fi
+ HOSTNM="`cat $TMP/SeThost`"
rm -f $TMP/SeThost $TMP/tempmsg
- exit
- fi
- HOSTNM="`cat $TMP/SeThost`"
- rm -f $TMP/SeThost $TMP/tempmsg
- if [ ! "$HOSTNM" = "" ]; then
- break;
- fi
+ if [ "$HOSTNM" = "" ] || [[ ! "$HOSTNM" =~ ^[[:alnum:]-]+$ ]] || \
+ [ "${HOSTNM:0:1}" == "-" ] || [ "${HOSTNM: -1:1}" == "-" ]; then
+ dialog --title "HOSTNAME" --ok-button "Back" --msgbox \
+ "That doesn't appear to be a valid hostname.\n
+Hostnames can only contain letters, numbers and hyphens,
+and may not begin or end with a hyphen." 7 60
+ if [ $? = 1 -o $? = 255 ]; then
+ exit
+ fi
+ else
+ break
+ fi
done
while [ 0 ]; do
-cat << EOF > $TMP/tempmsg
+ cat << EOF > $TMP/tempmsg
Now, we need the domain name for this machine, such as:
-
-example.org
-
+ example.org
Do not supply a leading '.'
-Enter domain name for $HOSTNM:
+Enter domain name for $HOSTNM:
EOF
- dialog --title "ENTER DOMAINNAME FOR '$HOSTNM'" --inputbox \
-"`cat $TMP/tempmsg`" \
-14 64 $DOMAIN 2> $TMP/SeTdom
- if [ $? = 1 -o $? = 255 ]; then
+ dialog --title "ENTER DOMAINNAME FOR '$HOSTNM'" --cancel-label "Exit" \
+ --inputbox "`cat $TMP/tempmsg`" 12 59 "$DOMAIN" 2> $TMP/SeTdom
+ if [ $? = 1 -o $? = 255 ]; then
+ rm -f $TMP/SeTdom $TMP/tempmsg
+ exit
+ fi
+ DOMAIN="`cat $TMP/SeTdom`"
rm -f $TMP/SeTdom $TMP/tempmsg
- exit
- fi
- DOMAIN="`cat $TMP/SeTdom`"
- rm -f $TMP/SeTdom $TMP/tempmsg
- if [ ! "$DOMAIN" = "" ]; then
- break;
- fi
+ # These regexes doon't catch everything, just basic syntax mistakes.
+ if [ "$DOMAIN" = "" ] || [[ ! "$DOMAIN" =~ ^([[:alnum:]]+[-.]*[[:alnum:]]+)+$ ]] || \
+ [[ "${DOMAIN:0:1}" =~ ^[.-]$ ]] || [[ "${DOMAIN: -1:1}" == ^[.-]$ ]]; then
+ dialog --title "DOMAINNAME" --ok-button "Back" --msgbox \
+ "That doesn't appear to be a valid domain name.\n
+Domain names can only contain letters and numbers, hyphens
+and dots, and may not begin or end with a hyphen or dot." 7 68
+ if [ $? = 1 -o $? = 255 ]; then
+ exit
+ fi
+ else
+ break
+ fi
done
-# Write the hostname with domain to /etc/HOSTNAME:
-echo $HOSTNM.$DOMAIN > etc/HOSTNAME
-
dialog --title "CONNECT VIA VLAN" --defaultno --yesno \
"Some advanced networking set ups require a VLAN ID in order to \
-connect to the network. Do you wish to configure a VLAN now? \n\n\
-Unless you are sure you require a VLAN, select 'No'." 8 68
-if [ $? = 0 ]; then
+connect to the network. Do you wish to configure a VLAN ID now?\n\n\
+Unless you are sure you require a VLAN ID, select 'No'." 8 68
+ERRNO="$?"
+if [ "$ERRNO" = "255" ]; then
+ exit
+elif [ "$ERRNO" = "1" ]; then
+ true
+else
while true; do
+ [ -r $TMP/SeTVLAN ] && VLAN="$(cat $TMP/SeTVLAN)"
dialog --title "VLAN ID" --cancel-label "Skip" --inputbox \
- "Enter the VLAN ID used on this network." 8 45 2>$TMP/reply
- if [ $? = 0 ]; then
- if ! (($(cat $TMP/reply))) 2>/dev/null; then
+ "Enter the VLAN ID used on this network:" 8 45 "$VLAN" 2>$TMP/reply
+ ERRNO="$?"
+ if [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTVLAN
+ exit
+ elif [ "$ERRNO" = "1" ]; then
+ unset VLAN
+ rm -f $TMP/SeTVLAN
+ break
+ else
+ VLAN="$(cat $TMP/reply)"
+ echo "$VLAN" >$TMP/SeTVLAN
+ if [[ ! "$VLAN" =~ ^[0-9]+$ ]]; then
dialog --title "VLAN ID" --ok-button "Back" --msgbox \
- "That doesn't appear to be a valid VLAN ID." 5 46
+ "That doesn't appear to be a valid VLAN ID." 5 46
+ if [ "$?" = "255" ]; then
+ exit
+ fi
continue
else
- VLAN=".`cat $TMP/reply`"
+ rm -f $TMP/SeTVLAN
break
fi
- else
- break
fi
done
fi
dialog --title "CONFIGURATION TYPE FOR '$HOSTNM.$DOMAIN'" \
---default-item NetworkManager \
+--default-item NetworkManager --cancel-button "Exit" \
--menu \
"Now we need to know how your machine connects to the network.\n\
If you have an internal network card and an assigned IP address, gateway, \
@@ -521,7 +562,8 @@ REPLY=`cat $TMP/reply`
rm -f $TMP/reply
if [ "$REPLY" = "DHCP" ]; then
- dialog --title "SELECT DHCP TYPE" --default-item "DHCPv4" --menu \
+ dialog --title "SELECT DHCP TYPE" --default-item "DHCPv4" \
+ --cancel-button "Exit" --menu \
"Please select the type of DHCP to use to configure your networking.
Select 'DHCPv4' to configure for an IPv4 network (this is the most
common type of network, and the safe choice). Select 'DHCPv6' for a
@@ -542,16 +584,22 @@ pure IPv6 network, or 'Both' to try and set up both types of network." 13 73 3 \
USE_DHCP="yes"
USE_DHCP6="yes"
fi
- dialog --title "SET DHCP HOSTNAME" --inputbox "Some network providers require \
+ dialog --title "SET DHCP HOSTNAME" --cancel-label "Skip" \
+ --inputbox "Some network providers require \
that the DHCP hostname be set in order to connect. If so, they'll have assigned \
a hostname to your machine, which may look something like CC-NUMBER-A (this \
depends on your ISP). If you were assigned a DHCP hostname, please enter it \
-below. If you do not have a DHCP hostname, just hit ENTER or Cancel." 13 62 \
-2> $TMP/SeTDHCPHOST
- NEW_DHCPHOST="`cat $TMP/SeTDHCPHOST`"
+below. If you do not have a DHCP hostname, just leave it blank or select 'Skip'." 13 67 \
+ 2> $TMP/SeTDHCPHOST
+ ERRNO="$?"
+ if [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTDHCPHOST
+ exit
+ elif [ "$ERRNO" = "0" ]; then
+ # OK, if we actually got something, use it.
+ DHCP_HOSTNAME="$(cat $TMP/SeTDHCPHOST)"
+ fi
rm -f $TMP/SeTDHCPHOST
- # OK, if we actually got something, use it.
- DHCP_HOSTNAME="$NEW_DHCPHOST"
elif [ "$REPLY" = "loopback" ]; then
LOOPBACK="yes"
elif [ "$REPLY" = "NetworkManager" ]; then
@@ -567,204 +615,215 @@ fi
if [ "$LOOPBACK" = "no" -a ! "$USE_DHCP" = "yes" -a ! "$USE_SLAAC" = "yes" ]; then
while [ 0 ]; do
while [ 0 ]; do
- if [ -r $TMP/SeTIP ]; then
- IPADDR=`cat $TMP/SeTIP`
- fi
- dialog --title "ENTER IPv4 ADDRESS FOR '$HOSTNM.$DOMAIN'" --inputbox \
-"Enter the IPv4 address for the local machine. Example: 111.112.113.114
-If you do not want to configure a static IPv4 address, just hit ENTER. " \
- 9 75 $IPADDR 2> $TMP/SeTlip
- if [ $? = 1 -o $? = 255 ]; then
- rm -f $TMP/SeTlip
- exit
+ if [ -r $TMP/SeTIPSv4 ]; then
+ IPADDRS=($(cat $TMP/SeTIPSv4))
fi
- IPADDR="`cat $TMP/SeTlip`"
- rm -f $TMP/SeTlip
- if [ "$IPADDR" = "" ]; then
+ dialog --title "ENTER IPv4 ADDRESSES" --cancel-label "Skip" \
+ --colors --inputbox \
+"Enter the \Z1IPv4\Zn addresses for this host. You may list one or more,
+space delimited, IPv4 addresses with netmasks in the format:
+ <IP address>/<CIDR netmask>
+For example:
+ 111.112.113.114/24 or 111.112.113.114/24 10.0.1.114/8
+Old style netmask 255.255.255.0 is equilivant of 24 in CIDR style.
+If a netmask is not specified a default of 24 will be used.
+
+The first address entered will become the primary IPv4 address
+of this host. If you do not want to configure a static IPv4
+address, just leave it blank or select 'Skip'." \
+ 18 71 "${IPADDRS[*]}" 2> $TMP/SeTIPSv4
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ IPADDRS=()
+ rm -f $TMP/SeTIPSv4
break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTIPSv4
+ exit
fi
- syntax_check_color $IPADDR 4 WARN
- if [ $? = 0 ]; then
- echo $IPADDR > $TMP/SeTIP
+ IPADDRS=($(cat $TMP/SeTIPSv4))
+ rm -f $TMP/SeTIPSv4
+ if [ "${IPADDRS[*]}" = "" ]; then
break
fi
- done
-
- if [ ! "$IPADDR" = "" ]; then
- while [ 0 ]; do
- if [ -r $TMP/SeTnetmask ]; then
- NETMASK=`cat $TMP/SeTnetmask`
- fi
- dialog --title "ENTER NETMASK FOR IPv4 NETWORK" --inputbox \
-"Enter the netmask for your IPv4 network.
-This will generally be a single number (eg, 24)
-or look something like this: 255.255.255.0." 10 55 $NETMASK 2> $TMP/SeTnmask
- if [ $? = 1 -o $? = 255 ]; then
- rm -f $TMP/SeTnmask
- exit
+ for ((I=0; I < ${#IPADDRS[@]}; I++)); do
+ IP="${IPADDRS[$I]%/*}"
+ MASK="${IPADDRS[$I]#*/}"
+ if [ "$IP" = "" ]; then
+ dialog --title "NO IPv4 ADDRESSES" --ok-button "Back" --msgbox \
+ "No IP specified in entry: ${IPADDRS[$I]}." 5 55
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv4
+ exit
+ fi
+ continue 2
fi
- NETMASK="`cat $TMP/SeTnmask`"
- rm -f $TMP/SeTnmask
- if [ "$NETMASK" = "" ]; then
- dialog --title "NETMASK REQUIRED" --msgbox \
-"You have configured this host with a v4
-IP address - a netmask is required." 6 43
- continue
+ syntax_check_v4 "$IP" 4 WARN || continue 2
+ if [ "$MASK" = "" ] || [ "$IP" = "$MASK" ]; then
+ IPADDRS[$I]="$IP/24"
+ MASK="24"
fi
- if (($NETMASK == 0)) 2>/dev/null || (($NETMASK > 32)) 2>/dev/null; then
- dialog --title "NETMASK INVALID" --msgbox \
-"The netmask you entered is not valid.
-Valid netmasks will be in the range 1-32." 6 45
- continue
- elif (($NETMASK)) 2>/dev/null; then
- echo $NETMASK > $TMP/SeTnetmask
- break
- else
- syntax_check_color $NETMASK 4 WARN
- if [ $? = 0 ]; then
- echo $NETMASK > $TMP/SeTnetmask
- break
+ if [[ ! "$MASK" =~ ^[0-9]+$ ]] || (($MASK <= 0)) || (($MASK > 32)); then
+ dialog --title "INVALID NETMASK" --msgbox \
+"Invalid netmask specified for entry: ${IPADDRS[$I]}.
+Valid netmasks will be in the range 1-32." 6 65
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv4
+ exit
fi
+ echo "${IPADDRS[@]}" >$TMP/SeTIPSv4
+ continue 2
fi
done
+ rm -f $TMP/SeTIPSv4
+ break
+ done
+
+ if [ ! "${IPADDRS[*]}" = "" ]; then
while [ 0 ]; do
- if [ -r $TMP/SeTgateway ]; then
- GATEWAY=`cat $TMP/SeTgateway`
+ if [ -r $TMP/SeTgateway4 ]; then
+ GATEWAY="`cat $TMP/SeTgateway4`"
fi
- dialog --title "ENTER IPv4 GATEWAY ADDRESS" --inputbox \
+ dialog --title "ENTER IPv4 GATEWAY ADDRESS" --cancel-label "Skip" --inputbox \
"Enter the address for the IPv4 gateway on your network, such as:
- `echo $IPADDR | cut -f 1-3 -d .`.1
+ `echo ${IPADDRS[0]} | cut -f 1-3 -d .`.1
-If you don't have an IPv4 gateway on your network just hit ENTER
-without entering a gateway IP address.
+If you don't have an IPv4 gateway on your network, leave it blank
+or select 'Skip'.
-Enter IPv4 gateway address (aaa.bbb.ccc.ddd):" 14 68 $GATEWAY 2> $TMP/SeTgate
- if [ $? = 1 -o $? = 255 ]; then
- rm -f $TMP/SeTgate
+Enter IPv4 gateway address:" 14 69 "$GATEWAY" 2> $TMP/SeTgateway4
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ GATEWAY=""
+ rm -f $TMP/SeTgateway4
+ break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTgateway4
exit
fi
- GATEWAY="`cat $TMP/SeTgate`"
- rm -f $TMP/SeTgate
+ GATEWAY="`cat $TMP/SeTgateway4`"
+ rm -f $TMP/SeTgateway4
if [ "$GATEWAY" = "" ]; then
- echo > $TMP/SeTgateway
break
fi
- syntax_check_color $GATEWAY 4 WARN
+ syntax_check_v4 "$GATEWAY" 4 WARN
if [ $? = 0 ]; then
- echo $GATEWAY > $TMP/SeTgateway
break
fi
done
+ rm -f $TMP/SeTgateway4
fi
while [ 0 ]; do
- if [ -r $TMP/SeTIP6 ]; then
- IPADDR6=`cat $TMP/SeTIP6`
+ if [ -r $TMP/SeTIPSv6 ]; then
+ IP6ADDRS=($(cat $TMP/SeTIPSv6))
fi
- dialog --title "ENTER IPv6 ADDRESS FOR '$HOSTNM.$DOMAIN'" --inputbox \
-"Enter the IPv6 address for the local machine.
-Example: fe80:426c:ffff::365a
-If you do not want to configure a static IPv6 address, just hit ENTER." \
- 10 74 $IPADDR6 2> $TMP/SeTlip6
- if [ $? = 1 -o $? = 255 ]; then
- rm -f $TMP/SeTlip6
+ dialog --title "ENTER IPv6 ADDRESSES" --cancel-label "Skip" \
+ --colors --inputbox \
+"Enter the \Z1IPv6\Zn addresses for this host. You may list one or more,
+space delimited, IPv6 addresses with their prefixes in the format:
+ <IP address>/<prefix>
+For example:
+ 1a:1b:1c:1d::abc/64 or 1a:1b:1c:1d::abc/64 2b2c::2:3:4:abc/64
+If a prefix is not specified a default of 64 will be used.
+
+If you do not want to configure a static IPv6 address or don't
+know what to put, just leave it blank or select 'Skip'." \
+ 16 70 "${IP6ADDRS[*]}" 2> $TMP/SeTIPSv6
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ IP6ADDRS=()
+ rm -f $TMP/SeTIPSv6
+ break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTIPSv6
exit
fi
- IPADDR6="`cat $TMP/SeTlip6`"
- rm -f $TMP/SeTlip6
- if [ "$IPADDR6" = "" ]; then
- if [ "$IPADDR" = "" ]; then
- dialog --title "NO IP ADDRESSES" --yesno \
-"You have not configured any IP addresses for your system.
-Are you sure you want to proceed with no IPs?" 6 61
- if [ $? = 0 ]; then
- break 2
- else
- continue 2
- fi
- fi
- else
- # We can only do a basic validation of the entered address
- # as regexes for IPv6 addresses are very complex.
- if echo "$IPADDR6" | grep -E "^[0-9a-fA-F:]+$" >/dev/null; then
- echo $IPADDR6 > $TMP/SeTIP6
- break
- else
- dialog --title "INVALID IP ADDRESS" --msgbox \
-"The IP address you entered is not valid.
-Please enter a valid IPv6 address." 6 44
- continue
- fi
+ IP6ADDRS=($(cat $TMP/SeTIPSv6))
+ rm -f $TMP/SeTIPSv6
+ if [ "${IP6ADDRS[*]}" = "" ]; then
+ break
fi
- done
-
- if [ ! "$IPADDR6" = "" ]; then
- while [ 0 ]; do
- if [ -r $TMP/SeTprefix6 ]; then
- PREFIX6=`cat $TMP/SeTprefix6`
+ for ((I=0; I < ${#IP6ADDRS[@]}; I++)); do
+ IP="${IP6ADDRS[$I]%/*}"
+ PREFIX="${IP6ADDRS[$I]#*/}"
+ if [ "$IP" = "" ]; then
+ dialog --title "NO IPv6 ADDRESSES" --ok-button "Back" --msgbox \
+ "No IP specified in entry: ${IP6ADDRS[$I]}." 5 60
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv6
+ exit
+ fi
+ continue 2
fi
- dialog --title "ENTER IPv6 PREFIX FOR LOCAL NETWORK" --inputbox \
-"Enter your IPv6 prefix length.
-This will be a single number (eg, 64)" 9 55 $PREFIX6 2> $TMP/SeTprefix6
- if [ $? = 1 -o $? = 255 ]; then
- rm -f $TMP/SeTprefix6
- exit
+ syntax_check_v6 "$IP" || continue 2
+ if [ "$PREFIX" = "" ] || [ "$IP" == "$PREFIX" ]; then
+ IP6ADDRS[$I]="$IP/64"
+ PREFIX="64"
fi
- PREFIX6="`cat $TMP/SeTprefix6`"
- if [ "$PREFIX6" = "" ]; then
- dialog --title "PREFIX REQUIRED" --msgbox \
-"You have configured this host with a v6
-IP address - a prefix is required." 6 43
- continue
- elif (($PREFIX6 == 0)) 2>/dev/null || (($PREFIX6 > 128)) 2>/dev/null || \
- ! (($PREFIX6)) 2>/dev/null; then
- dialog --title "PREFIX INVALID" --msgbox \
-"The prefix you entered is not valid.
-Valid prefixes will be in the range 1-128." \
-6 46
- continue
- else
- echo $PREFIX6 >$TMP/SeTprefix6
- break
+ if [[ ! "$PREFIX" =~ ^[0-9]+$ ]] || (($PREFIX <= 0)) || (($PREFIX > 128)); then
+ dialog --title "INVALID PREFIX" --msgbox \
+"Invalid prefix specified for entry: ${IP6ADDRS[$I]}.
+Valid prefixes will be in the range 1-128." 6 70
+ if [ "$?" = "255" ]; then
+ rm -f $TMP/SeTIPSv6
+ exit
+ fi
+ echo "${IP6ADDRS[@]}" >$TMP/SeTIPSv6
+ continue 2
fi
done
+ rm -f $TMP/SeTIPSv6
+ break
+ done
+ if [ ! "${IP6ADDRS[*]}" = "" ]; then
while [ 0 ]; do
if [ -r $TMP/SeTgateway6 ]; then
- GATEWAY6=`cat $TMP/SeTgateway6`
+ GATEWAY6="`cat $TMP/SeTgateway6`"
fi
- dialog --title "ENTER IPv6 GATEWAY ADDRESS" --inputbox \
+ dialog --title "ENTER IPv6 GATEWAY ADDRESS" --cancel-label "Skip" --inputbox \
"Enter the address for the IPv6 gateway on your network, such as:
fe80:426c:ffff::1
-If you don't have an IPv6 gateway on your network just hit ENTER
-without entering a gateway IP address.
+If you don't have an IPv6 gateway on your network, leave it blank
+or select 'Skip'.
-Enter IPv6 gateway address:" 14 68 $GATEWAY6 2> $TMP/SeTgate6
- if [ $? = 1 -o $? = 255 ]; then
- rm -f $TMP/SeTgate6
+Enter IPv6 gateway address:" 14 69 "$GATEWAY6" 2> $TMP/SeTgateway6
+ ERRNO="$?"
+ if [ "$ERRNO" = "1" ]; then
+ GATEWAY6=""
+ rm -f $TMP/SeTgateway6
+ break
+ elif [ "$ERRNO" = "255" ]; then
+ rm -f $TMP/SeTgateway6
exit
fi
- GATEWAY6="`cat $TMP/SeTgate6`"
- rm -f $TMP/6SeTgate6
+ GATEWAY6="`cat $TMP/SeTgateway6`"
+ rm -f $TMP/SeTgateway6
if [ "$GATEWAY6" = "" ]; then
- echo > $TMP/SeTgateway6
- break 2
+ break
fi
- # We can only do a basic validation of the entered address
- # as regexes for IPv6 addresses are very complex.
- if echo "$GATEWAY6" | grep -E "^[0-9a-fA-F:]+$" >/dev/null; then
- echo $GATEWAY6 > $TMP/SeTgateway6
- break 2
- else
- dialog --title "INVALID IP ADDRESS" --msgbox \
-"The IP address you entered is not valid.
-Please enter a valid IPv6 address." 6 44
- continue
+ syntax_check_v6 "$GATEWAY6"
+ if [ $? = 0 ]; then
+ break
fi
- echo $GATEWAY6 > $TMP/SeTgateway6
done
+ rm -f $TMP/SeTgateway6
fi
+
+ if [ "${IPADDRS[*]}" = "" ] && [ "${IP6ADDRS[*]}" = "" ]; then
+ dialog --title "NO IP ADDRESSES" --colors --defaultno --yesno \
+"\Z1You have not configured any IP addresses for this host.
+Are you sure you want to proceed with no IPs?\Zn" 6 59
+ ERRNO="$?"
+ if [ "$ERRNO" = "255" ]; then
+ exit
+ elif [ "$ERRNO" = "1" ]; then
+ continue
+ fi
+ fi
+ break
done
fi
@@ -772,45 +831,74 @@ if [ "$LOOPBACK" = "no" ]; then
dialog --title "USE A NAMESERVER?" --yesno "Do you wish to configure \
a nameserver?" 5 42
if [ $? = 0 ]; then
- if [ ! "$IPADDR" = "" ]; then
+ if [ ! "${IPADDRS[*]}" = "" ]; then
if [ ! "$GATEWAY" = "" ]; then
DNSSAMPLE="$GATEWAY"
DNSDEFAULT="$GATEWAY"
else
- DNSSAMPLE="`echo $IPADDR | cut -f 1-3 -d .`.1"
+ DNSSAMPLE="`echo ${IPADDRS[0]} | cut -f 1-3 -d .`.1"
+ DNSDEFAULT="${DNSSAMPLE%.1}."
fi
fi
- if [ ! "$IPADDR6" = "" ]; then
+ if [ ! "${IP6ADDRS[*]}" = "" ]; then
if [ ! "$GATEWAY6" = "" ]; then
- DNSSAMPLE="$DNSSAMPLE or $GATEWAY6"
+ DNSSAMPLE="${DNSSAMPLE:+$DNSSAMPLE or }$GATEWAY6"
# Keep the v4 nameserver the default, for now.
- # DNSDEFAULT="$GATEWAY6"
+ DNSDEFAULT="${DNSDEFAULT:-$GATEWAY6}"
else
- DNSSAMPLE="or fe80:426c:ffff::1"
+ DNSSAMPLE="${DNSSAMPLE:+$DNSSAMPLE or }${IP6ADDRS[0]%:*}:1"
+ DNSDEFAULT="${DNSSAMPLE:-${IP6ADDRS[0]%:*}}:"
fi
fi
while [ "$NAMESERVER" = "" ]; do
- dialog --title "ENTER NAMESERVER IP ADDRESS" --inputbox \
+ dialog --title "ENTER NAMESERVER IP ADDRESS" --cancel-label "Skip" \
+ --inputbox \
"Please give the IP address of the name server to use, such as
- $DNSSAMPLE
+ ${DNSSAMPLE:-1:2:3:4::1}
You can add more Domain Name Servers later by editing
/$RESOLV.
-Primary name server to use:" 13 65 $DNSDEFAULT 2> $TMP/SeTns
- if [ $? = 1 -o $? = 255 ]; then
- rm -f $TMP/SeTns
- break
+Primary name server to use:" 13 65 "$DNSDEFAULT" 2> $TMP/SeTns
+ ERRNO="$?"
+ if [ $ERRNO = 255 ]; then
+ rm -f $TMP/SeTns
+ exit
+ elif [ $ERRNO = 1 ]; then
+ rm -f $TMP/SeTns
+ NAMESERVER=""
+ break
+ else
+ NAMESERVER="`cat $TMP/SeTns`"
+ rm -f $TMP/SeTns
+ if [[ "$NAMESERVER" =~ ^.*:.*$ ]]; then
+ syntax_check_v6 "$NAMESERVER"
+ if [ ! $? = 0 ]; then
+ DNSDEFAULT="$NAMESERVER"
+ NAMESERVER=""
+ continue
+ fi
+ else
+ syntax_check_v4 "$NAMESERVER" 4 WARN
+ if [ ! $? = 0 ]; then
+ DNSDEFAULT="$NAMESERVER"
+ NAMESERVER=""
+ continue
+ fi
+ fi
+ break
fi
- NAMESERVER="`cat $TMP/SeTns`"
- rm -f $TMP/SeTns
done
fi
+elif [ "$LOOPBACK" = "yes" ]; then
+ IPADDRS=(127.0.0.1/8)
+ IP6ADDRS=(::1/128)
+ VLAN=""
fi
# Check for existing network driver:
unset DONOTPROBE
if cat /proc/net/dev | grep eth0 1> /dev/null 2> /dev/null ; then
- DONOTPROBE=true
+ DONOTPROBE=true
fi
# Really, this rc.netdevice thing is mostly obsolete except for
@@ -883,40 +971,53 @@ if [ "$LOOPBACK" = "yes" -a ! "$NETWORKMANAGER" = "yes" ]; then
dialog --title "NETWORK SETUP COMPLETE" --yesno "Your networking \
system is now configured to use loopback:
-IP address: 127.0.0.1
-Netmask: 255.255.255.0
+IP addresses: 127.0.0.1/8 ::1/128
-Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 10 70
+Is this correct? Press 'Yes' to continue, or 'No' to abandon." 9 70
RETVAL=$?
+ if [ "$RETVAL" = "255" ]; then
+ exit
+ fi
elif [ "$LOOPBACK" = "yes" -a "$NETWORKMANAGER" = "yes" ]; then
dialog --title "NETWORK SETUP COMPLETE" --yesno "Your networking \
system is now configured to use NetworkManager for
wired and wireless network management. To set up wireless networks
and view status, add the Network Management control panel widget to
-your KDE desktop.
+your desktop.
-Is this correct? Press 'Yes' to confirm, or 'No' to reconfigure." 10 71
+Is this correct? Press 'Yes' to confirm, or 'No' to abandon." 10 71
RETVAL=$?
+ if [ "$RETVAL" = "255" ]; then
+ exit
+ fi
elif [ "$USE_SLAAC" = "yes" ]; then
dialog --title "NETWORK SETUP COMPLETE" --yesno \
-"Your system is now set up to autoconfigure an IPv6 IP address.
-If this is correct, hit 'Yes' to confirm, or 'No' to cancel." 6 66
-RETVAL=$?
+"Your system is now set up to autoconfigure an IPv6 IP address:
+ Hostname: $HOSTNM
+ Domain name: $DOMAIN
+ VLAN ID: ${VLAN:-(none)}
+ IP addresses: (use IPv6 SLAAC)
+ Nameserver: ${NAMESERVER:-(none)}
+
+If this is correct, hit 'Yes' to confirm, or 'No' to abandon." 12 66
+ RETVAL=$?
+ if [ "$RETVAL" = "255" ]; then
+ exit
+ fi
elif [ "$USE_DHCP" = "" -a "$USE_DHCP6" = "" ]; then
while [ 0 ]; do
dialog --title "CONFIRM NETWORK SETUP" \
---ok-label Accept --extra-label Edit --cancel-label Restart --inputmenu \
+--ok-label Accept --extra-label Edit --cancel-label Abandon --inputmenu \
"These are the settings you have entered. To accept them and complete \
the networking setup, press ENTER. If you need to make any changes, you \
can do that now using 'Edit' (or reconfigure later using 'netconfig')." \
24 75 15 \
"Hostname:" "$HOSTNM" \
"Domain Name:" "$DOMAIN" \
-"IPv4 Address:" "$IPADDR" \
-"IPv4 Netmask:" "$NETMASK" \
+"VLAN ID:" "$VLAN" \
+"IPv4 Addresses:" "${IPADDRS[*]}" \
"IPv4 Gateway:" "$GATEWAY" \
-"IPv6 Address:" "$IPADDR6" \
-"IPv6 Prefix:" "$PREFIX6" \
+"IPv6 Addresses:" "${IP6ADDRS[*]}" \
"IPv6 Gateway:" "$GATEWAY6" \
"Nameserver:" "$NAMESERVER" 2> $TMP/tempmsg
RETVAL=$?
@@ -927,38 +1028,44 @@ can do that now using 'Edit' (or reconfigure later using 'netconfig')." \
HOSTNM=$NEWVAL
elif [ "$FIELD" = "Domain Name" ]; then
DOMAIN=$NEWVAL
- elif [ "$FIELD" = "IPv4 Address" ]; then
- IPADDR=$NEWVAL
- elif [ "$FIELD" = "IPv4 Netmask" ]; then
- NETMASK=$NEWVAL
+ elif [ "$FIELD" = "VLAN ID" ]; then
+ VLAN=$NEWVAL
+ elif [ "$FIELD" = "IPv4 Addresses" ]; then
+ IPADDRS=( $NEWVAL )
elif [ "$FIELD" = "IPv4 Gateway" ]; then
GATEWAY=$NEWVAL
- elif [ "$FIELD" = "IPv6 Address" ]; then
- IPADDR6=$NEWVAL
- elif [ "$FIELD" = "IPv6 Prefix" ]; then
- PREFIX6=$NEWVAL
+ elif [ "$FIELD" = "IPv6 Addresses" ]; then
+ IP6ADDRS=( $NEWVAL )
elif [ "$FIELD" = "IPv6 Gateway" ]; then
GATEWAY6=$NEWVAL
elif [ "$FIELD" = "Nameserver" ]; then
NAMESERVER=$NEWVAL
fi
+ elif [ "$RETVAL" = "255" ]; then
+ exit
else
break
fi
done
+ if [ ! "${IPADDRS[0]}" = "" ]; then
+ NM="$(cidr2mask "${IPADDRS[0]#*/}")"
+ BROADCAST="$(ipmask "$NM" "${IPADDRS[0]%/*}" | cut -f 1 -d ' ')"
+ NETWORK="$(ipmask "$NM" "${IPADDRS[0]%/*}" | cut -f 2 -d ' ')"
+ fi
else # DHCP was used
dialog --title "CONFIRM NETWORK SETUP" \
--yesno "Your networking system is now configured to use DHCP:
Hostname: $HOSTNM
Domain name: $DOMAIN
- DHCP hostname: $DHCP_HOSTNAME
+ VLAN ID: ${VLAN:-(none)}
+ DHCP hostname: ${DHCP_HOSTNAME:-(none)}
IP addresses: (use DHCP server)
Netmask & Prefix: (use DHCP server)
Gateways: (use DHCP server)
Nameserver: (use DHCP server)
-Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 15 76
+Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 16 76
RETVAL=$?
fi
@@ -973,13 +1080,9 @@ if [ "$RETVAL" = "0" ]; then
if [ "$NETWORKMANAGER" = "yes" -a -r etc/rc.d/rc.networkmanager ]; then
chmod 755 etc/rc.d/rc.networkmanager
fi
- if [ "$1" = "" ]; then
- dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40
- fi
+ dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40
else
- if [ "$1" = "" ]; then
- dialog --msgbox "Settings discarded. Run the 'netconfig' command again if you need to reconfigure your network settings." 6 60
- fi
+ dialog --msgbox "Settings discarded. Run the 'netconfig' command again if you need to reconfigure your network settings." 6 60
fi
exit $RETVAL
diff --git a/source/n/network-scripts/scripts/rc.inet1 b/source/n/network-scripts/scripts/rc.inet1
index f63f93ed7..755e7efec 100644
--- a/source/n/network-scripts/scripts/rc.inet1
+++ b/source/n/network-scripts/scripts/rc.inet1
@@ -47,7 +47,7 @@ i=0
while [ $i -lt $MAXNICS ];
do
IFNAME[$i]=${IFNAME[$i]:=eth${i}}
- i=$(($i+1))
+ i=$((i+1))
done
debug_log "List of interfaces: ${IFNAME[*]}"
@@ -130,7 +130,7 @@ virtif_create() {
done
}
-# Function to destory virtual interfaces
+# Function to destroy virtual interfaces
virtif_destroy() {
# argument is 'i' - the position of this interface in the VIRTIFNAME array.
for i in $(seq 0 $((${#VIRTIFNAME[@]} - 1))); do
@@ -159,7 +159,7 @@ br_open() {
debug_log "/sbin/ip link set dev ${IFNAME[$1]} type bridge $IFOPT"
/sbin/ip link set dev ${IFNAME[$1]} type bridge $IFOPT
fi
- done <<<"${IFOPTS[$i]}|" # The | on the end is required.
+ done <<<"${IFOPTS[$i]/%|*([[:blank:]])}|" # The | on the end is required.
debug_log "/sbin/ip link set dev ${IFNAME[$1]} up"
/sbin/ip link set dev ${IFNAME[$1]} up
}
@@ -206,7 +206,7 @@ bond_create() {
debug_log "/sbin/ip link set dev ${IFNAME[$1]} type bond $IFOPT"
/sbin/ip link set dev ${IFNAME[$1]} type bond $IFOPT
fi
- done <<<"${IFOPTS[$1]}|" # The | on the end is required.
+ done <<<"${IFOPTS[$1]/%|*([[:blank:]])}|" # The | on the end is required.
}
# Function to destroy a bond.
@@ -235,7 +235,7 @@ if_up() {
i=0
while [ $i -lt $MAXNICS ]; do
[ "${IFNAME[$i]}" = "${1}" ] && break
- i=$(($i+1))
+ i=$((i+1))
done
# If "i" is greater or equal to "MAXNICS" at this point, it means we didn't
# find an entry in IFNAME array corresponding to "${1}", which likely means
@@ -288,7 +288,7 @@ if_up() {
debug_log "/sbin/ip link set dev ${1} type vlan $IFOPT"
/sbin/ip link set dev ${1} type vlan $IFOPT
fi
- done <<<"${IFOPTS[$i]}|" # The | on the end is required.
+ done <<<"${IFOPTS[$i]/%|*([[:blank:]])}|" # The | on the end is required.
elif [ -z "${BONDNICS[$i]}" ] && [ -z "${BRNICS[$i]}" ]; then
# Only apply IFOPTS for a physical interface if it's not been handled
# by a higher level interface.
@@ -297,7 +297,7 @@ if_up() {
debug_log "/sbin/ip link set dev ${1} $IFOPT"
/sbin/ip link set dev ${1} $IFOPT
fi
- done <<<"${IFOPTS[$i]}|" # The | on the end is required.
+ done <<<"${IFOPTS[$i]/%|*([[:blank:]])}|" # The | on the end is required.
fi
# Set hardware address:
if [ -n "${HWADDR[$i]}" ]; then
@@ -350,7 +350,6 @@ if_up() {
# Note: ARM users should make use of the DHCP_NOIPV4LL[x]="yes" parameter in rc.inet1.conf - this is the correct
# way to get the behaviour they seek.
[ "${DHCP_NOIPV4LL[$i]}" = "yes" ] && DHCP_OPTIONS+=("-L")
- [ -n "${DHCP_IPADDR[$i]}" ] && DHCP_OPTIONS+=("-r" "${DHCP_IPADDR[$i]}")
echo "${1}: polling for DHCP server"
# 15 seconds should be a reasonable default DHCP timeout. 30 was too much.
debug_log "/sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS[*]} ${1}"
@@ -389,7 +388,7 @@ if_up() {
/sbin/ip -6 address show dynamic dev ${1} 2>/dev/null | grep -Ewq 'inet6' && { IF_UP=1; break; }
sleep 0.5
done
- if (($IF_UP != 1)); then
+ if ((IF_UP != 1)); then
echo "${1}: timed out"
info_log "${1}: failed to auto configure after ${SLAAC_TIMEOUT[$i]} seconds"
debug_log "/sbin/ip address flush dev ${1}"
@@ -398,27 +397,8 @@ if_up() {
/sbin/ip link set dev ${1} down
fi
fi
- if [ "${USE_DHCP[$i]}" != "yes" ] && [ -n "${IPADDR[$i]}" ]; then # add a fixed v4 IP to the interface
- info_log "${1}: setting fixed IPv4 address"
- if [ -z "${NETMASK[$i]}" ]; then
- info_log "${1}: no NETMASK set for primary IP ${IPADDR[$i]} - assuming 24 (aka, 255.255.255.0)"
- NETMASK[$i]="24"
- fi
- debug_log "/sbin/ip -4 address add ${IPADDR[$i]}/${NETMASK[$i]#/} broadcast + dev ${1}"
- if /sbin/ip -4 address add ${IPADDR[$i]}/${NETMASK[$i]#/} broadcast + dev ${1} && \
- /sbin/ip link set dev ${1} up; then
- IF_UP=1
- else
- info_log "${1}: failed to set IP ${IPADDR[$i]}"
- debug_log "/sbin/ip address flush dev ${1}"
- /sbin/ip address flush dev ${1}
- debug_log "/sbin/ip link set dev ${1} down"
- /sbin/ip link set dev ${1} down
- fi
- fi
- if [ -e /proc/sys/net/ipv6 ] && [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" != "yes" ] && \
- [ -n "${IP6ADDRS[$i]}" ]; then # add fixed v6 IPs
- info_log "${1}: setting fixed IPv6 addresses"
+ if [ -e /proc/sys/net/ipv6 ] && [ -n "${IP6ADDRS[$i]}" ]; then # add v6 IPs
+ info_log "${1}: setting IPv6 addresses"
# IPv6's Duplicate Address Detection (DAD) causes a race condition when bringing up interfaces, as
# described here: https://www.agwa.name/blog/post/beware_the_ipv6_dad_race_condition
# Disable DAD while bringing up the interface - but note that this means the loss of detection of a
@@ -433,8 +413,7 @@ if_up() {
PREFIX="64"
fi
debug_log "/sbin/ip -6 address add $IP/$PREFIX dev ${1}"
- if /sbin/ip -6 address add $IP/$PREFIX dev ${1} && \
- /sbin/ip link set dev ${1} up; then
+ if /sbin/ip -6 address add $IP/$PREFIX dev ${1} && /sbin/ip link set dev ${1} up; then
# Enable accepting of RA packets if explicitly told to.
if [ "${USE_RA[$i]}" = "yes" ]; then
debug_log "${1}: unconditionally accepting IPv6 RA"
@@ -443,7 +422,7 @@ if_up() {
IF_UP=1
else
info_log "${1}: failed to set IP $IP"
- if (($IF_UP != 1)); then # a v4 address was configured, don't flush it
+ if ((IF_UP != 1)); then # a v4 address was configured, don't flush it
debug_log "/sbin/ip address flush dev ${1}"
/sbin/ip address flush dev ${1}
debug_log "/sbin/ip link set dev ${1} down"
@@ -455,27 +434,55 @@ if_up() {
debug_log "${1}: resetting IPv6 DAD to default"
cat /proc/sys/net/ipv6/conf/default/accept_dad >/proc/sys/net/ipv6/conf/${1}/accept_dad
fi
- if (($IF_UP == 1)); then # only do further config if the interface came up
- info_log "${1}: setting fixed IPv4 alias addresses"
- # Add extra IPv4 addresses to the interface:
- if [ -n "${IPALIASES[$i]}" ]; then
- NUM=0
- for IPALIAS in ${IPALIASES[$i]}; do
- IP="${IPALIAS%/*}"
- NM="${IPALIAS#*/}"
- if [ -z "$NM" ] || [ "$IP" == "$NM" ]; then
- info_log "${1}: no netmask set for alias IP $IP - assuming 24 (aka, 255.255.255.0)"
- NM="24"
- fi
- debug_log "/sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM"
- if /sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM; then
- NUM=$(($NUM + 1))
- else
- info_log "${1}: failed to add alias IP $IP"
- fi
- done
+ if [ -n "${IPADDRS[$i]}" ] || [ -n "${IPADDR[$i]}" ]; then # add v4 IPs
+ info_log "${1}: setting IPv4 addresses"
+ # Only use IPADDR if no dynamic configuration was done.
+ if [ "${USE_DHCP[$i]}" == "yes" ] || [ "${USE_DHCP6[$i]}" == "yes" ] || [ "${USE_SLAAC[$i]}" == "yes" ]; then
+ V4IPS="${IPADDRS[$i]}"
+ else
+ V4IPS="${IPADDRS[$i]} ${IPADDR[$i]}${NETMASK[$i]:+/${NETMASK[$i]}}"
fi
- # Force an MTU (possibly over-riding that set by DHCP or RA):
+ for V4IP in $V4IPS; do
+ IP="${V4IP%/*}"
+ NM="${V4IP#*/}"
+ if [ -z "$NM" ] || [ "$IP" == "$NM" ]; then
+ info_log "${1}: no netmask set for IP $IP - assuming 24 (aka, 255.255.255.0)"
+ NM="24"
+ fi
+ debug_log "/sbin/ip -4 address add $IP/$NM broadcast + dev ${1}"
+ if /sbin/ip -4 address add $IP/$NM broadcast + dev ${1} && /sbin/ip link set dev ${1} up; then
+ IF_UP=1
+ else
+ info_log "${1}: failed to set IP $IP"
+ if ((IF_UP != 1)); then # if at least one address was configured, don't flush the device
+ debug_log "/sbin/ip address flush dev ${1}"
+ /sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
+ fi
+ fi
+ done
+ fi
+ if ((IF_UP == 1)) && [ -n "${IPALIASES[$i]}" ]; then # Only apply IPALIASES onto an up interface
+ info_log "${1}: setting extra IPv4 addresses"
+ NUM=0
+ for EXTRAIP in ${IPALIASES[$i]}; do
+ IP="${EXTRAIP%/*}"
+ NM="${EXTRAIP#*/}"
+ if [ -z "$NM" ] || [ "$IP" == "$NM" ]; then
+ info_log "${1}: no netmask set for alias IP $IP - assuming 24 (aka, 255.255.255.0)"
+ NM="24"
+ fi
+ debug_log "/sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM"
+ if /sbin/ip -4 address add $IP/$NM broadcast + dev ${1} label ${1}:$NUM; then
+ NUM=$((NUM + 1))
+ else
+ info_log "${1}: failed to add alias IP $IP"
+ fi
+ done
+ fi
+ if ((IF_UP == 1)); then
+ # Force an MTU (possibly overriding that set by DHCP or RA):
if [ -n "${MTU[$i]}" ]; then
info_log "${1}: setting custom MTU"
debug_log "/sbin/ip link set dev ${1} mtu ${MTU[$i]}"
@@ -506,7 +513,7 @@ if_down() {
i=0
while [ $i -lt $MAXNICS ]; do
[ "${IFNAME[$i]}" = "${1}" ] && break
- i=$(($i+1))
+ i=$((i+1))
done
if [ $i -ge $MAXNICS ]; then
info_log "${1}: skipping - you might need to increase MAXNICS"
@@ -518,12 +525,12 @@ if_down() {
info_log "${1}: stopping dhcpcd"
# When using -k, dhcpcd requires some command line options to match those used to invoke it:
if [ "${USE_DHCP[$i]}" = "yes" ] && [ "${USE_DHCP6[$i]}" != "yes" ]; then # only v4 dhcp
- DHCP_OPTIONS="-4"
+ DHCP_OPTIONS=( -4 )
elif [ "${USE_DHCP[$i]}" != "yes" ] && [ "${USE_DHCP6[$i]}" = "yes" ]; then # only v6 dhcp
- DHCP_OPTIONS="-6"
+ DHCP_OPTIONS=( -6 )
fi
- debug_log "/sbin/dhcpcd $DHCP_OPTIONS -k -d ${1}"
- /sbin/dhcpcd $DHCP_OPTIONS -k -d ${1} 2>/dev/null || info_log "${1}: failed to stop dhcpcd"
+ debug_log "/sbin/dhcpcd ${DHCP_OPTIONS[*]} -k -d ${1}"
+ /sbin/dhcpcd "${DHCP_OPTIONS[*]}" -k -d ${1} 2>/dev/null || info_log "${1}: failed to stop dhcpcd"
fi
# Disable v6 IP auto configuration and RA before trying to clear the IP from the interface:
if [ -e /proc/sys/net/ipv6 ]; then
@@ -618,7 +625,7 @@ start() {
stop() {
echo "Stopping the network interfaces..."
gateway_down
- for (( i = $MAXNICS - 1; i >= 0; i-- )); do
+ for (( i = MAXNICS - 1; i >= 0; i-- )); do
if_down ${IFNAME[$i]}
done
virtif_destroy
@@ -630,6 +637,9 @@ stop() {
### MAIN ###
############
+# extglob is required for some functionallity.
+shopt -s extglob
+
case "${1}" in
start|up) # "start" (or "up") brings up all configured interfaces:
start
diff --git a/source/n/network-scripts/scripts/rc.inet1.conf b/source/n/network-scripts/scripts/rc.inet1.conf
index 5081ee5bb..0daee7017 100644
--- a/source/n/network-scripts/scripts/rc.inet1.conf
+++ b/source/n/network-scripts/scripts/rc.inet1.conf
@@ -17,49 +17,45 @@
# =============================================================================
-# IPv4 config information for eth0:
-IPADDR[0]=""
-NETMASK[0]=""
-IPALIASES[0]=""
+# IPv4 config options for eth0:
+IPADDRS[0]=""
USE_DHCP[0]=""
-DHCP_HOSTNAME[0]=""
-# IPv6 config information for eth0:
+# IPv6 config options for eth0:
IP6ADDRS[0]=""
USE_SLAAC[0]=""
USE_DHCP6[0]=""
+# Generic options for eth0:
+DHCP_HOSTNAME[0]=""
-# IPv4 config information for eth1:
-IPADDR[1]=""
-NETMASK[1]=""
-IPALIASES[1]=""
+# IPv4 config options for eth1:
+IPADDRS[1]=""
USE_DHCP[1]=""
-DHCP_HOSTNAME[1]=""
-# IPv6 config information for eth1:
+# IPv6 config options for eth1:
IP6ADDRS[1]=""
USE_SLAAC[1]=""
USE_DHCP6[1]=""
+# Generic options for eth1:
+DHCP_HOSTNAME[1]=""
-# IPv4 config information for eth2:
-IPADDR[2]=""
-NETMASK[2]=""
-IPALIASES[2]=""
+# IPv4 config options for eth2:
+IPADDRS[2]=""
USE_DHCP[2]=""
-DHCP_HOSTNAME[2]=""
-# IPv6 config information for eth2:
+# IPv6 config options for eth2:
IP6ADDRS[2]=""
USE_SLAAC[2]=""
USE_DHCP6[2]=""
+# Generic options for eth2:
+DHCP_HOSTNAME[2]=""
-# IPv4 config information for eth3:
-IPADDR[3]=""
-NETMASK[3]=""
-IPALIASES[3]=""
+# IPv4 config options for eth3:
+IPADDRS[3]=""
USE_DHCP[3]=""
-DHCP_HOSTNAME[3]=""
-# IPv6 config information for eth3:
+# IPv6 config options for eth3:
IP6ADDRS[3]=""
USE_SLAAC[3]=""
USE_DHCP6[3]=""
+# Generic options for eth3:
+DHCP_HOSTNAME[3]=""
# IPv4 default gateway IP address:
GATEWAY=""
@@ -68,7 +64,7 @@ GATEWAY6=""
# =============================================================================
-# Example of how to configure a bond (link aggrigation) interface.
+# Example of how to configure a bond (link aggregation) interface.
# Note the addition of the BONDNICS and BONDMODE parameters.
# BONDNICS is a space delimited list of interfaces to add to this bond. The
# BONDNICS interfaces will be brought up and configured while bringing up the
@@ -107,9 +103,7 @@ GATEWAY6=""
# for a standard VLAN to be configured.
#IFNAME[0]="eth0.10"
#IFOPTS[0]=""
-#IPADDR[0]="192.168.10.1"
-#NETMASK[0]="24"
-#IPALIASES[0]=""
+#IPADDRS[0]="192.168.10.1/24"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""
#IP6ADDRS[0]=""
@@ -128,9 +122,7 @@ GATEWAY6=""
#IFNAME[0]="br0"
#BRNICS[0]="eth0"
#IFOPTS[0]=""
-#IPADDR[0]="192.168.0.1"
-#NETMASK[0]="24"
-#IPALIASES[0]=""
+#IPADDRS[0]="192.168.0.1/24"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""
@@ -160,8 +152,7 @@ GATEWAY6=""
# Uncomment the lines you need and fill in your data. You may not need all of
# these for your wireless network.
#IFNAME[4]="wlan0"
-#IPADDR[4]=""
-#NETMASK[4]=""
+#IPADDRS[4]=""
#USE_DHCP[4]="yes"
#DHCP_HOSTNAME[4]="icculus-wireless"
#DHCP_KEEPRESOLV[4]="yes"
@@ -188,15 +179,11 @@ GATEWAY6=""
# can be found in the ip-link(8) man page in
# the approprite section for the interface
# type being configured.
-#IPALIASES[4]="192.168.5.10/24" # A space delimited list of CIDR formatted IP
- # aliases to assign to the interface after it
- # has come up. If no /<prefix> is given after
- # the IP address, /24 will be used as default.
#HWADDR[4]="00:01:23:45:67:89" # Overrule the card's hardware MAC address
#MTU[4]="" # The default MTU is 1500, but you might need
# 1360 when you use NAT'ed IPSec traffic.
#PROMISCUOUS[4]="yes" # Set promiscuous mode on the interface.
-#DHCP_TIMEOUT[4]=15 # The default timeout for the DHCP client to
+#DHCP_TIMEOUT[4]="15" # The default timeout for the DHCP client to
# wait for server resonse is 15 seconds, but
# you might want a shorter or longer wait.
#DHCP_KEEPRESOLV[4]="yes" # If you don't want /etc/resolv.conf overwritten
@@ -215,7 +202,7 @@ GATEWAY6=""
# Increase the timeout if required.
#USE_RA[4]="yes" # Accept router advertisements even when SLAAC
# is disabled on the interface.
-#WLAN_ESSID[4]=DARKSTAR # An example of how you can override _any_
+#WLAN_ESSID[4]="DARKSTAR" # An example of how you can override _any_
# parameter defined in rc.wireless.conf, by
# prepending 'WLAN_' to the parameter's name.
# Useful with multiple wireless interfaces.
@@ -229,7 +216,7 @@ GATEWAY6=""
#WLAN_WPADRIVER[4]="ndiswrapper"# Tell wpa_supplicant to specifically use the
# ndiswrapper driver (if you leave this empty
# the 'wext' driver is used by default)
-#WLAN_WPAWAIT[4]=30 # In case it takes long for the WPA association
+#WLAN_WPAWAIT[4]="30" # In case it takes long for the WPA association
# to finish, you can increase the wait time
# (defaults to 10 seconds)