diff options
Diffstat (limited to 'source/n/network-scripts')
-rw-r--r-- | source/n/network-scripts/0001-no_hostname_in_networkmanager_conf.diff | 13 | ||||
-rw-r--r-- | source/n/network-scripts/0002-set_broadcast_address_and_flush_ip_after_if_down.diff | 22 | ||||
-rw-r--r-- | source/n/network-scripts/0003-netconfig-typos-and-set-NM-default.diff | 165 | ||||
-rw-r--r-- | source/n/network-scripts/README.rc.inet1 | 72 | ||||
-rw-r--r-- | source/n/network-scripts/manpages/rc.inet1.8 | 10 | ||||
-rw-r--r-- | source/n/network-scripts/manpages/rc.inet1.conf.5 | 65 | ||||
-rwxr-xr-x | source/n/network-scripts/network-scripts.SlackBuild | 27 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/netconfig | 65 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet1 | 242 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet1.conf | 28 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet2 | 5 | ||||
-rw-r--r-- | source/n/network-scripts/slack-desc | 8 |
12 files changed, 514 insertions, 208 deletions
diff --git a/source/n/network-scripts/0001-no_hostname_in_networkmanager_conf.diff b/source/n/network-scripts/0001-no_hostname_in_networkmanager_conf.diff new file mode 100644 index 00000000..8ce7600c --- /dev/null +++ b/source/n/network-scripts/0001-no_hostname_in_networkmanager_conf.diff @@ -0,0 +1,13 @@ +--- ./netconfig.orig 2017-11-26 13:34:37.652627697 -0600 ++++ ./netconfig 2018-02-15 20:01:26.844174383 -0600 +@@ -362,10 +362,6 @@ + + # Write the hostname with domain to /etc/HOSTNAME: + echo $HOSTNM.$DOMAIN > etc/HOSTNAME +-# Also make sure the hostname is written to /etc/NetworkManager/NetworkManager.conf: +-if [ -w etc/NetworkManager/NetworkManager.conf ]; then +- sed -i "s/^hostname=.*$/hostname=$HOSTNM/g" etc/NetworkManager/NetworkManager.conf +-fi + + dialog --title "CONFIGURATION TYPE FOR '$HOSTNM.$DOMAIN'" \ + --default-item DHCP \ diff --git a/source/n/network-scripts/0002-set_broadcast_address_and_flush_ip_after_if_down.diff b/source/n/network-scripts/0002-set_broadcast_address_and_flush_ip_after_if_down.diff new file mode 100644 index 00000000..e963115d --- /dev/null +++ b/source/n/network-scripts/0002-set_broadcast_address_and_flush_ip_after_if_down.diff @@ -0,0 +1,22 @@ +--- ./rc.inet1.orig 2017-11-26 22:48:14.650274588 -0600 ++++ ./rc.inet1 2018-02-15 20:42:45.731997047 -0600 +@@ -215,8 +215,8 @@ + else # bring up interface using a static IP address + if [ -n "${IPADDR[$i]}" ]; then # skip unconfigured interfaces + # Set up the network card: +- echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}" | $LOGGER +- /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1} ++ echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1}" | $LOGGER ++ /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} broadcast + dev ${1} + if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then + /sbin/ip link set dev ${1} up # Bring up interface + fi +@@ -268,6 +268,8 @@ + if [ -n "${BRNICS[$i]}" ]; then + br_close $i + fi ++ # Flush the address from the interface: ++ ip address flush dev ${1} + fi + } + diff --git a/source/n/network-scripts/0003-netconfig-typos-and-set-NM-default.diff b/source/n/network-scripts/0003-netconfig-typos-and-set-NM-default.diff new file mode 100644 index 00000000..cd6bf2cc --- /dev/null +++ b/source/n/network-scripts/0003-netconfig-typos-and-set-NM-default.diff @@ -0,0 +1,165 @@ +--- ./netconfig.orig 2018-02-21 21:21:31.000000000 -0600 ++++ ./netconfig 2018-04-12 14:07:10.137023035 -0500 +@@ -11,7 +11,7 @@ + # + + # 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 ++# 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 +@@ -68,7 +68,7 @@ + # Default gateway IP address: + GATEWAY="$GATEWAY" + +-# Change this to "yes" for debugging output to stdout. Unfortunately, ++# Change this to "yes" for debugging output to stdout. Unfortunately, + # /sbin/hotplug seems to disable stdout so you'll only see debugging output + # when rc.inet1 is called directly. + DEBUG_ETH_UP="no" +@@ -103,8 +103,8 @@ + #VIRTIFUSER[1]="someuser" + #VIRTIFGROUP[1]="somegroup" + +-## Example config information for wlan0. Uncomment the lines you need and fill +-## in your data. (You may not need all of these for your wireless network) ++## Example config information for wlan0. 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]="" +@@ -173,7 +173,7 @@ + /bin/cat <<EOF >$ETCNETWORKS + # + # networks This file describes a number of netname-to-address +-# mappings for the TCP/IP subsystem. It is mostly ++# mappings for the TCP/IP subsystem. It is mostly + # used at boot time, when no name servers are running. + # + +@@ -192,14 +192,14 @@ + /bin/cat << EOF > $HOSTS + # + # hosts This file describes a number of hostname-to-address +-# mappings for the TCP/IP subsystem. It is mostly ++# mappings for the TCP/IP subsystem. It is mostly + # used at boot time, when no name servers are running. + # On small systems, this file can be used instead of a + # "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 ++# should NEVER be named with the name of the machine. It causes problems + # for some (stupid) programs, irc and reputedly talk. :^) + # + +@@ -362,16 +362,21 @@ + + # Write the hostname with domain to /etc/HOSTNAME: + echo $HOSTNM.$DOMAIN > etc/HOSTNAME ++## OBSOLETE with recent NetworkManager: ++## Also make sure the hostname is written to /etc/NetworkManager/NetworkManager.conf: ++#if [ -w etc/NetworkManager/NetworkManager.conf ]; then ++# sed -i "s/^hostname=.*$/hostname=$HOSTNM/g" etc/NetworkManager/NetworkManager.conf ++#fi + + dialog --title "CONFIGURATION TYPE FOR '$HOSTNM.$DOMAIN'" \ +---default-item DHCP \ ++--default-item NetworkManager \ + --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, \ +-and DNS, use the 'static IP' choice to enter these values. If your IP \ ++and DNS, use the 'static IP' choice to enter these values. If your IP \ + address is assigned by a DHCP server (commonly used by cable modem and DSL \ +-services), select 'DHCP'. If you do not have a network card, select \ +-the 'loopback' choice. You may also select 'NetworkManager' if you would \ ++services), select 'DHCP'. If you do not have a network card, select \ ++the 'loopback' choice. You may also select 'NetworkManager' if you would \ + like to have the NetworkManager daemon automatically handle your wired and \ + wireless network interfaces (this is simple and usually works). \ + Which type of network setup would you like?" 20 70 4 \ +@@ -389,10 +394,10 @@ + if [ "$REPLY" = "DHCP" ]; then + USE_DHCP="yes" + dialog --title "SET DHCP HOSTNAME" --inputbox "Some network providers require \ +-that the DHCP hostname be set in order to connect. If so, they'll have assigned \ ++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 \ ++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`" + rm -f $TMP/SeTDHCPHOST +@@ -442,7 +447,7 @@ + NETMASK=`cat $TMP/SeTnetmask` + fi + cat << EOF > $TMP/tempmsg +-Enter your netmask. This will generally look something ++Enter your netmask. This will generally look something + like this: 255.255.255.0 + Enter netmask (aaa.bbb.ccc.ddd): + EOF +@@ -556,8 +561,8 @@ + dialog --title "PROBE FOR NETWORK CARD?" --menu "If you like, we \ + can look to see what kind of network card you have in your machine, and \ + if we find one create an /etc/rc.d/rc.netdevice script to load the module \ +-for it at boot time. There's a slight bit of danger that the probing \ +-can cause problems, but it almost always works. If you'd rather configure \ ++for it at boot time. There's a slight bit of danger that the probing \ ++can cause problems, but it almost always works. If you'd rather configure \ + your system manually, you can skip the probing process and edit \ + /etc/rc.d/rc.modules or /etc/modules.conf later to have it load the right module." \ + 16 68 2 \ +@@ -601,7 +606,7 @@ + fi + if [ ! -r /cardfound ]; then + dialog --title "NO CARD DETECTED" --msgbox "Sorry, but no network \ +-card could be probed for on your system. Some cards (like non-PCI NE2000s) \ ++card could be probed for on your system. Some cards (like non-PCI NE2000s) \ + must be supplied with the I/O address to use and can't be probed for safely. \ + You'll have to try to configure the card later by editing \ + /etc/rc.d/rc.modules or recompiling your kernel." 9 70 +@@ -621,11 +626,11 @@ + 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 ++wired and wireless network management. To set up wireless networks + and view status, add the Network Management control panel widget to + your KDE desktop. + +-Is this correct? Press 'Yes' to confirm, or 'No' to reconfigure." 0 0 ++Is this correct? Press 'Yes' to confirm, or 'No' to reconfigure." 0 0 + RETVAL=$? + elif [ "$USE_DHCP" = "" ]; then + while [ 0 ]; do +@@ -634,8 +639,8 @@ + --extra-label Edit \ + --cancel-label Restart \ + --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 \ ++"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 (or reconfigure later using 'netconfig')." \ + 22 60 12 \ + "Hostname:" "$HOSTNM" \ +@@ -692,11 +697,11 @@ + chmod 755 etc/rc.d/rc.networkmanager + fi + if [ "$1" = "" ]; then +- dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40 ++ dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40 + fi + else + if [ "$1" = "" ]; then +- dialog --msgbox "Settings discarded. Run the 'netconfig' command again if you need to reconfigure your network settings." 6 60 ++ dialog --msgbox "Settings discarded. Run the 'netconfig' command again if you need to reconfigure your network settings." 6 60 + fi + fi + diff --git a/source/n/network-scripts/README.rc.inet1 b/source/n/network-scripts/README.rc.inet1 deleted file mode 100644 index 5c4a132f..00000000 --- a/source/n/network-scripts/README.rc.inet1 +++ /dev/null @@ -1,72 +0,0 @@ -Hi! -Nice of you to pop by. - -========================================================================== - -Slackware 10.x replacement rc scripts by Alien. - -========================================================================== - -PREFACE: -If you were looking for the 'http://sox.homeip.net/slackware-10.1.IHWhqM' -URL, a word of advice. The rc.inet1 script that I put up there is still -available in the subdirectory 'slackware-10.1.IHWhqM' that you'll find -above. -However, Pat Volkerding was not happy with the fact that this particular -script breaks compatibility with older rc.inet1.conf configuration files. -Therefore, I re-designed the pair of scripts: rc.inet1 and rc.wireless -so that their configuration files (rc.inet1.conf and rc.wireless -respectively) remain compatible with the stock Slackware versions. -The new scripts that you will find here, have much more functionality -than my first attempts (still kept for reference in the -slackware-10.1.IHWhqM directory). - -So, read on for all the info you'll need about this new stuff...... - -========================================================================== - -NETWORK CARD CONFIGURATION: -A major complaint with wireless network cards, is that Slackware's -network configuration does not allow for other interfaces than eth0, -eth1, etc... - -My replacement scripts work fine for network interfaces with other names -than eth0, etc1, ..... For instance, you can use them if you have a -wireless interface called wlan0, or ath0, or ra0. - -You will need the set of rc.inet1* and rc.wireless* together - you must -upgrade them all at once (well the *.conf files may stay the same if you -are still using the stock Slackware scripts). - -These new rc scripts will offer support for arbitrary network interface -names, but also support for WPA encryption using wpa_supplicant. -For WPA support you must of course install wpa_supplicant too, but -the sources, build script and Slackware package can be found under - -http://sox.homeip.net/slackware/slackbuilds/wpa_supplicant/ - -Put your WPAPSK (the WPA pre-shared key) in '/etc/wpa_supplicant.conf' -together with other wireless settings -- look at '/etc/wpa_supplicant.sample' for inspiration. - ->>> WEP encryption, naturally, is still supported, like before. <<< - -The rc.wireless script must only be run by the rc.inet1 script, -it is not meant to be run directly by you, the user. - -So, to start your wlan0 interface, you run: - # /etc/rc.d/rc.inet1 wlan0_start -and to restart the interface (i.e. stop, and then start again) you do: - # /etc/rc.d/rc.inet1 wlan0_restart -Look at the bottom of rc.inet1.conf for examples of the (many new) -parameters you can configure for your interfaces. - -I would like to receive your comments on how they work for you, so that -they can hopefully be incorporated into Slackware 11 eventually. - -You can contact me in Freenode IRC in ##slackware. -Look out for alien_ or aloon. - -Eric Hameleers <alien -at- sox -dot- homeip -dot- net> / 28-apr-2005 / - -========================================================================== diff --git a/source/n/network-scripts/manpages/rc.inet1.8 b/source/n/network-scripts/manpages/rc.inet1.8 index 9b4d9149..e78353a0 100644 --- a/source/n/network-scripts/manpages/rc.inet1.8 +++ b/source/n/network-scripts/manpages/rc.inet1.8 @@ -7,7 +7,7 @@ .ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP .el .TP "\\$1" .. -.TH RC.INET1 8 "03 Dec 2008" "Slackware Version 12.2.0" +.TH RC.INET1 8 "12 Nov 2017" "Slackware Version 15.0" .SH NAME rc.inet1 \- Slackware network configuration script. .SH DESCRIPTION @@ -100,11 +100,13 @@ and change the value `6' in the line: .br to a value that is larger than the largest index value you use. .LP -The /etc/rc.d/rc.wireless script is not meant to be run on it's own by the user! -.SH AUTHOR +The /etc/rc.d/rc.wireless script is not meant to be run on its own by the user! +.SH AUTHORS +Patrick J. Volkerding <volkerdi@slackware.com> Eric Hameleers <alien@slackware.com> +Robby Workman <rworkman@slackware.com> .SH "SEE ALSO" .BR rc.inet1.conf(5), -.BR ifconfig(8), +.BR ip(8), .BR iwconfig(8), .BR route(8) diff --git a/source/n/network-scripts/manpages/rc.inet1.conf.5 b/source/n/network-scripts/manpages/rc.inet1.conf.5 index b23f6783..1f790c0a 100644 --- a/source/n/network-scripts/manpages/rc.inet1.conf.5 +++ b/source/n/network-scripts/manpages/rc.inet1.conf.5 @@ -7,7 +7,7 @@ .ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP .el .TP "\\$1" .. -.TH RC.INET1.CONF 5 "03 Dec 2008" "Slackware Version 12.2.0" +.TH RC.INET1.CONF 5 "12 Nov 2017" "Slackware Version 15.0" .SH NAME rc.inet1.conf \- Slackware network configuration file. .SH DESCRIPTION @@ -34,6 +34,8 @@ IPADDR[0]="" .br NETMASK[0]="" .br +IPALIASES[0]="" +.br USE_DHCP[0]="yes" .br DHCP_HOSTNAME[0]="" @@ -45,7 +47,8 @@ has a non-default name ( .I ath0 instead of .I eth1 -). The array index is [1] in this case. +), as well as an additional IP address configured on the interface. +The array index is [1] in this case. .LP # Config information for ath0 (using static IP address): .br @@ -55,11 +58,50 @@ IPADDR[1]="192.168.3.11" .br NETMASK[1]="255.255.255.0" .br +IPALIASES[1]="192.168.3.100" +.br USE_DHCP[1]="" .br DHCP_HOSTNAME[1]="" .br GATEWAY="192.168.3.1" +.br +.SH EXAMPLE VIRTUAL INTERFACE CREATION AND SETUP +Virtual interfaces are created before any address configuration or bridge +setup is done, so you may use these interfaces as IFNAME or BRNICS values. +These can be tun or tap interfaces: adjust VIRTIFNAME and VIRTIFTYPE as +needed. +.LP +# Virtual tap interface example +.br +#VIRTIFNAME[0]="tap0" +.br +#VIRTIFTYPE[0]="tap" +.br +#VIRTIFUSER[0]="root" +.br +#VIRTIFGROUP[0]="root" +.br +.SH EXAMPLE BRIDGE CREATION AND SETUP +Note the added "BRNICS" variable which contains a space-separated list +of the physical or virtual network interfaces you want to add to the bridge. +Note that the array index can not be a duplicate of that defined for some +other interface (e.g. eth0 will be index 0 by default). +.LP +IFNAME[0]="br0" +.br +BRNICS[0]="eth0 eth1 tun0" +.br +IPADDR[0]="192.168.0.1" +.br +NETMASK[0]="255.255.255.0" +.br +IPALIASES[0]="" +.br +USE_DHCP[0]="" +.br +DHCP_HOSTNAME[0]="" +.br .SH GENERAL PARAMETERS This is a list of network parameters you can set for any card (wired as well as wired). The example section is for `eth0' by default, i.e. @@ -75,6 +117,12 @@ NETMASK[0]="" # With a static IP address, you are required to also set a netmask (255.255.255.0 is common) .TP +IPALIASES[0]="" +# Space separated list of additional IP addresses to bind to the +interface after initial configuration is complete. If USE_DHCP is +set to `yes' then additional addresses will only be added if the +dhcp client invocation is successful in obtaining a primary address. +.TP USE_DHCP[0]="yes" # If set to "yes", we will run a DHCP client and have the IP address dynamically assigned @@ -86,15 +134,16 @@ DHCP_TIMEOUT[0]=15 # The default timeout for the DHCP client to wait for server response is 30 seconds, but you might want a shorter wait. .TP -IFNAME[0]="eth0:1" -# Set up an IP alias. +IFNAME[0]="usb0" +# Use this to define configuration blocks for interfaces with non-standard +names (this should be rare these days) .TP HWADDR[0]="00:01:23:45:67:89" # Overrule the card's hardware MAC address .TP MTU[0]="" # The default MTU is 1500, but you might need 1360 when you use NAT'ed -IPSec traffic. +IPSec traffic. IPv6 will likely require smaller MTUs as well .TP DHCP_KEEPRESOLV[0]="yes" # If you do @@ -171,7 +220,7 @@ failed (defaults to 10 seconds) network configuration script .TP .I /etc/rc.d/rc.inet1.conf -configuration parameter file (is being read by rc.inet1 andrc.wireless) +configuration parameter file (is being read by rc.inet1 and rc.wireless) .TP .I /etc/rc.d/rc.wireless wireless configuration script @@ -196,7 +245,9 @@ have to edit the file and change the value `6' in the line .B MAXNICS=${MAXNICS:-6} to the number of network interfaces you wish to use. -.SH AUTHOR +.SH AUTHORS +Patrick J. Volkerding <volkerdi@slackware.com> Eric Hameleers <alien@slackware.com> +Robby Workman <rworkman@slackware.com> .SH "SEE ALSO" .BR rc.inet1(8) diff --git a/source/n/network-scripts/network-scripts.SlackBuild b/source/n/network-scripts/network-scripts.SlackBuild index d19c6022..b484de1d 100755 --- a/source/n/network-scripts/network-scripts.SlackBuild +++ b/source/n/network-scripts/network-scripts.SlackBuild @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash -# Copyright 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2015 Patrick J. Volkerding, Sebeka, MN, USA +# Copyright 2006, 2007, 2008, 2009, 2010, 2012, 2013, 2015, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -20,13 +20,21 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +cd $(dirname $0) ; CWD=$(pwd) PKGNAM=network-scripts -VERSION=${VERSION:-14.2} +VERSION=${VERSION:-15.0} ARCH=noarch -BUILD=${BUILD:-1} +BUILD=${BUILD:-7} + +# 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 +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi -CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-${PKGNAM} @@ -56,6 +64,15 @@ cp -a $CWD/scripts/setup.netconfig $PKG/var/log/setup chown root:root $PKG/var/log/setup/setup.netconfig chmod 755 $PKG/var/log/setup/setup.netconfig +# Apply patches until rworkman takes them up in git: +( cd $PKG/sbin + zcat $CWD/0001-no_hostname_in_networkmanager_conf.diff.gz | patch -p1 --verbose || exit 1 + zcat $CWD/0003-netconfig-typos-and-set-NM-default.diff.gz | patch -p1 --verbose || exit 1 +) || exit 1 +( cd $PKG/etc/rc.d + zcat $CWD/0002-set_broadcast_address_and_flush_ip_after_if_down.diff.gz | patch -p1 --verbose rc.inet1.new || exit 1 +) || exit 1 + # Add manpages: mkdir -p $PKG/usr/man/man{5,8} cat $CWD/manpages/rc.inet1.conf.5 | gzip -9c > $PKG/usr/man/man5/rc.inet1.conf.5.gz diff --git a/source/n/network-scripts/scripts/netconfig b/source/n/network-scripts/scripts/netconfig index 3bd483de..51e88bd4 100644 --- a/source/n/network-scripts/scripts/netconfig +++ b/source/n/network-scripts/scripts/netconfig @@ -40,24 +40,28 @@ fi # Config information for eth0: IPADDR[0]="$RCIPCOPY" NETMASK[0]="$RCMASKCOPY" +IPALIASES[0]="" USE_DHCP[0]="$USE_DHCP" DHCP_HOSTNAME[0]="$DHCP_HOSTNAME" # Config information for eth1: IPADDR[1]="" NETMASK[1]="" +IPALIASES[1]="" USE_DHCP[1]="" DHCP_HOSTNAME[1]="" # Config information for eth2: IPADDR[2]="" NETMASK[2]="" +IPALIASES[2]="" USE_DHCP[2]="" DHCP_HOSTNAME[2]="" # Config information for eth3: IPADDR[3]="" NETMASK[3]="" +IPALIASES[3]="" USE_DHCP[3]="" DHCP_HOSTNAME[3]="" @@ -71,16 +75,36 @@ DEBUG_ETH_UP="no" # Example of how to configure a bridge: # Note the added "BRNICS" variable which contains a space-separated list -# of the physical network interfaces you want to add to the bridge. +# of the physical or virtual network interfaces you want to add to the bridge. #IFNAME[0]="br0" #BRNICS[0]="eth0" #IPADDR[0]="192.168.0.1" #NETMASK[0]="255.255.255.0" +#IPALIASES[0]="" #USE_DHCP[0]="" #DHCP_HOSTNAME[0]="" +# Virtual interfaces to create - these are created before any address +# configuration or bridge setup is done, so you may use these interfaces +# as IFNAME or BRNICS values. These can be tun or tap interfaces: +# adjust VIRTIFNAME and VIRTIFTYPE accordingly. +# Starting with VIRTIFNAME[0] is mandatory, and each next one must be +# incremented by one, so VIRTIFNAME[1], VIRTIFNAME[2], and so on. +# +# Virtual tap interface example +#VIRTIFNAME[0]="tap0" +#VIRTIFTYPE[0]="tap" +#VIRTIFUSER[0]="root" +#VIRTIFGROUP[0]="root" +# +# Virtual tun interface example +#VIRTIFNAME[1]="tun0" +#VIRTIFTYPE[1]="tun" +#VIRTIFUSER[1]="someuser" +#VIRTIFGROUP[1]="somegroup" + ## Example config information for wlan0. Uncomment the lines you need and fill -## in your info. (You may not need all of these for your wireless network) +## in your data. (You may not need all of these for your wireless network) #IFNAME[4]="wlan0" #IPADDR[4]="" #NETMASK[4]="" @@ -90,38 +114,55 @@ DEBUG_ETH_UP="no" #DHCP_KEEPNTP[4]="yes" #DHCP_KEEPGW[4]="yes" #DHCP_IPADDR[4]="" -#WLAN_ESSID[4]=BARRIER05 +#WLAN_ESSID[4]=DARKSTAR #WLAN_MODE[4]=Managed -##WLAN_RATE[4]="54M auto" -##WLAN_CHANNEL[4]="auto" -##WLAN_KEY[4]="D5AD1F04ACF048EC2D0B1C80C7" -##WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=96389dc66eaf7e6efd5b5523ae43c7925ff4df2f8b7099495192d44a774fda16" +#WLAN_RATE[4]="54M auto" +#WLAN_CHANNEL[4]="auto" +#WLAN_KEY[4]="D5A31F54ACF0487C2D0B1C10D2" +#WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=96389dc66eaf7e6efd5b5523ae43c7925ff4df2f8b7099495192d44a774fda16" #WLAN_WPA[4]="wpa_supplicant" -#WLAN_WPADRIVER[4]="ndiswrapper" +#WLAN_WPADRIVER[4]="wext" +#WLAN_WPAWAIT[4]=30 ## Some examples of additional network parameters that you can use. ## Config information for wlan0: #IFNAME[4]="wlan0" # Use a different interface name instead of # the default 'eth4' +#IFNAME[4]="eth0:1" # Set up an IP alias. #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. +#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 #DHCP_KEEPNTP[4]="yes" # If you don't want ntp.conf overwritten #DHCP_KEEPGW[4]="yes" # If you don't want the DHCP server to change # your default gateway #DHCP_IPADDR[4]="" # Request a specific IP address from the DHCP # server -#WLAN_ESSID[4]=DARKSTAR # Here, you can override _any_ parameter - # defined in rc.wireless.conf, by prepending - # 'WLAN_' to the parameter's name. Useful for - # those with multiple wireless interfaces. +#DHCP_DEBUG[4]="yes" # Make dhcpcd show verbose diagnostics +#DHCP_NOIPV4LL[4]="yes" # Do not assign an ipv4ll address when a DHCP + # server is not found (ipv4ll link-local + # adresses in the IP range 169.254.0.0/16 are + # also known as "zeroconf" addresses) +#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. #WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=thekey" # Some drivers require a private ioctl to be # set through the iwpriv command. If more than # one is required, you can place them in the # IWPRIV parameter (separated with the pipe (|) # character, see the example). +#WLAN_WPA[4]="wpa_supplicant" # Run wpa_supplicant for WPA support +#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 + # to finish, you can increase the wait time + # (defaults to 10 seconds) ENDFILE # ############################################################################ diff --git a/source/n/network-scripts/scripts/rc.inet1 b/source/n/network-scripts/scripts/rc.inet1 index f2d85a6d..2f566ef8 100644 --- a/source/n/network-scripts/scripts/rc.inet1 +++ b/source/n/network-scripts/scripts/rc.inet1 @@ -16,12 +16,19 @@ ########### # If possible, log events in /var/log/messages: -if [ -f /var/run/syslogd.pid -a -x /usr/bin/logger ]; then +if [ -f /var/run/syslogd.pid ] && [ -x /usr/bin/logger ]; then LOGGER=/usr/bin/logger else # output to stdout/stderr: LOGGER=/bin/cat fi +# Handy wrapper for verbose logging +debug_log() { + if [ "$DEBUG_ETH_UP" = "yes" ]; then + echo "/etc/rc.d/rc.inet1: $*" | $LOGGER + fi +} + ############################ # DETERMINE INTERFACE LIST # ############################ @@ -39,9 +46,7 @@ do IFNAME[$i]=${IFNAME[$i]:=eth${i}} i=$(($i+1)) done -if [ "$DEBUG_ETH_UP" = "yes" ]; then - echo "/etc/rc.d/rc.inet1: List of interfaces: '${IFNAME[@]}'" | $LOGGER -fi +debug_log "List of interfaces: '${IFNAME[*]}'" ###################### # LOOPBACK FUNCTIONS # @@ -50,21 +55,22 @@ fi # Function to bring up the loopback interface. If loopback is # already up, do nothing. lo_up() { - if grep lo: /proc/net/dev 1> /dev/null ; then - if ! /sbin/ifconfig | grep "^lo" 1> /dev/null ; then - echo "/etc/rc.d/rc.inet1: /sbin/ifconfig lo 127.0.0.1" | $LOGGER - /sbin/ifconfig lo 127.0.0.1 - echo "/etc/rc.d/rc.inet1: /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo" | $LOGGER - /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo + if [ -e /sys/class/net/lo ]; then + if ! /sbin/ip link show dev lo | grep -wq -e "state UP" -e "state UNKNOWN" ; then + echo "/etc/rc.d/rc.inet1: /sbin/ip address add 127.0.0.1/8 dev lo" | $LOGGER + /sbin/ip address add 127.0.0.1/8 dev lo + /sbin/ip link set dev lo up + echo "/etc/rc.d/rc.inet1: /sbin/ip route add 127.0.0.0/8 dev lo" | $LOGGER + /sbin/ip route add 127.0.0.0/8 dev lo fi fi } # Function to take down the loopback interface: lo_down() { - if grep lo: /proc/net/dev 1> /dev/null ; then - echo "/etc/rc.d/rc.inet1: /sbin/ifconfig lo down" | $LOGGER - /sbin/ifconfig lo down + if [ -e /sys/class/net/lo ]; then + echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev lo down" | $LOGGER + /sbin/ip link set dev lo down fi } @@ -72,27 +78,48 @@ lo_down() { # INTERFACE FUNCTIONS # ####################### +# Function to create virtual interfaces +virtif_create() { + # argument is 'i' - the position of this interface in the VIRTIFNAME array. + # this loop goes from i=0 to i=number_of_configured_virtual_interfaces_minus_one + # which means it doesn't do anything if there are none. + for i in $(seq 0 $((${#VIRTIFNAME[@]} - 1))); do + /sbin/ip tuntap add dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]} user ${VIRTIFUSER[$i]} group ${VIRTIFGROUP[$i]} + done +} + +# Function to destory virtual interfaces +virtif_destroy() { + # argument is 'i' - the position of this interface in the VIRTIFNAME array. + for i in $(seq 0 $((${#VIRTIFNAME[@]} - 1))); do + /sbin/ip tuntap del dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]} + done +} + # Function to assemble a bridge interface. br_open() { # argument is 'i' - the position of this interface in the IFNAME array. - /sbin/brctl addbr ${IFNAME[$1]} - for BRIF in $(echo ${BRNICS[$1]}); do - /sbin/ifconfig $BRIF down - /sbin/ifconfig $BRIF 0.0.0.0 promisc up - /sbin/brctl addif ${IFNAME[$1]} $BRIF + /sbin/ip link add name ${IFNAME[$1]} type bridge + for BRIF in ${BRNICS[$1]}; do + /sbin/ip link set dev $BRIF down + /sbin/ip address add 0.0.0.0 dev $BRIF + /sbin/ip link set dev $BRIF master ${IFNAME[$1]} + /sbin/ip link set dev $BRIF up done + /sbin/ip link set dev ${IFNAME[$1]} up } # Function to disassemble a bridge interface. br_close() { + /sbin/ip link set dev ${IFNAME[$1]} down # argument is 'i' - the position of this interface in the IFNAME array. - #for BRIF in $(echo ${BRNICS[$1]}); do + #for BRIF in ${BRNICS[$1]}; do for BRIF in $(ls --indicator-style=none /sys/class/net/${IFNAME[$1]}/brif/) do - /sbin/brctl delif ${IFNAME[$1]} $BRIF + /sbin/ip link set dev $BRIF nomaster done - /sbin/ifconfig ${IFNAME[$1]} down - /sbin/brctl delbr ${IFNAME[$1]} + /sbin/ip link set dev ${IFNAME[$1]} down + /sbin/ip link del ${IFNAME[$1]} } # Function to bring up a network interface. If the interface is @@ -105,26 +132,41 @@ if_up() { [ "${IFNAME[$i]}" = "${1}" ] && break 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 + # there are more interfaces configured than MAXNICS. Let's err on the + # side of caution and do nothing instead of possibly doing the wrong thing. + if [ $i -ge $MAXNICS ]; then + echo "/etc/rc.d/rc.inet1: skipping ${1}, you might need to increase MAXNICS" | $LOGGER + return + fi # If the interface is a bridge, then create it first: [ -n "${BRNICS[$i]}" ] && br_open $i # If the interface isn't in the kernel yet (but there's an alias for it in # modules.conf), then it should be loaded first: - if ! grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # no interface yet + if [ -z "${IPADDR[$i]}" ] && [ "${USE_DHCP[$i]}" != "yes" ]; then # skip unconfigured interfaces + debug_log "skipping ${1} early, interface is not configured in /etc/rc.d/rc.inet1.conf" + return 0 + fi + if [ ! -e /sys/class/net/${1%%:*} ]; then # no interface yet if /sbin/modprobe -c | grep -v "^#" | grep -w "alias ${1}" | grep -vw "alias ${1} off" > /dev/null ; then echo "/etc/rc.d/rc.inet1: /sbin/modprobe ${1}" | $LOGGER /sbin/modprobe ${1} fi fi - if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # interface exists - if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null || \ - ! /sbin/ifconfig ${1} | grep -w inet 1> /dev/null ; then # interface not up or not configured - if [ ! "${HWADDR[$i]}" = "" ]; then # Set hardware address _before_ the interface goes up: - echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}" | $LOGGER - /sbin/ifconfig ${1} hw ether ${HWADDR[$i]} + if [ -e /sys/class/net/${1%%:*} ]; then # interface exists + if ! /sbin/ip address show dev ${1} 2>/dev/null | grep -wq inet || \ + ! /sbin/ip link show dev ${1} | grep -wq "state UP" ; then # interface not up or not configured + if [ -n "${HWADDR[$i]}" ]; then # Set hardware address _before_ the interface goes up: + echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} address ${HWADDR[$i]}" | $LOGGER + /sbin/ip link set dev ${1} address ${HWADDR[$i]} + fi + if [ -n "${MTU[$i]}" ]; then # Set MTU to something else than 1500 + echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} mtu ${MTU[$i]}" | $LOGGER + /sbin/ip link set dev ${1} mtu ${MTU[$i]} fi - if [ ! "${MTU[$i]}" = "" ]; then # Set MTU to something else than 1500 - echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} mtu ${MTU[$i]}" | $LOGGER - /sbin/ifconfig ${1} mtu ${MTU[$i]} + if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then + /sbin/ip link set dev ${1} up # Bring up interface fi if [ -x /etc/rc.d/rc.wireless ]; then . /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters @@ -133,13 +175,13 @@ if_up() { # Clear DHCP_OPTIONS before adding new options to it: unset DHCP_OPTIONS # Set DHCP_OPTIONS for this interface: - [ ${DHCP_HOSTNAME[$i]} ] && DHCP_OPTIONS="-h ${DHCP_HOSTNAME[$i]}" + [ -n "${DHCP_HOSTNAME[$i]}" ] && DHCP_OPTIONS="-h ${DHCP_HOSTNAME[$i]}" [ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -C resolv.conf" [ "${DHCP_KEEPNTP[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -C ntp.conf" [ "${DHCP_KEEPGW[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -G" [ "${DHCP_DEBUG[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -d" [ "${DHCP_NOIPV4LL[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -L" - [ ${DHCP_IPADDR[$i]} ] && DHCP_OPTIONS="$DHCP_OPTIONS -r ${DHCP_IPADDR[$i]}" + [ -n "${DHCP_IPADDR[$i]}" ] && DHCP_OPTIONS="$DHCP_OPTIONS -r ${DHCP_IPADDR[$i]}" echo "Polling for DHCP server on interface ${1}:" # If you set a timeout, you get one, even if the kernel doesn't think that # your device is connected, in case /sys isn't right (which it usually isn't @@ -147,43 +189,54 @@ if_up() { #### (start commented out) # This is deactivated for now since the kernel has been returning incorrect # results concerning whether the interface carrier is detected. - #if [ "${DHCP_TIMEOUT[$i]}" = "" ]; then - # ifconfig ${1} up && sleep 1 + #if [ -z "${DHCP_TIMEOUT[$i]}" ]; then + # /sbin/ip link set dev ${1} up && sleep 1 # CONNSTATUS="$(cat /sys/class/net/${1}/carrier 2> /dev/null)" - # ifconfig ${1} down + # /sbin/ip link set dev ${1} down # if [ "$CONNSTATUS" = "0" ]; then # # The kernel has just told us the cable isn't even plugged in, but we will # # give any DHCP server a short chance to reply anyway: - # echo "No carrier detected on ${1}. Reducing DHCP timeout to 10 seconds." - # DHCP_TIMEOUT[$i]=10 + # echo "No carrier detected on ${1}. Reducing DHCP timeout to 15 seconds." + # DHCP_TIMEOUT[$i]=15 # fi #fi #### (end commented out) - # 10 seconds should be a reasonable default DHCP timeout. 30 was too much. - echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}" | $LOGGER - /sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1} + # 15 seconds should be a reasonable default DHCP timeout. 30 was too much. + echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}" | $LOGGER + /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1} + # If the dhcpcd call succeeds, add extra IP addresses, if defined, to interface + if [ "$?" == "0" ] && [ -n "${IPALIASES[$i]}" ]; then + num=0 + for ipalias in ${IPALIASES[$i]}; do + /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; + num=$(($num + 1)) + done + fi else # bring up interface using a static IP address - if [ ! "${IPADDR[$i]}" = "" ]; then # skip unconfigured interfaces - # Determine broadcast address from the IP address and netmask: - BROADCAST[$i]=`/bin/ipmask ${NETMASK[$i]} ${IPADDR[$i]}|cut -f1 -d' '` + if [ -n "${IPADDR[$i]}" ]; then # skip unconfigured interfaces # Set up the network card: - echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER - /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]} - else - if [ "$DEBUG_ETH_UP" = "yes" ]; then - echo "/etc/rc.d/rc.inet1: ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER + echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}" | $LOGGER + /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1} + if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then + /sbin/ip link set dev ${1} up # Bring up interface fi + # Add extra IP addresses, if defined, to interface + if [ -n "${IPALIASES[$i]}" ]; then + num=0 + for ipalias in ${IPALIASES[$i]}; do + /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; + num=$(($num + 1)) + done + fi + else + debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf" fi fi else - if [ "$DEBUG_ETH_UP" = "yes" ]; then - echo "/etc/rc.d/rc.inet1: ${1} is already up, skipping" | $LOGGER - fi + debug_log "${1} is already up, skipping" fi else - if [ "$DEBUG_ETH_UP" = "yes" ]; then - echo "/etc/rc.d/rc.inet1: ${1} interface does not exist (yet)" | $LOGGER - fi + debug_log "${1} interface does not exist (yet)" fi } @@ -195,14 +248,18 @@ if_down() { [ "${IFNAME[$i]}" = "${1}" ] && break i=$(($i+1)) done - if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then + if [ $i -ge $MAXNICS ]; then + echo "/etc/rc.d/rc.inet1: skipping ${1}, you might need to increase MAXNICS" | $LOGGER + return + fi + if [ -e /sys/class/net/${1%%:*} ]; then if [ "${USE_DHCP[$i]}" = "yes" ]; then echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -k -d ${1}" | $LOGGER - /sbin/dhcpcd -k -d ${1} 2> /dev/null || /sbin/ifconfig ${1} down + /sbin/dhcpcd -k -d ${1} 2> /dev/null || /sbin/ip link set dev ${1} down sleep 1 else - echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} down" | $LOGGER - /sbin/ifconfig ${1} down + echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} down" | $LOGGER + /sbin/ip link set dev ${1} down fi if [ -x /etc/rc.d/rc.wireless ]; then . /etc/rc.d/rc.wireless ${1} stop # Kill wireless daemons if any. @@ -220,26 +277,27 @@ if_down() { # Function to bring up the gateway if there is not yet a default route: gateway_up() { - if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then - if [ ! "$GATEWAY" = "" ]; then - echo "/etc/rc.d/rc.inet1: /sbin/route add default gw ${GATEWAY} metric 1" | $LOGGER - /sbin/route add default gw ${GATEWAY} metric 1 2>&1 | $LOGGER + if ! /sbin/ip route show | grep -wq default ; then + if [ -n "$GATEWAY" ]; then + echo "/etc/rc.d/rc.inet1: /sbin/ip route add default via ${GATEWAY}" | $LOGGER + /sbin/ip route add default via ${GATEWAY} | $LOGGER fi fi } # Function to take down an existing default gateway: gateway_down() { - if /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then - echo "/etc/rc.d/rc.inet1: /sbin/route del default" | $LOGGER - /sbin/route del default + if /sbin/ip route show | grep -wq default ; then + echo "/etc/rc.d/rc.inet1: /sbin/ip route del default" | $LOGGER + /sbin/ip route del default fi } # Function to start the network: start() { lo_up - for i in ${IFNAME[@]} ; do + virtif_create + for i in "${IFNAME[@]}" ; do if_up $i done gateway_up @@ -248,9 +306,10 @@ start() { # Function to stop the network: stop() { gateway_down - for i in ${IFNAME[@]} ; do + for i in "${IFNAME[@]}" ; do if_down $i done + virtif_destroy lo_down } @@ -260,59 +319,38 @@ stop() { ############ case "$1" in -'start') # "start" brings up all configured interfaces: +start|up) # "start" (or "up") brings up all configured interfaces: start ;; -'stop') # "stop" takes down all configured interfaces: +stop|down) # "stop" (or "down") takes down all configured interfaces: stop ;; -'restart') # "restart" restarts the network: +restart) # "restart" restarts the network: stop start ;; -'lo_start') # Start the loopback interface: +lo_start|lo_up) # Start the loopback interface: lo_up ;; -*_start) # Example: "eth1_start" will start the specified interface 'eth1' - INTERFACE=`echo $1 | /bin/cut -d '_' -f 1` +lo_stop|lo_down) # Stop the loopback interface: + lo_down + ;; +*_start|*_up) # Example: "eth1_start" (or "eth1_up") will start the specified interface 'eth1' + INTERFACE=$(echo $1 | /bin/cut -d '_' -f 1) if_up $INTERFACE gateway_up ;; -'lo_stop') # Stop the loopback interface: - lo_down - ;; -*_stop) # Example: "eth0_stop" will stop the specified interface 'eth0' - INTERFACE=`echo $1 | /bin/cut -d '_' -f 1` +*_stop|*_down) # Example: "eth0_stop" (or "eth0_down") will stop the specified interface 'eth0' + INTERFACE=$(echo $1 | /bin/cut -d '_' -f 1) if_down $INTERFACE ;; *_restart) # Example: "wlan0_restart" will take 'wlan0' down and up again - INTERFACE=`echo $1 | /bin/cut -d '_' -f 1` + INTERFACE=$(echo $1 | /bin/cut -d '_' -f 1) if_down $INTERFACE sleep 1 if_up $INTERFACE gateway_up ;; -'up') # "up" does the same thing as "start" - start - ;; -'down') # "down" does the same thing as "stop" - stop - ;; -'lo_up') # Start the loopback interface: - lo_up - ;; -*_up) # "*_up" does the same thing as "*_start" - INTERFACE=`echo $1 | /bin/cut -d '_' -f 1` - if_up $INTERFACE - gateway_up - ;; -'lo_down') # Stop the loopback interface: - lo_down - ;; -*_down) # "*_down" does the same thing as "*_stop" - INTERFACE=`echo $1 | /bin/cut -d '_' -f 1` - if_down $INTERFACE - ;; *) # The default is to bring up all configured interfaces: start esac diff --git a/source/n/network-scripts/scripts/rc.inet1.conf b/source/n/network-scripts/scripts/rc.inet1.conf index 85a8041b..58766d25 100644 --- a/source/n/network-scripts/scripts/rc.inet1.conf +++ b/source/n/network-scripts/scripts/rc.inet1.conf @@ -16,24 +16,28 @@ # Config information for eth0: IPADDR[0]="" NETMASK[0]="" +IPALIASES[0]="" USE_DHCP[0]="" DHCP_HOSTNAME[0]="" # Config information for eth1: IPADDR[1]="" NETMASK[1]="" +IPALIASES[1]="" USE_DHCP[1]="" DHCP_HOSTNAME[1]="" # Config information for eth2: IPADDR[2]="" NETMASK[2]="" +IPALIASES[2]="" USE_DHCP[2]="" DHCP_HOSTNAME[2]="" # Config information for eth3: IPADDR[3]="" NETMASK[3]="" +IPALIASES[3]="" USE_DHCP[3]="" DHCP_HOSTNAME[3]="" @@ -47,14 +51,34 @@ DEBUG_ETH_UP="no" # Example of how to configure a bridge: # Note the added "BRNICS" variable which contains a space-separated list -# of the physical network interfaces you want to add to the bridge. +# of the physical or virtual network interfaces you want to add to the bridge. #IFNAME[0]="br0" #BRNICS[0]="eth0" #IPADDR[0]="192.168.0.1" #NETMASK[0]="255.255.255.0" +#IPALIASES[0]="" #USE_DHCP[0]="" #DHCP_HOSTNAME[0]="" +# Virtual interfaces to create - these are created before any address +# configuration or bridge setup is done, so you may use these interfaces +# as IFNAME or BRNICS values. These can be tun or tap interfaces: +# adjust VIRTIFNAME and VIRTIFTYPE accordingly. +# Starting with VIRTIFNAME[0] is mandatory, and each next one must be +# incremented by one, so VIRTIFNAME[1], VIRTIFNAME[2], and so on. +# +# Virtual tap interface example +#VIRTIFNAME[0]="tap0" +#VIRTIFTYPE[0]="tap" +#VIRTIFUSER[0]="root" +#VIRTIFGROUP[0]="root" +# +# Virtual tun interface example +#VIRTIFNAME[1]="tun0" +#VIRTIFTYPE[1]="tun" +#VIRTIFUSER[1]="someuser" +#VIRTIFGROUP[1]="somegroup" + ## Example config information for wlan0. Uncomment the lines you need and fill ## in your data. (You may not need all of these for your wireless network) #IFNAME[4]="wlan0" @@ -85,7 +109,7 @@ DEBUG_ETH_UP="no" #MTU[4]="" # The default MTU is 1500, but you might need # 1360 when you use NAT'ed IPSec traffic. #DHCP_TIMEOUT[4]=15 # The default timeout for the DHCP client to - # wait for server resonse is 10 seconds, but + # 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 #DHCP_KEEPNTP[4]="yes" # If you don't want ntp.conf overwritten diff --git a/source/n/network-scripts/scripts/rc.inet2 b/source/n/network-scripts/scripts/rc.inet2 index 4f51a330..300ede3e 100644 --- a/source/n/network-scripts/scripts/rc.inet2 +++ b/source/n/network-scripts/scripts/rc.inet2 @@ -101,6 +101,11 @@ if [ -x /etc/rc.d/rc.yp ]; then /etc/rc.d/rc.yp start fi +# Start OpenVPN: +if [ -x /etc/rc.d/rc.openvpn ]; then + /etc/rc.d/rc.openvpn start +fi + # Start the NFS server. Note that for this to work correctly, you'll # need nfsd support in the kernel (the startup script will try to load # the module for you). diff --git a/source/n/network-scripts/slack-desc b/source/n/network-scripts/slack-desc index f30ebbf9..981b4360 100644 --- a/source/n/network-scripts/slack-desc +++ b/source/n/network-scripts/slack-desc @@ -1,15 +1,15 @@ # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line +# The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must -# make exactly 11 lines for the formatting to be correct. It's also +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. |-----handy-ruler------------------------------------------------------| network-scripts: network-scripts (Scripts to configure a network) network-scripts: network-scripts: These are the basic scripts and files used to define a network and -network-scripts: configure network interfaces on Linux. Most of the original +network-scripts: configure network interfaces on Linux. Most of the original network-scripts: /etc files were written by Fred N. van Kempen, or borrowed from BSD. network-scripts: The rc.inet1 and rc.inet2 scripts were mostly written by Patrick network-scripts: Volkerding, with suggestions and fixes from hundreds of contributors |