diff options
Diffstat (limited to 'chapter07')
-rw-r--r-- | chapter07/bootscripts.xml | 12 | ||||
-rw-r--r-- | chapter07/chapter07.xml (renamed from chapter07/chapter7.sgml) | 0 | ||||
-rw-r--r-- | chapter07/chapter9.xml | 12 | ||||
-rw-r--r-- | chapter07/checkfs.xml (renamed from chapter07/checkfs.sgml) | 0 | ||||
-rw-r--r-- | chapter07/createdirs.xml (renamed from chapter07/createdirs.sgml) | 0 | ||||
-rw-r--r-- | chapter07/ethnet-symperm.xml | 23 | ||||
-rw-r--r-- | chapter07/ethnet.xml | 188 | ||||
-rw-r--r-- | chapter07/fstab.xml (renamed from chapter07/fstab.sgml) | 0 | ||||
-rw-r--r-- | chapter07/functions.xml (renamed from chapter07/functions.sgml) | 0 | ||||
-rw-r--r-- | chapter07/halt.xml (renamed from chapter07/halt.sgml) | 0 | ||||
-rw-r--r-- | chapter07/hosts.xml | 83 | ||||
-rw-r--r-- | chapter07/introduction.sgml | 13 | ||||
-rw-r--r-- | chapter07/introduction.xml | 13 | ||||
-rw-r--r-- | chapter07/loadkeys.xml (renamed from chapter07/loadkeys.sgml) | 0 | ||||
-rw-r--r-- | chapter07/localnet-symperm.xml | 19 | ||||
-rw-r--r-- | chapter07/localnet.xml | 59 | ||||
-rw-r--r-- | chapter07/mountfs.xml (renamed from chapter07/mountfs.sgml) | 0 | ||||
-rw-r--r-- | chapter07/network.xml | 23 | ||||
-rw-r--r-- | chapter07/rc.xml (renamed from chapter07/rc.sgml) | 0 | ||||
-rw-r--r-- | chapter07/rcS.xml (renamed from chapter07/rcS.sgml) | 0 | ||||
-rw-r--r-- | chapter07/reboot.xml (renamed from chapter07/reboot.sgml) | 0 | ||||
-rw-r--r-- | chapter07/sendsignals.xml (renamed from chapter07/sendsignals.sgml) | 0 | ||||
-rw-r--r-- | chapter07/setclock.xml (renamed from chapter07/setclock.sgml) | 0 | ||||
-rw-r--r-- | chapter07/symperm.xml (renamed from chapter07/symperm.sgml) | 0 | ||||
-rw-r--r-- | chapter07/sysklogd.xml (renamed from chapter07/sysklogd.sgml) | 0 | ||||
-rw-r--r-- | chapter07/template.xml (renamed from chapter07/template.sgml) | 0 |
26 files changed, 432 insertions, 13 deletions
diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml new file mode 100644 index 000000000..ac33ca2bc --- /dev/null +++ b/chapter07/bootscripts.xml @@ -0,0 +1,12 @@ +<sect1 id="ch09-bootscripts"> +<title>Creating network boot scripts</title> + +&c9-bs-localnet; +&c9-bs-localnet-symperm; +&c9-bs-hostname; +&c9-bs-hosts; +&c9-bs-ethnet; +&c9-bs-ethnet-symperm; + +</sect1> + diff --git a/chapter07/chapter7.sgml b/chapter07/chapter07.xml index ab3625579..ab3625579 100644 --- a/chapter07/chapter7.sgml +++ b/chapter07/chapter07.xml diff --git a/chapter07/chapter9.xml b/chapter07/chapter9.xml new file mode 100644 index 000000000..5233eeeef --- /dev/null +++ b/chapter07/chapter9.xml @@ -0,0 +1,12 @@ +<chapter id="chapter09"> +<title>Setting up basic networking</title> + +&c9-introduction; +&c9-networksoftware; +&c9-localnet; +&c9-network; +&c9-hosts; +&c9-ethnet; + +</chapter> + diff --git a/chapter07/checkfs.sgml b/chapter07/checkfs.xml index 2350a0056..2350a0056 100644 --- a/chapter07/checkfs.sgml +++ b/chapter07/checkfs.xml diff --git a/chapter07/createdirs.sgml b/chapter07/createdirs.xml index 0831e7874..0831e7874 100644 --- a/chapter07/createdirs.sgml +++ b/chapter07/createdirs.xml diff --git a/chapter07/ethnet-symperm.xml b/chapter07/ethnet-symperm.xml new file mode 100644 index 000000000..ba72ab6e9 --- /dev/null +++ b/chapter07/ethnet-symperm.xml @@ -0,0 +1,23 @@ +<sect2> +<title>Setting up permissions and symlink</title> + +<para> +Set the proper file permissions and create the necessary symlink by +running the following commands: +</para> + +<blockquote><literallayout> + + <userinput>cd /etc/init.d &&</userinput> + <userinput>chmod 754 ethnet &&</userinput> + <userinput>cd ../rc3.d &&</userinput> + <userinput>ln -s ../init.d/ethnet S200ethnet &&</userinput> + <userinput>cd ../rc4.d &&</userinput> + <userinput>ln -s ../init.d/ethnet S200ethnet &&</userinput> + <userinput>cd ../rc5.d &&</userinput> + <userinput>ln -s ../init.d/ethnet S200ethnet</userinput> + +</literallayout></blockquote> + +</sect2> + diff --git a/chapter07/ethnet.xml b/chapter07/ethnet.xml new file mode 100644 index 000000000..a1630a6cc --- /dev/null +++ b/chapter07/ethnet.xml @@ -0,0 +1,188 @@ +<sect1 id="ch09-ethnet"> +<title>Creating the /etc/init.d/ethnet script</title> + +<para> +This section only applies if you are going to configure a network card. +If you're not, skip this section. +</para> + +<para> +Create a new file <filename>/etc/init.d/ethnet</filename> containing the +following: +</para> + +<literallayout> + +<userinput>cat > /etc/init.d/ethnet << "EOF"</userinput> +#!/bin/sh +# Begin /etc/init.d/ethnet +# +# Main script by Gerard Beekmans - gerard@linuxfromscratch.org +# GATEWAY check by Jean-François Le Ray - jfleray@club-internet.fr +# + +# +# Include the functions declared in the /etc/init.d/functions file +# and the variables from the /etc/sysconfig/network file. +# + +source /etc/init.d/functions +source /etc/sysconfig/network + +case "$1" in + start) + +# +# Obtain all the network card configuration files +# + + for interface in $(ls /etc/sysconfig/network-scripts/ifcfg* | \ + grep -v ifcfg-lo) + do +# +# Load the variables from that file +# + + source $interface +# +# If the ONBOOT variable is set to yes, process this file and bring the +# interface down. +# + + if [ "$ONBOOT" == yes ] + then + echo -n "Bringing up the $DEVICE interface..." + /sbin/ifconfig $DEVICE $IP broadcast $BROADCAST \ + netmask $NETMASK + evaluate_retval + fi + done + +# +# If the /etc/sysconfig/network file contains a GATEWAY variable, set +# the gateway. + +# + + if [ "$GATEWAY" != "" ]; then + echo -n "Setting up routing for eth0 interface..." + /sbin/route add default gw $GATEWAY metric 1 + evaluate_retval + fi + ;; + + stop) + +# +# Obtain all the network card configuration files +# + + for interface in $(ls /etc/sysconfig/network-scripts/ifcfg* | \ + grep -v ifcfg-lo) + do +# +# Load the variables from that file +# + + source $interface +# +# If the ONBOOT variable is set, process the file and bring the +# interface down +# + + if [ $ONBOOT == yes ] + then + echo -n "Bringing down the $DEVICE interface..." + /sbin/ifconfig $DEVICE down + evaluate_retval + fi + done + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + +# End /etc/init.d/ethnet +<userinput>EOF</userinput> + +</literallayout> + +<sect2> +<title>Adding default gateway to /etc/sysconfig/network</title> + +<para> +If you require a default gateway to be setup, run the following command: +</para> + +<literallayout> + +<userinput>cat >> /etc/sysconfig/network << "EOF"</userinput> +GATEWAY=192.168.1.2 +<userinput>EOF</userinput> + +</literallayout> + +<para> +Change GATEWAY to match your network setup. +</para> + +</sect2> + +<sect2> +<title>Creating NIC configuration files</title> + +<para> +Which interfaces are brought up and down by the ethnet script depends on +the files in the /etc/sysconfig/network-scripts directory. This +directory should contain files in the form of ifcfg-x where x is an +identification number (or whatever you choose to name it). +</para> + +<para> +First create the network-scripts directory by running: +</para> + +<blockquote><literallayout> + + <userinput>mkdir /etc/sysconfig/network-scripts</userinput> + +</literallayout></blockquote> + +<para> +Now, create new files in that directory containing the following. +Example file names are ifcfg-eth0, ifcfg-eth0:3 and ifcfg-eth1:2 +</para> + +<blockquote><literallayout> + +ONBOOT=yes +DEVICE=eth0 +IP=192.168.1.1 +NETMASK=255.255.255.0 +BROADCAST=192.168.1.255 + +</literallayout></blockquote> + +<para> +Of course, change the values of those four variables in every file to +match the proper setup. Usually NETMASK and BROADCAST will remain the +same, just the DEVICE IP variables will change per network interface. If +the ONBOOT variable is set to yes, the ethnet script will bring it up +during boot up of the system. If set to anything else but yes it will be +ignored by the ethnet script and thus not brought up. +</para> + +</sect2> + +&c9-ethnet-symperm; + +</sect1> + diff --git a/chapter07/fstab.sgml b/chapter07/fstab.xml index 1c0be5826..1c0be5826 100644 --- a/chapter07/fstab.sgml +++ b/chapter07/fstab.xml diff --git a/chapter07/functions.sgml b/chapter07/functions.xml index e46522c0f..e46522c0f 100644 --- a/chapter07/functions.sgml +++ b/chapter07/functions.xml diff --git a/chapter07/halt.sgml b/chapter07/halt.xml index f7849ad0b..f7849ad0b 100644 --- a/chapter07/halt.sgml +++ b/chapter07/halt.xml diff --git a/chapter07/hosts.xml b/chapter07/hosts.xml new file mode 100644 index 000000000..676291981 --- /dev/null +++ b/chapter07/hosts.xml @@ -0,0 +1,83 @@ +<sect1 id="ch09-hosts"> +<title>Creating the /etc/hosts file</title> + +<para> +If you want to configure a network card, you have to decide on the +IP-address, FQDN and possible aliases for use in the /etc/hosts file. An +example is: +</para> + +<blockquote><literallayout> + + <my-IP> myhost.mydomain.org aliases + +</literallayout></blockquote> + +<para> +Make sure the IP-address is in the private network IP-address range. +Valid ranges are: +</para> + +<blockquote><literallayout> + + Class Networks + A 10.0.0.0 + B 172.16.0.0 through 172.31.0.0 + C 192.168.0.0 through 192.168.255.0 + +</literallayout></blockquote> + +<para> +A valid IP address could be 192.168.1.1. A valid FQDN for this IP could +be www.linuxfromscratch.org +</para> + +<para> +If you're not going to use a network card, you still need to come up with a +FQDN. This is necessary for programs like Sendmail to operate correctly (in +fact; Sendmail won't run when it can't determine the FQDN). +</para> + +<para> +If you don't configure a network card, create a new file +<filename>/etc/hosts</filename> by running: +</para> + +<literallayout> + +<userinput>cat > /etc/hosts << "EOF"</userinput> +# Begin /etc/hosts (no network card version) + +127.0.0.1 www.mydomain.com <value of HOSTNAME> localhost + +# End /etc/hosts (no network card version) +<userinput>EOF</userinput> + +</literallayout> + +<para> +If you do configure a network card, create a new file +<filename>/etc/hosts</filename> containing: +</para> + +<literallayout> + +<userinput>cat > /etc/hosts << "EOF"</userinput> +# Begin /etc/hosts (network card version) + +127.0.0.1 localhost.localdomain localhost +192.168.1.1 www.mydomain.org <value of HOSTNAME> + +# End /etc/hosts (network card version) +<userinput>EOF</userinput> + +</literallayout> + +<para> +Of course, change the 192.168.1.1 and www.mydomain.org to your own +liking (or requirements if you are assigned an IP-address by a network/system +administrator and you plan on connecting this machine to that network). +</para> + +</sect1> + diff --git a/chapter07/introduction.sgml b/chapter07/introduction.sgml deleted file mode 100644 index 5f1bea0b0..000000000 --- a/chapter07/introduction.sgml +++ /dev/null @@ -1,13 +0,0 @@ -<sect1 id="ch07-introduction"> -<title>Introduction</title> - -<para> -This chapter will create the necessary scripts that are run at boottime. -These scripts perform tasks such as remounting the root file system -mounted read-only by the kernel into read-write mode, activiating the swap -partition(s), running a check on the root file system to make sure it's -intact and starting the daemons that the system uses. -</para> - -</sect1> - diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml new file mode 100644 index 000000000..c9f266db3 --- /dev/null +++ b/chapter07/introduction.xml @@ -0,0 +1,13 @@ +<sect1 id="ch09-introduction"> +<title>Introduction</title> + +<para> +This chapter will setup basic networking. Although you might not be +connected to a network, Linux software uses network functions anyway. +We'll be installing at least the local loopback device and a network +card as well if applicable. Also the proper bootscripts will be created +so that networking will be enabled during boot time. +</para> + +</sect1> + diff --git a/chapter07/loadkeys.sgml b/chapter07/loadkeys.xml index bc17fd19d..bc17fd19d 100644 --- a/chapter07/loadkeys.sgml +++ b/chapter07/loadkeys.xml diff --git a/chapter07/localnet-symperm.xml b/chapter07/localnet-symperm.xml new file mode 100644 index 000000000..137c3b7e5 --- /dev/null +++ b/chapter07/localnet-symperm.xml @@ -0,0 +1,19 @@ +<sect2> +<title>Setting up permissions and symlink</title> + +<para> +Set the proper file permissions and create the necessary symlink by +running the following commands: +</para> + +<blockquote><literallayout> + + <userinput>cd /etc/init.d &&</userinput> + <userinput>chmod 754 localnet &&</userinput> + <userinput>cd ../rcS.d &&</userinput> + <userinput>ln -s ../init.d/localnet S100localnet</userinput> + +</literallayout></blockquote> + +</sect2> + diff --git a/chapter07/localnet.xml b/chapter07/localnet.xml new file mode 100644 index 000000000..e82f9ba0c --- /dev/null +++ b/chapter07/localnet.xml @@ -0,0 +1,59 @@ +<sect1 id="ch09-localnet"> +<title>Creating the /etc/init.d/localnet bootscript</title> + +<para> +Create a new file <filename>/etc/init.d/localnet</filename> containing +the following: +</para> + +<literallayout> + +<userinput>cat > /etc/init.d/localnet << "EOF"</userinput> +#!/bin/sh +# Begin /etc/init.d/localnet + +# +# Include the functions declared in the /etc/init.d/functions file +# and include the variables from the /etc/sysconfig/network file. +# + +source /etc/init.d/functions +source /etc/sysconfig/network + +case "$1" in + start) + echo -n "Bringing up the loopback interface..." + /sbin/ifconfig lo 127.0.0.1 + evaluate_retval + + echo -n "Setting up hostname..." + /bin/hostname $HOSTNAME + evaluate_retval + ;; + + stop) + echo -n "Bringing down the loopback interface..." + /sbin/ifconfig lo down + evaluate_retval + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0: {start|stop|restart}" + exit 1 + ;; +esac + +# End /etc/init.d/localnet +<userinput>EOF</userinput> + +</literallayout> + +&c9-localnet-symperm; + +</sect1> + diff --git a/chapter07/mountfs.sgml b/chapter07/mountfs.xml index f0fdf7a78..f0fdf7a78 100644 --- a/chapter07/mountfs.sgml +++ b/chapter07/mountfs.xml diff --git a/chapter07/network.xml b/chapter07/network.xml new file mode 100644 index 000000000..603c61b55 --- /dev/null +++ b/chapter07/network.xml @@ -0,0 +1,23 @@ +<sect1 id="ch09-network"> +<title>Creating the /etc/sysconfig/network file</title> + +<para> +Create a new file <filename>/etc/sysconfig/network</filename> and put the +hostname in it by running: +</para> + +<blockquote><literallayout> + + <userinput>echo "HOSTNAME=lfs" > /etc/sysconfig/network</userinput> + +</literallayout></blockquote> + +<para> +Replace <quote>lfs</quote> by the name you wish to call your computer. +Please not that you should not enter the FQDN (Fully Qualified Domain +Name) here. That information will be put in the +<filename>/etc/hosts</filename> file later. +</para> + +</sect1> + diff --git a/chapter07/rc.sgml b/chapter07/rc.xml index 3aba51da3..3aba51da3 100644 --- a/chapter07/rc.sgml +++ b/chapter07/rc.xml diff --git a/chapter07/rcS.sgml b/chapter07/rcS.xml index 908059d04..908059d04 100644 --- a/chapter07/rcS.sgml +++ b/chapter07/rcS.xml diff --git a/chapter07/reboot.sgml b/chapter07/reboot.xml index e57410c48..e57410c48 100644 --- a/chapter07/reboot.sgml +++ b/chapter07/reboot.xml diff --git a/chapter07/sendsignals.sgml b/chapter07/sendsignals.xml index 3aff74996..3aff74996 100644 --- a/chapter07/sendsignals.sgml +++ b/chapter07/sendsignals.xml diff --git a/chapter07/setclock.sgml b/chapter07/setclock.xml index 9e5992c39..9e5992c39 100644 --- a/chapter07/setclock.sgml +++ b/chapter07/setclock.xml diff --git a/chapter07/symperm.sgml b/chapter07/symperm.xml index 044f29d7a..044f29d7a 100644 --- a/chapter07/symperm.sgml +++ b/chapter07/symperm.xml diff --git a/chapter07/sysklogd.sgml b/chapter07/sysklogd.xml index 74e8b9d6d..74e8b9d6d 100644 --- a/chapter07/sysklogd.sgml +++ b/chapter07/sysklogd.xml diff --git a/chapter07/template.sgml b/chapter07/template.xml index 0c062ca30..0c062ca30 100644 --- a/chapter07/template.sgml +++ b/chapter07/template.xml |