diff options
Diffstat (limited to '')
-rw-r--r-- | source/n/network-scripts/scripts/HOSTNAME | 1 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/host.conf | 2 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/hosts | 19 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/hosts.allow | 12 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/hosts.deny | 12 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/hosts.equiv | 14 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/netconfig | 632 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/networks | 10 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/nntpserver | 1 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/protocols | 146 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet1 | 276 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet1.conf | 107 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet2 | 137 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.ip_forward | 78 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/resolv.conf | 1 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/setup.netconfig | 13 |
16 files changed, 1461 insertions, 0 deletions
diff --git a/source/n/network-scripts/scripts/HOSTNAME b/source/n/network-scripts/scripts/HOSTNAME new file mode 100644 index 000000000..409452f78 --- /dev/null +++ b/source/n/network-scripts/scripts/HOSTNAME @@ -0,0 +1 @@ +darkstar.example.net diff --git a/source/n/network-scripts/scripts/host.conf b/source/n/network-scripts/scripts/host.conf new file mode 100644 index 000000000..a659e913a --- /dev/null +++ b/source/n/network-scripts/scripts/host.conf @@ -0,0 +1,2 @@ +order hosts, bind +multi on diff --git a/source/n/network-scripts/scripts/hosts b/source/n/network-scripts/scripts/hosts new file mode 100644 index 000000000..2c26f958b --- /dev/null +++ b/source/n/network-scripts/scripts/hosts @@ -0,0 +1,19 @@ +# +# hosts This file describes a number of hostname-to-address +# 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 +# for some (stupid) programs, irc and reputedly talk. :^) +# + +# For loopbacking. +127.0.0.1 localhost +127.0.0.1 darkstar.example.net darkstar + +# End of hosts. + diff --git a/source/n/network-scripts/scripts/hosts.allow b/source/n/network-scripts/scripts/hosts.allow new file mode 100644 index 000000000..d375b5f82 --- /dev/null +++ b/source/n/network-scripts/scripts/hosts.allow @@ -0,0 +1,12 @@ +# +# hosts.allow This file describes the names of the hosts which are +# allowed to use the local INET services, as decided by +# the '/usr/sbin/tcpd' server. +# +# Version: @(#)/etc/hosts.allow 1.00 05/28/93 +# +# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org +# +# + +# End of hosts.allow. diff --git a/source/n/network-scripts/scripts/hosts.deny b/source/n/network-scripts/scripts/hosts.deny new file mode 100644 index 000000000..c0db7e913 --- /dev/null +++ b/source/n/network-scripts/scripts/hosts.deny @@ -0,0 +1,12 @@ +# +# hosts.deny This file describes the names of the hosts which are +# *not* allowed to use the local INET services, as decided +# by the '/usr/sbin/tcpd' server. +# +# Version: @(#)/etc/hosts.deny 1.00 05/28/93 +# +# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org +# +# + +# End of hosts.deny. diff --git a/source/n/network-scripts/scripts/hosts.equiv b/source/n/network-scripts/scripts/hosts.equiv new file mode 100644 index 000000000..cb371ea39 --- /dev/null +++ b/source/n/network-scripts/scripts/hosts.equiv @@ -0,0 +1,14 @@ +# +# hosts.equiv This file describes the names of the hosts which are +# to be considered "equivalent", i.e. which are to be +# trusted enought for allowing rsh(1) commands. +# +# Version: @(#)/etc/hosts.equiv 2.00 04/30/93 +# +# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> +# +# + +localhost + +# End of hosts.equiv. diff --git a/source/n/network-scripts/scripts/netconfig b/source/n/network-scripts/scripts/netconfig new file mode 100644 index 000000000..04afd698e --- /dev/null +++ b/source/n/network-scripts/scripts/netconfig @@ -0,0 +1,632 @@ +#!/bin/sh +# 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> + +write_config_files() { +# +############################################################################ +# The rc.inet1.conf file. +############################################################################ +# + +# 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 +if [ "$RCIPCOPY" = "127.0.0.1" ]; then + RCIPCOPY="" + RCMASKCOPY="" +fi + +# echo "Creating /$RC..." +/bin/cat << ENDFILE > $RC +# /etc/rc.d/rc.inet1.conf +# +# This file contains the configuration settings for network interfaces. +# If USE_DHCP[interface] is set to "yes", this overrides any other settings. +# If you don't have an interface, leave the settings null (""). + +# You can configure network interfaces other than eth0,eth1... by setting +# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset +# or empty, it is assumed you're configuring eth<interface>. + +# Several other parameters are available, the end of this file contains a +# comprehensive set of examples. + +# ============================================================================= + +# Config information for eth0: +IPADDR[0]="$RCIPCOPY" +NETMASK[0]="$RCMASKCOPY" +USE_DHCP[0]="$USE_DHCP" +DHCP_HOSTNAME[0]="$DHCP_HOSTNAME" + +# Config information for eth1: +IPADDR[1]="" +NETMASK[1]="" +USE_DHCP[1]="" +DHCP_HOSTNAME[1]="" + +# Config information for eth2: +IPADDR[2]="" +NETMASK[2]="" +USE_DHCP[2]="" +DHCP_HOSTNAME[2]="" + +# Config information for eth3: +IPADDR[3]="" +NETMASK[3]="" +USE_DHCP[3]="" +DHCP_HOSTNAME[3]="" + +# Default gateway IP address: +GATEWAY="$GATEWAY" + +# 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" + +## 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) +#IFNAME[4]="wlan0" +#IPADDR[4]="" +#NETMASK[4]="" +#USE_DHCP[4]="yes" +#DHCP_HOSTNAME[4]="icculus-wireless" +#DHCP_KEEPRESOLV[4]="yes" +#DHCP_KEEPNTP[4]="yes" +#DHCP_KEEPGW[4]="yes" +#DHCP_IPADDR[4]="" +#WLAN_ESSID[4]=BARRIER05 +#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_WPA[4]="wpa_supplicant" +#WLAN_WPADRIVER[4]="ndiswrapper" + +## Some examples of additional network parameters that you can use. +## Config information for wlan0: +#IFNAME[4]="wlan0" # Use a different interface name nstead of + # the default 'eth4' +#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_KEEPRESOLV[4]="yes" # If you dont 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. +#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). +ENDFILE +# +############################################################################ +# The networks file. +############################################################################ +# +#echo "Creating /$ETCNETWORKS..." +/bin/cat <<EOF >$ETCNETWORKS +# +# networks This file describes a number of netname-to-address +# mappings for the TCP/IP subsystem. It is mostly +# used at boot time, when no name servers are running. +# + +loopback 127.0.0.0 +localnet $NETWORK + +# End of networks. +EOF +chmod 644 $ETCNETWORKS +# +############################################################################ +# The hosts file. +############################################################################ +# +#echo "Creating /$HOSTS..." +/bin/cat << EOF > $HOSTS +# +# hosts This file describes a number of hostname-to-address +# 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 +# for some (stupid) programs, irc and reputedly talk. :^) +# + +# For loopbacking. +127.0.0.1 localhost +$IPADDR $HOSTNM.$DOMAIN $HOSTNM + +# End of hosts. + +EOF +chmod 644 $HOSTS +# +############################################################################ +# The resolv.conf file. +############################################################################ +# +if [ ! "$NAMESERVER" = "" ]; then + echo "search $DOMAIN" >$RESOLV + echo "nameserver $NAMESERVER" >>$RESOLV +else + echo "search $DOMAIN" >$RESOLV +fi +if [ -f $RESOLV ]; then + chmod 644 $RESOLV +fi +# +############################################################################ +# The rc.netdevice file. +############################################################################ +# +if [ -r /cardfound ]; then + if [ ! "`cat /cardfound`" = "" ]; then + cat << EOF > etc/rc.d/rc.netdevice +# Load module for network device. +# This script is automatically generated during the installation. + +/sbin/modprobe `cat /cardfound` + +EOF + chmod 755 etc/rc.d/rc.netdevice + fi +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 + +# This checks IP address syntax. +# usage: syntax_check ADDRESS #-OF-EXPECTED-SEGMENTS (up to 4) +# example: syntax_check 123.22.43.1 4 +# returns: 0=found correct 1=too many fields 2=non numeric field found +syntax_check_color() { + RET_CODE=0 + SCRATCH=$1 + SCRATCH=`echo $SCRATCH | tr "." "/"` + INDEX=$2 + while [ ! "$INDEX" = "0" ]; do + # OK, so I'm a LISP-head :^) + FIELD=`basename $SCRATCH` + SCRATCH=`dirname $SCRATCH` + if expr $FIELD + 1 1> /dev/null 2> /dev/null; then + true + else + RET_CODE=2; # non-numeric field + fi + INDEX=`expr $INDEX - 1` + done + if [ ! "$SCRATCH" = "." ]; then + RET_CODE=1; # too many arguments + fi + if [ "$3" = "WARN" -a ! "$RET_CODE" = "0" ]; then + cat << EOF > $TMP/tempmsg + +The address you have entered seems to be non-standard. We were expecting +$2 groups of numbers seperated by dots, like: 127.0.0.1 +Are you absolutely sure you want to use the address $1? + +EOF + dialog --title "WARNING" --yesno "`cat $TMP/tempmsg`" 9 72 + if [ $? = 0 ]; then + RET_CODE = 0; + fi + rm -r $TMP/tempmsg + else + if [ "$3" = "ECHO" ]; then + echo $RET_CODE; + fi + fi + return $RET_CODE; +} + +# Figure out where we are... cheap hack. +if [ ! -e etc/slackware-version -a ! -e /etc/installer -a ! -e bin/bash ]; then + cd / +fi; + +# IMPORTANT!!! NO LEADING '/' in the paths below, or this script will not +# function from the bootdisk. +RC=etc/rc.d/rc.inet1.conf # Where rc.inet1.conf file is. +RESOLV=etc/resolv.conf # Where resolv.conf file is. +HOSTS=etc/hosts # Where hosts file is. +ETCNETWORKS=etc/networks # Where networks file is. +USE_DHCP="" # Use DHCP? "" == no. +DHCP_HOSTNAME="" # This is our DHCP hostname. +# +# defaults: +NETWORK=127.0.0.0 +IPADDR=127.0.0.1 +NETMASK=255.255.255.0 + + +# Main loop: +while [ 0 ]; do +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) + +Enter hostname: +EOF + dialog --title "ENTER HOSTNAME" --inputbox "`cat $TMP/tempmsg`" 11 65 \ + $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 + if [ ! "$HOSTNM" = "" ]; then + break; + fi +done + +while [ 0 ]; do +cat << EOF > $TMP/tempmsg +Now, we need the domain name for this machine, such as: + +example.org + +Do not supply a leading '.' + +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 + rm -f $TMP/SeTdom $TMP/tempmsg + exit + fi + DOMAIN="`cat $TMP/SeTdom`" + rm -f $TMP/SeTdom $TMP/tempmsg + if [ ! "$DOMAIN" = "" ]; then + break; + fi +done + +echo $HOSTNM.$DOMAIN > etc/HOSTNAME + +dialog --title "SETUP IP ADDRESS FOR '$HOSTNM.$DOMAIN'" \ +--default-item DHCP \ +--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 \ +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. 'loopback' is also the correct choice if your \ +only connection to the network will be through a serial modem \ +(with SLIP or PPP), or if you are using a laptop network card (these \ +are configured in /etc/pcmcia/). What type of network connection \ +best describes your machine?" 20 70 3 \ +"static IP" "Use a static IP address to configure ethernet" \ +"DHCP" "Use a DHCP server to configure ethernet" \ +"loopback" "Set up a loopback connection (modem or no net)" 2> $TMP/reply +if [ $? = 1 -o $? = 255 ]; then + rm -f $TMP/reply + exit +fi +REPLY=`cat $TMP/reply` +rm -f $TMP/reply + +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 \ +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`" + rm -f $TMP/SeTDHCPHOST + # OK, if we actually got something, use it. + DHCP_HOSTNAME="$NEW_DHCPHOST" +elif [ "$REPLY" = "loopback" ]; then + LOOPBACK="yes" +else + LOOPBACK="no" +fi + +if [ "$LOOPBACK" = "no" -a ! "$USE_DHCP" = "yes" ]; then + + while [ 0 ]; do + if [ -r $TMP/SeTIP ]; then + IPADDR=`cat $TMP/SeTIP` + fi + cat << EOF > $TMP/tempmsg +Enter your IP address for the local machine. Example: +111.112.113.114 +Enter IP address for $HOSTNM (aaa.bbb.ccc.ddd): +EOF + dialog --title "ENTER IP ADDRESS FOR '$HOSTNM.$DOMAIN'" --inputbox \ +"`cat $TMP/tempmsg`" \ +10 68 $IPADDR 2> $TMP/SeTlip + if [ $? = 1 -o $? = 255 ]; then + rm -f $TMP/SeTlip $TMP/tempmsg + exit + fi + IPADDR="`cat $TMP/SeTlip`" + rm -f $TMP/SeTlip $TMP/tempmsg + if [ "$IPADDR" = "" ]; then + continue; + fi + syntax_check_color $IPADDR 4 WARN + if [ $? = 0 ]; then + echo $IPADDR > $TMP/SeTIP + break; + fi + done + + while [ 0 ]; do + if [ -r $TMP/SeTnetmask ]; then + NETMASK=`cat $TMP/SeTnetmask` + fi + cat << EOF > $TMP/tempmsg +Enter your netmask. This will generally look something +like this: 255.255.255.0 +Enter netmask (aaa.bbb.ccc.ddd): +EOF + dialog --title "ENTER NETMASK FOR LOCAL NETWORK" --inputbox \ +"`cat $TMP/tempmsg`" \ +10 65 $NETMASK 2> $TMP/SeTnmask + if [ $? = 1 -o $? = 255 ]; then + rm -f $TMP/SeTnmask $TMP/tempmsg + exit + fi + NETMASK="`cat $TMP/SeTnmask`" + rm -f $TMP/SeTnmask $TMP/tempmsg + if [ "$NETMASK" = "" ]; then + continue; + fi + syntax_check_color $NETMASK 4 WARN + if [ $? = 0 ]; then + echo $NETMASK > $TMP/SeTnetmask + break; + fi + done + + # Set broadcast/network addresses automatically: + BROADCAST=`ipmask $NETMASK $IPADDR | cut -f 1 -d ' '` + NETWORK=`ipmask $NETMASK $IPADDR | cut -f 2 -d ' '` + + while [ 0 ]; do + if [ -r $TMP/SeTgateway ]; then + GATEWAY=`cat $TMP/SeTgateway` + fi + cat << EOF > $TMP/tempmsg +Enter the address for the gateway on your network, such as: +`echo $IPADDR | cut -f 1-3 -d .`.1 + +If you don't have a gateway on your network just hit ENTER +without entering a gateway IP address. + +Enter gateway address (aaa.bbb.ccc.ddd): +EOF + dialog --title "ENTER GATEWAY ADDRESS" --inputbox "`cat $TMP/tempmsg`" \ + 14 64 $GATEWAY 2> $TMP/SeTgate + if [ $? = 1 -o $? = 255 ]; then + rm -f $TMP/SeTgate $TMP/tempmsg + exit + fi + GATEWAY="`cat $TMP/SeTgate`" + rm -f $TMP/SeTgate $TMP/tempmsg + if [ "$GATEWAY" = "" ]; then + echo > $TMP/SeTgateway + break; + fi + syntax_check_color $GATEWAY 4 WARN + if [ $? = 0 ]; then + echo $GATEWAY > $TMP/SeTgateway + break; + fi + done +fi + +if [ "$LOOPBACK" = "no" ]; then + dialog --title "USE A NAMESERVER?" --yesno "Will you be accessing a \ +nameserver?" 5 42 + if [ $? = 0 ]; then + if [ ! "`cat $TMP/SeTns 2> /dev/null`" = "" ]; then + DNSSAMPLE="`cat $TMP/SeTns 2> /dev/null`" + elif [ "$GATEWAY" = "" ]; then + DNSSAMPLE=`echo $IPADDR | cut -f 1-3 -d .` + else + DNSSAMPLE=$GATEWAY + fi + while [ "$NAMESERVER" = "" ]; do + cat << EOF > $TMP/tempmsg +Here is your current IP address, full hostname, and base hostname: +$IPADDR $HOSTNM.$DOMAIN $HOSTNM + +Please give the IP address of the name server to use, +such as $DNSSAMPLE. + +You can add more Domain Name Servers later by editing /$RESOLV. + +Primary name server to use (aaa.bbb.ccc.ddd): +EOF + dialog --title "SELECT NAMESERVER" --inputbox \ +"`cat $TMP/tempmsg`" 17 72 $DNSSAMPLE 2> $TMP/SeTns + if [ $? = 1 -o $? = 255 ]; then + rm -f $TMP/tempmsg $TMP/SeTns + break + fi + NAMESERVER="`cat $TMP/SeTns`" + rm -f $TMP/tempmsg $TMP/SeTns + done + fi +fi + +# Check for existing network driver: +unset DONOTPROBE +if cat /proc/net/dev | grep eth0 1> /dev/null 2> /dev/null ; then + DONOTPROBE=true +fi + +# Really, this rc.netdevice thing is mostly obsolete except for +# handmade local scripts anyway, these days with udev... +# So, we'll skip it: +DONOTPROBE=true + +if [ -d lib/modules/`uname -r` \ + -a ! "$LOOPBACK" = "yes" \ + -a ! -x etc/rc.d/rc.hotplug \ + -a ! "$DONOTPROBE" = "true" \ + -a ! -r /cardfound ]; then + 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 \ +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 \ +"probe" "look for network cards to set up" \ +"skip" "skip probe; edit /etc/rc.d/rc.modules later" 2> $TMP/reply + if [ $? = 1 -o $? = 255 ]; then + rm -f $TMP/reply + exit + fi + REPLY=`cat $TMP/reply` + rm -f $TMP/reply + if [ ! "$REPLY" = "skip" ]; then + for card in 3c59x 82596 dgrs eepro100 e1000 epic100 hp100 lance \ + ne2k-pci olympic pcnet32 rcpci 8139too 8139cp tlan tulip via-rhine \ + yellowfin natsemi ; do + chroot . /sbin/modprobe $card 2> /dev/null + if [ $? = 0 ]; then + dialog --title "CARD DETECTED" --msgbox "A networking card using \ +the $card.o module has been detected." 5 72 + echo "$card" > /cardfound + break; + fi + done + if [ ! -r /cardfound ]; then + # Don't probe for com20020, because it doesn't check and will always load. + # Don't probe for arlan, because it needs irq= to work. + # Don't probe for com90io or com90xx because they taint the kernel. + for card in depca ibmtr 3c359 3c501 3c503 3c505 3c507 3c509 3c515 ac3200 \ + abyss acenic at1700 cosa cs89x0 de4x5 de600 \ + de620 dmfe dl2k e2100 eepro eexpress eth16i ewrk3 fealnx hamachi hostess_sv11 \ + hp-plus hp lanstreamer ni5010 ni52 ni65 ns83820 sb1000 sealevel sis900 sk98lin skfp smc-ultra \ + smc9194 smctr starfire sungem sunhme tg3 wd e100 iph5526 lp486e tmspci winbond-840 ; do + chroot . /sbin/modprobe $card 2> /dev/null + if [ $? = 0 ]; then + dialog --title "CARD DETECTED" --msgbox "A networking card using \ +the $card.o module has been detected." 5 72 + echo "$card" > /cardfound + break + fi + done + 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) \ +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 + fi + fi +fi + +if [ "$LOOPBACK" = "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 + +Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 0 0 + RETVAL=$? +elif [ "$USE_DHCP" = "" ]; then + while [ 0 ]; do + dialog --title "CONFIRM NETWORK SETUP" \ +--ok-label Accept \ +--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 \ +can do that now (or reconfigure later using 'netconfig')." \ +22 60 12 \ +"Hostname:" "$HOSTNM" \ +"Domain name:" "$DOMAIN" \ +"IP address:" "$IPADDR" \ +"Netmask:" "$NETMASK" \ +"Gateway:" "$GATEWAY" \ +"Nameserver:" "$NAMESERVER" 2> $TMP/tempmsg + RETVAL=$? + if [ "$RETVAL" = "3" ]; then + FIELD=`cat $TMP/tempmsg | cut -f 1 -d : | cut -f 2- -d ' '` + NEWVAL=`cat $TMP/tempmsg | cut -f 2 -d : | cut -f 2- -d ' '` + if [ "$FIELD" = "Hostname" ]; then + HOSTNM=$NEWVAL + elif [ "$FIELD" = "Domain name" ]; then + DOMAIN=$NEWVAL + elif [ "$FIELD" = "IP address" ]; then + IPADDR=$NEWVAL + elif [ "$FIELD" = "Netmask" ]; then + NETMASK=$NEWVAL + elif [ "$FIELD" = "Gateway" ]; then + GATEWAY=$NEWVAL + elif [ "$FIELD" = "Nameserver" ]; then + NAMESERVER=$NEWVAL + fi + else + break + fi + done +else # DHCP was used + dialog --title "CONFIRM SETUP COMPLETE" \ +--yesno "Your networking system is now configured to use DHCP: + + Hostname: $HOSTNM + Domain name: $DOMAIN + IP address: (use DHCP server) + Netmask: (use DHCP server) + Gateway: (use DHCP server) + Nameserver: (use DHCP server) + +Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 0 0 + RETVAL=$? +fi + +if [ "$RETVAL" = "0" ]; then + echo $HOSTNM.$DOMAIN > etc/HOSTNAME + write_config_files + if [ "$1" = "" ]; then + 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 + fi +fi + +exit $RETVAL + diff --git a/source/n/network-scripts/scripts/networks b/source/n/network-scripts/scripts/networks new file mode 100644 index 000000000..50d5162ee --- /dev/null +++ b/source/n/network-scripts/scripts/networks @@ -0,0 +1,10 @@ +# +# networks This file describes a number of netname-to-address +# mappings for the TCP/IP subsystem. It is mostly +# used at boot time, when no name servers are running. +# + +loopback 127.0.0.0 +localnet 127.0.0.0 + +# End of networks. diff --git a/source/n/network-scripts/scripts/nntpserver b/source/n/network-scripts/scripts/nntpserver new file mode 100644 index 000000000..3fa9a61b1 --- /dev/null +++ b/source/n/network-scripts/scripts/nntpserver @@ -0,0 +1 @@ +news.my_news_server.com diff --git a/source/n/network-scripts/scripts/protocols b/source/n/network-scripts/scripts/protocols new file mode 100644 index 000000000..db3254c97 --- /dev/null +++ b/source/n/network-scripts/scripts/protocols @@ -0,0 +1,146 @@ +# +# Internet protocols +# +# $FreeBSD: src/etc/protocols,v 1.16 2002/02/10 08:19:58 dd Exp $ +# from: @(#)protocols 5.1 (Berkeley) 4/17/89 +# +# See also http://www.iana.org/assignments/protocol-numbers +# +ip 0 IP # internet protocol, pseudo protocol number +#hopopt 0 HOPOPT # hop-by-hop options for ipv6 +icmp 1 ICMP # internet control message protocol +igmp 2 IGMP # internet group management protocol +ggp 3 GGP # gateway-gateway protocol +ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') +st2 5 ST2 # ST2 datagram mode (RFC 1819) +tcp 6 TCP # transmission control protocol +cbt 7 CBT # CBT, Tony Ballardie <A.Ballardie@cs.ucl.ac.uk> +egp 8 EGP # exterior gateway protocol +igp 9 IGP # any private interior gateway (Cisco: for IGRP) +bbn-rcc 10 BBN-RCC-MON # BBN RCC Monitoring +nvp 11 NVP-II # Network Voice Protocol +pup 12 PUP # PARC universal packet protocol +argus 13 ARGUS # ARGUS +emcon 14 EMCON # EMCON +xnet 15 XNET # Cross Net Debugger +chaos 16 CHAOS # Chaos +udp 17 UDP # user datagram protocol +mux 18 MUX # Multiplexing protocol +dcn 19 DCN-MEAS # DCN Measurement Subsystems +hmp 20 HMP # host monitoring protocol +prm 21 PRM # packet radio measurement protocol +xns-idp 22 XNS-IDP # Xerox NS IDP +trunk-1 23 TRUNK-1 # Trunk-1 +trunk-2 24 TRUNK-2 # Trunk-2 +leaf-1 25 LEAF-1 # Leaf-1 +leaf-2 26 LEAF-2 # Leaf-2 +rdp 27 RDP # "reliable datagram" protocol +irtp 28 IRTP # Internet Reliable Transaction Protocol +iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4 +netblt 30 NETBLT # Bulk Data Transfer Protocol +mfe-nsp 31 MFE-NSP # MFE Network Services Protocol +merit-inp 32 MERIT-INP # MERIT Internodal Protocol +sep 33 SEP # Sequential Exchange Protocol +3pc 34 3PC # Third Party Connect Protocol +idpr 35 IDPR # Inter-Domain Policy Routing Protocol +xtp 36 XTP # Xpress Tranfer Protocol +ddp 37 DDP # Datagram Delivery Protocol +idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport Proto +tp++ 39 TP++ # TP++ Transport Protocol +il 40 IL # IL Transport Protocol +ipv6 41 IPV6 # ipv6 +sdrp 42 SDRP # Source Demand Routing Protocol +ipv6-route 43 IPV6-ROUTE # routing header for ipv6 +ipv6-frag 44 IPV6-FRAG # fragment header for ipv6 +idrp 45 IDRP # Inter-Domain Routing Protocol +rsvp 46 RSVP # Resource ReSerVation Protocol +gre 47 GRE # Generic Routing Encapsulation +mhrp 48 MHRP # Mobile Host Routing Protocol +bna 49 BNA # BNA +esp 50 ESP # encapsulating security payload +ah 51 AH # authentication header +i-nlsp 52 I-NLSP # Integrated Net Layer Security TUBA +swipe 53 SWIPE # IP with Encryption +narp 54 NARP # NBMA Address Resolution Protocol +mobile 55 MOBILE # IP Mobility +tlsp 56 TLSP # Transport Layer Security Protocol +skip 57 SKIP # SKIP +ipv6-icmp 58 IPV6-ICMP # ICMP for IPv6 +ipv6-nonxt 59 IPV6-NONXT # no next header for ipv6 +ipv6-opts 60 IPV6-OPTS # destination options for ipv6 +# 61 # any host internal protocol +cftp 62 CFTP # CFTP +# 63 # any local network +sat-expak 64 SAT-EXPAK # SATNET and Backroom EXPAK +kryptolan 65 KRYPTOLAN # Kryptolan +rvd 66 RVD # MIT Remote Virtual Disk Protocol +ippc 67 IPPC # Internet Pluribus Packet Core +# 68 # any distributed file system +sat-mon 69 SAT-MON # SATNET Monitoring +visa 70 VISA # VISA Protocol +ipcv 71 IPCV # Internet Packet Core Utility +cpnx 72 CPNX # Computer Protocol Network Executive +cphb 73 CPHB # Computer Protocol Heart Beat +wsn 74 WSN # Wang Span Network +pvp 75 PVP # Packet Video Protocol +br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring +sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary +wb-mon 78 WB-MON # WIDEBAND Monitoring +wb-expak 79 WB-EXPAK # WIDEBAND EXPAK +iso-ip 80 ISO-IP # ISO Internet Protocol +vmtp 81 VMTP # Versatile Message Transport +secure-vmtp 82 SECURE-VMTP # SECURE-VMTP +vines 83 VINES # VINES +ttp 84 TTP # TTP +nsfnet-igp 85 NSFNET-IGP # NSFNET-IGP +dgp 86 DGP # Dissimilar Gateway Protocol +tcf 87 TCF # TCF +eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco) +ospf 89 OSPFIGP # Open Shortest Path First IGP +sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol +larp 91 LARP # Locus Address Resolution Protocol +mtp 92 MTP # Multicast Transport Protocol +ax.25 93 AX.25 # AX.25 Frames +ipip 94 IPIP # Yet Another IP encapsulation +micp 95 MICP # Mobile Internetworking Control Pro. +scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro. +etherip 97 ETHERIP # Ethernet-within-IP Encapsulation +encap 98 ENCAP # Yet Another IP encapsulation +# 99 # any private encryption scheme +gmtp 100 GMTP # GMTP +ifmp 101 IFMP # Ipsilon Flow Management Protocol +pnni 102 PNNI # PNNI over IP +pim 103 PIM # Protocol Independent Multicast +aris 104 ARIS # ARIS +scps 105 SCPS # SCPS +qnx 106 QNX # QNX +a/n 107 A/N # Active Networks +ipcomp 108 IPComp # IP Payload Compression Protocol +snp 109 SNP # Sitara Networks Protocol +compaq-peer 110 Compaq-Peer # Compaq Peer Protocol +ipx-in-ip 111 IPX-in-IP # IPX in IP +vrrp 112 VRRP # Virtual Router Redundancy Protocol +pgm 113 PGM # PGM Reliable Transport Protocol +# 114 # any 0-hop protocol +l2tp 115 L2TP # Layer Two Tunneling Protocol +ddx 116 DDX # D-II Data Exchange +iatp 117 IATP # Interactive Agent Transfer Protocol +st 118 ST # Schedule Transfer +srp 119 SRP # SpectraLink Radio Protocol +uti 120 UTI # UTI +smp 121 SMP # Simple Message Protocol +sm 122 SM # SM +ptp 123 PTP # Performance Transparency Protocol +isis 124 ISIS # ISIS over IPv4 +fire 125 FIRE +crtp 126 CRTP # Combat Radio Transport Protocol +crudp 127 CRUDP # Combat Radio User Datagram +sscopmce 128 SSCOPMCE +iplt 129 IPLT +sps 130 SPS # Secure Packet Shield +pipe 131 PIPE # Private IP Encapsulation within IP +sctp 132 SCTP # Stream Control Transmission Protocol +fc 133 FC # Fibre Channel +# 134-254 # Unassigned +divert 254 DIVERT # Divert pseudo-protocol [non IANA] +# 255 # Reserved diff --git a/source/n/network-scripts/scripts/rc.inet1 b/source/n/network-scripts/scripts/rc.inet1 new file mode 100644 index 000000000..0080f7dac --- /dev/null +++ b/source/n/network-scripts/scripts/rc.inet1 @@ -0,0 +1,276 @@ +#! /bin/sh +# /etc/rc.d/rc.inet1 +# This script is used to bring up the various network interfaces. +# +# @(#)/etc/rc.d/rc.inet1 10.2 Sun Jul 24 12:45:56 PDT 2005 (pjv) + +############################ +# READ NETWORK CONFIG FILE # +############################ + +# Get the configuration information from /etc/rc.d/rc.inet1.conf: +. /etc/rc.d/rc.inet1.conf + +########### +# LOGGING # +########### + +# If possible, log events in /var/log/messages: +if [ -f /var/run/syslogd.pid -a -x /usr/bin/logger ]; then + LOGGER=/usr/bin/logger +else # output to stdout/stderr: + LOGGER=/bin/cat +fi + +############################ +# DETERMINE INTERFACE LIST # +############################ + +# Compose a list of interfaces from /etc/rc.d/rc.inet1.conf (with a maximum +# of 6 interfaces, but you can easily enlarge the interface limit +# - send me a picture of such a box :-). +# If a value for IFNAME[n] is not set, we assume it is an eth'n' interface. +# This way, the new script is compatible with older rc.inet1.conf files. +# The IFNAME array will be used to determine which interfaces to bring up/down. +MAXNICS=${MAXNICS:-6} +i=0 +while [ $i -lt $MAXNICS ]; +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 + +###################### +# LOOPBACK FUNCTIONS # +###################### + +# 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 + 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 + fi +} + +####################### +# INTERFACE FUNCTIONS # +####################### + +# Function to bring up a network interface. If the interface is +# already up or does not yet exist (perhaps because the kernel driver +# is not loaded yet), do nothing. +if_up() { + # Determine position 'i' of this interface in the IFNAME array: + i=0 + while [ $i -lt $MAXNICS ]; do + [ "${IFNAME[$i]}" = "${1}" ] && break + i=$(($i+1)) + done + # 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 /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 "inet addr" 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]} + 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]} + fi + if [ -x /etc/rc.d/rc.wireless ]; then + . /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters + fi + if [ "${USE_DHCP[$i]}" = "yes" ]; then # use DHCP to bring interface up + [ ${DHCP_HOSTNAME[$i]} ] && DHCP_OPTIONS="-h ${DHCP_HOSTNAME[$i]}" + [ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -R" + [ "${DHCP_KEEPNTP[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -N" + [ "${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 -s ${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 + # except right after the device is loaded, when it usually is): + #### (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 + # CONNSTATUS="$(cat /sys/class/net/${1}/carrier 2> /dev/null)" + # ifconfig ${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 + # 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} + 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' '` + # 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 + fi + fi + fi + else + if [ "$DEBUG_ETH_UP" = "yes" ]; then + echo "/etc/rc.d/rc.inet1: ${1} is already up, skipping" | $LOGGER + fi + fi + else + if [ "$DEBUG_ETH_UP" = "yes" ]; then + echo "/etc/rc.d/rc.inet1: ${1} interface does not exist (yet)" | $LOGGER + fi + fi +} + +# Function to take down a network interface: +if_down() { + # Determine position 'i' of this interface in the IFNAME array: + i=0 + while [ $i -lt $MAXNICS ]; do + [ "${IFNAME[$i]}" = "${1}" ] && break + i=$(($i+1)) + done + if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; 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 + sleep 1 + else + echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} down" | $LOGGER + /sbin/ifconfig ${1} down + fi + if [ -x /etc/rc.d/rc.wireless ]; then + . /etc/rc.d/rc.wireless ${1} stop # Kill wireless daemons if any. + fi + fi +} + +##################### +# GATEWAY FUNCTIONS # +##################### + +# 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 + 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 + fi +} + +# Function to start the network: +start() { + lo_up + for i in ${IFNAME[@]} ; do + if_up $i + done + gateway_up +} + +# Function to stop the network: +stop() { + gateway_down + for i in ${IFNAME[@]} ; do + if_down $i + done + lo_down +} + + +############ +### MAIN ### +############ + +case "$1" in +'start') # "start" brings up all configured interfaces: + start + ;; +'stop') # "stop" takes down all configured interfaces: + stop + ;; +'restart') # "restart" restarts the network: + stop + start + ;; +*_start) # Example: "eth1_start" will start the specified interface 'eth1' + INTERFACE=`echo $1 | /bin/cut -d '_' -f 1` + if_up $INTERFACE + gateway_up + ;; +*_stop) # Example: "eth0_stop" 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` + 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 + ;; +*_up) # "*_up" does the same thing as "*_start" + INTERFACE=`echo $1 | /bin/cut -d '_' -f 1` + if_up $INTERFACE + gateway_up + ;; +*_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 + +# End of /etc/rc.d/rc.inet1 diff --git a/source/n/network-scripts/scripts/rc.inet1.conf b/source/n/network-scripts/scripts/rc.inet1.conf new file mode 100644 index 000000000..555210c4b --- /dev/null +++ b/source/n/network-scripts/scripts/rc.inet1.conf @@ -0,0 +1,107 @@ +# /etc/rc.d/rc.inet1.conf +# +# This file contains the configuration settings for network interfaces. +# If USE_DHCP[interface] is set to "yes", this overrides any other settings. +# If you don't have an interface, leave the settings null (""). + +# You can configure network interfaces other than eth0,eth1... by setting +# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset +# or empty, it is assumed you're configuring eth<interface>. + +# Several other parameters are available, the end of this file contains a +# comprehensive set of examples. + +# ============================================================================= + +# Config information for eth0: +IPADDR[0]="" +NETMASK[0]="" +USE_DHCP[0]="" +DHCP_HOSTNAME[0]="" + +# Config information for eth1: +IPADDR[1]="" +NETMASK[1]="" +USE_DHCP[1]="" +DHCP_HOSTNAME[1]="" + +# Config information for eth2: +IPADDR[2]="" +NETMASK[2]="" +USE_DHCP[2]="" +DHCP_HOSTNAME[2]="" + +# Config information for eth3: +IPADDR[3]="" +NETMASK[3]="" +USE_DHCP[3]="" +DHCP_HOSTNAME[3]="" + +# Default gateway IP address: +GATEWAY="" + +# 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" + +## 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]="" +#USE_DHCP[4]="yes" +#DHCP_HOSTNAME[4]="icculus-wireless" +#DHCP_KEEPRESOLV[4]="yes" +#DHCP_KEEPNTP[4]="yes" +#DHCP_KEEPGW[4]="yes" +#DHCP_IPADDR[4]="" +#WLAN_ESSID[4]=DARKSTAR +#WLAN_MODE[4]=Managed +#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]="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 10 seconds, but + # you might want a shorter or longer wait. +#DHCP_KEEPRESOLV[4]="yes" # If you dont 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 +#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) diff --git a/source/n/network-scripts/scripts/rc.inet2 b/source/n/network-scripts/scripts/rc.inet2 new file mode 100644 index 000000000..232d93ecb --- /dev/null +++ b/source/n/network-scripts/scripts/rc.inet2 @@ -0,0 +1,137 @@ +#!/bin/sh +# +# rc.inet2 This shell script boots up the entire network system. +# Note, that when this script is used to also fire +# up any important remote NFS disks (like the /usr +# directory), care must be taken to actually +# have all the needed binaries online _now_ ... +# +# Uncomment or comment out sections depending on which +# services your site requires. +# +# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> +# Modified for Slackware by Patrick Volkerding <volkerdi@slackware.com> + + +# At this point, we are ready to talk to The World... + + +# Mount remote (NFS) filesystems: +if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then + # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS + # volumes defined in /etc/fstab since these will need to be running in order + # to mount them. If they are not running, attempting to mount an NFS + # partition will cause mount to hang, or at least result in unreliable + # operation. Keep this in mind if you plan to mount unlisted NFS + # partitions... + # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run + # whether it is set as executable or not. If you don't want to run it, + # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc. + if [ -r /etc/rc.d/rc.rpc ]; then + sh /etc/rc.d/rc.rpc start + fi + echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs" + /sbin/mount -a -t nfs # This may be our /usr runtime! + # Show the mounted volumes: + /sbin/mount -v -t nfs +fi + +# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd, +# and rpc.statd. This might be needed to mount NFS partitions that are not +# listed in /etc/fstab. Starting this twice won't hurt as the script will +# check if things are already running before trying to start them. +if [ -x /etc/rc.d/rc.rpc ]; then + sh /etc/rc.d/rc.rpc start +fi + +# Mount remote CIFS filesystems. Note that where possible, using CIFS is +# preferred over SMBFS. SMBFS is no longer actively maintained. +if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then + echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs" + /sbin/mount -a -t cifs + # Show the mounted volumes: + /sbin/mount -v -t cifs +fi + +# Mount remote SMB filesystems: +if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then + echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs" + /sbin/mount -a -t smbfs + # Show the mounted volumes: + /sbin/mount -v -t smbfs +fi + +# Start the system logger if it is not already running (maybe because /usr +# is on a network partition). +if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then + . /etc/rc.d/rc.syslog start +fi + +# If there is a firewall script, run it before enabling packet forwarding. +# See the HOWTOs on http://www.netfilter.org/ for documentation on +# setting up a firewall or NAT on Linux. In some cases this might need to +# be moved past the section below dealing with IP packet forwarding. +if [ -x /etc/rc.d/rc.firewall ]; then + /etc/rc.d/rc.firewall start +fi + +# Turn on IPv4 packet forwarding support. +if [ -x /etc/rc.d/rc.ip_forward ]; then + . /etc/rc.d/rc.ip_forward start +fi + +# Start the inetd server: +if [ -x /etc/rc.d/rc.inetd ]; then + /etc/rc.d/rc.inetd start +fi + +# Start the OpenSSH SSH daemon: +if [ -x /etc/rc.d/rc.sshd ]; then + echo "Starting OpenSSH SSH daemon: /usr/sbin/sshd" + /etc/rc.d/rc.sshd start +fi + +# Start the BIND name server daemon: +if [ -x /etc/rc.d/rc.bind ]; then + /etc/rc.d/rc.bind start +fi + +# Start NIS (the Network Information Service): +if [ -x /etc/rc.d/rc.yp ]; then + . /etc/rc.d/rc.yp 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). +# You'll also need to set up some shares in /etc/exports. +# Starting the NFS server: +if [ -x /etc/rc.d/rc.nfsd ]; then + /etc/rc.d/rc.nfsd start +fi + +# Stuff you won't need follows. ;-) + +# # Start the network routing daemon: +# if [ -x /usr/sbin/routed ]; then +# echo "Starting network routing daemon: /usr/sbin/routed" +# /usr/sbin/routed -g -s +# fi + +# # Start the system status server: +# if [ -x /usr/sbin/rwhod ]; then +# echo "Starting system status server: /usr/sbin/rwhod" +# /usr/sbin/rwhod +# fi + +# # Fire up the PC-NFS daemon(s). This is a primarily obsolete system, and may +# # not be very secure. It's not at all needed for normal NFS server support. +# # You probably should not run this. +# if [ -x /usr/sbin/rpc.pcnfsd ]; then +# echo "Starting PC-NFS daemons: /usr/sbin/rpc.pcnfsd /usr/sbin/rpc.bwnfsd" +# /usr/sbin/rpc.pcnfsd /var/spool/lpd +# fi +# if [ -x /usr/sbin/rpc.bwnfsd ]; then +# /usr/sbin/rpc.bwnfsd /var/spool/lpd +# fi + diff --git a/source/n/network-scripts/scripts/rc.ip_forward b/source/n/network-scripts/scripts/rc.ip_forward new file mode 100644 index 000000000..8940dc2cc --- /dev/null +++ b/source/n/network-scripts/scripts/rc.ip_forward @@ -0,0 +1,78 @@ +#!/bin/sh +# /etc/rc.d/rc.ip_forward: start/stop IP packet forwarding +# +# If you intend to run your Linux box as a router, i.e. as a +# computer that forwards and redistributes network packets, you +# will need to enable IP packet forwarding in your kernel. +# +# To activate IP packet forwarding at boot time, make this +# script executable: chmod 755 /etc/rc.d/rc.ip_forward +# +# To disable IP packet forwarding at boot time, make this +# script non-executable: chmod 644 /etc/rc.d/rc.ip_forward + +# Start IP packet forwarding: +ip_forward_start() { + if [ -f /proc/sys/net/ipv4/ip_forward ]; then + echo "Activating IPv4 packet forwarding." + echo 1 > /proc/sys/net/ipv4/ip_forward + # Changing /proc/sys/net/ipv4/ip_forward results in resetting all + # non-default ipv4 parameters for the interface as mentioned in + # /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we + # will reapply any ipv4 sysctl parameters now: + if [ -r /etc/sysctl.conf ]; then + /bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null + fi + fi + # When using IPv4 packet forwarding, you will also get the + # rp_filter, which automatically rejects incoming packets if the + # routing table entry for their source address doesn't match the + # network interface they're arriving on. This has security + # advantages because it prevents the so-called IP spoofing, + # however it can pose problems if you use asymmetric routing + # (packets from you to a host take a different path than packets + # from that host to you) or if you operate a non-routing host + # which has several IP addresses on different interfaces. To + # turn rp_filter off, uncomment the lines below: + #if [ -r /proc/sys/net/ipv4/conf/all/rp_filter ]; then + # echo "Disabling rp_filter." + # echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter + #fi +} + +# Stop IP packet forwarding: +ip_forward_stop() { + if [ -f /proc/sys/net/ipv4/ip_forward ]; then + echo "Disabling IPv4 packet forwarding." + echo 0 > /proc/sys/net/ipv4/ip_forward + # Changing /proc/sys/net/ipv4/ip_forward results in resetting all + # non-default ipv4 parameters for the interface as mentioned in + # /usr/src/linux/Documentation/networking/ip-sysctl.txt. So, we + # will reapply any ipv4 sysctl parameters now: + if [ -r /etc/sysctl.conf ]; then + /bin/grep ipv4 /etc/sysctl.conf | sysctl -p - 1> /dev/null 2> /dev/null + fi + fi +} + +# Restart IP packet forwarding: +ip_forward_restart() { + ip_forward_stop + sleep 1 + ip_forward_start +} + +case "$1" in +'start') + ip_forward_start + ;; +'stop') + ip_forward_stop + ;; +'restart') + ip_forward_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac + diff --git a/source/n/network-scripts/scripts/resolv.conf b/source/n/network-scripts/scripts/resolv.conf new file mode 100644 index 000000000..96726f016 --- /dev/null +++ b/source/n/network-scripts/scripts/resolv.conf @@ -0,0 +1 @@ +search example.net diff --git a/source/n/network-scripts/scripts/setup.netconfig b/source/n/network-scripts/scripts/setup.netconfig new file mode 100644 index 000000000..7165a4a96 --- /dev/null +++ b/source/n/network-scripts/scripts/setup.netconfig @@ -0,0 +1,13 @@ +#!/bin/sh +#BLURB="Configure basic network settings" +TMP=/var/log/setup/tmp +dialog --title "CONFIGURE NETWORK?" --yesno "Would you like to \ +configure your network?" 5 60 +if [ $? = 0 ]; then + while [ 0 ]; do # we're gonna do this until we get it right :-) + sh sbin/netconfig $* + if [ "$?" = "0" ]; then # success + break; + fi + done +fi |