From fcc027677da55c41dcaea045f5b9ff8b088e6495 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sun, 7 Jun 2020 20:16:00 +0000 Subject: Initial commit of alternative cross LFS git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter09/network.xml | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 chapter09/network.xml (limited to 'chapter09/network.xml') diff --git a/chapter09/network.xml b/chapter09/network.xml new file mode 100644 index 000000000..b527258ee --- /dev/null +++ b/chapter09/network.xml @@ -0,0 +1,247 @@ + + + %general-entities; +]> + + + + + General Network Configuration + + + network + configuring + + + Creating Network Interface Configuration Files + + Which interfaces are brought up and down by the network script + usually depends on the files in /etc/sysconfig/. This directory should + contain a file for each interface to be configured, such as + ifconfig.xyz, where xyz should describe + the network card. The interface name (e.g. eth0) is usually appropriate. + Inside this file are attributes to this interface, such as its IP + address(es), subnet masks, and so forth. It is necessary that the stem of + the filename be ifconfig. + + If the procedure in the previous section was not used, Udev + will assign network card interface names based on system physical + characteristics such as enp2s1. If you are not sure what your interface + name is, you can always run ip link or ls + /sys/class/net after you have booted your system. + + + The following command creates a sample file for the + eth0 device with a static IP address: + +cd /etc/sysconfig/ +cat > ifconfig.eth0 << "EOF" +ONBOOT=yes +IFACE=eth0 +SERVICE=ipv4-static +IP=192.168.1.2 +GATEWAY=192.168.1.1 +PREFIX=24 +BROADCAST=192.168.1.255 +EOF + + The values in italics must be changed in every file to match + the proper setup. + + If the ONBOOT variable is set to yes the + System V network script will bring up the Network Interface Card (NIC) during + booting of the system. If set to anything but yes the NIC + will be ignored by the network script and not be automatically brought up. + The interface can be manually started or stopped with the + ifup and ifdown commands. + + The IFACE variable defines the interface name, + for example, eth0. It is required for all network device configuration + files. The filename extension must match this value. + + The SERVICE variable defines the method used for + obtaining the IP address. The LFS-Bootscripts package has a modular IP + assignment format, and creating additional files in the /lib/services/ directory allows other IP + assignment methods. This is commonly used for Dynamic Host Configuration + Protocol (DHCP), which is addressed in the BLFS book. + + The GATEWAY variable should contain the default + gateway IP address, if one is present. If not, then comment out the + variable entirely. + + The PREFIX variable contains the number of + bits used in the subnet. Each octet in an IP address is 8 bits. If the + subnet's netmask is 255.255.255.0, then it is using the first three octets + (24 bits) to specify the network number. If the netmask is 255.255.255.240, + it would be using the first 28 bits. Prefixes longer than 24 bits are + commonly used by DSL and cable-based Internet Service Providers (ISPs). + In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the + PREFIX variable according to your specific subnet. + If omitted, the PREFIX defaults to 24. + + For more information see the ifup man page. + + + + Creating the /etc/resolv.conf File + + + /etc/resolv.conf + + + The system will need some means of obtaining Domain Name Service + (DNS) name resolution to resolve Internet domain names to IP addresses, and + vice versa. This is best achieved by placing the IP address of the DNS + server, available from the ISP or network administrator, into + /etc/resolv.conf. Create the file by running the + following: + +cat > /etc/resolv.conf << "EOF" +# Begin /etc/resolv.conf + +domain <Your Domain Name> +nameserver <IP address of your primary nameserver> +nameserver <IP address of your secondary nameserver> + +# End /etc/resolv.conf +EOF + + The domain statement can be omitted + or replaced with a search statement. See the man page for + resolv.conf for more details. + + Replace <IP address of the nameserver> + with the IP address of the DNS most appropriate for the setup. There will + often be more than one entry (requirements demand secondary servers for + fallback capability). If you only need or want one DNS server, remove the + second nameserver line from the file. The IP address + may also be a router on the local network. + + + The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4. + + + + + + Configuring the system hostname + + + hostname + configuring + + + During the boot process, the file /etc/hostname + is used for establishing the system's hostname. + + Create the /etc/hostname file and enter a + hostname by running: + +echo "<lfs>" > /etc/hostname + + <lfs> needs to be replaced with the + name given to the computer. Do not enter the Fully Qualified Domain Name + (FQDN) here. That information is put in the + /etc/hosts file. + + + + + Customizing the /etc/hosts File + + + /etc/hosts + + + + localnet + /etc/hosts + + + + network + /etc/hosts + + + Decide on the IP address, fully-qualified domain name (FQDN), and + possible aliases for use in the /etc/hosts file. The + syntax is: + +IP_address myhost.example.org aliases + + Unless the computer is to be visible to the Internet (i.e., there is + a registered domain and a valid block of assigned IP addresses—most + users do not have this), make sure that the IP address is in the private + network IP address range. Valid ranges are: + +Private Network Address Range Normal Prefix +10.0.0.1 - 10.255.255.254 8 +172.x.0.1 - 172.x.255.254 16 +192.168.y.1 - 192.168.y.254 24 + + x can be any number in the range 16-31. y can be any number in the + range 0-255. + + A valid private IP address could be 192.168.1.1. A valid FQDN for + this IP could be lfs.example.org. + + Even if not using a network card, a valid FQDN is still required. + This is necessary for certain programs to operate correctly. + + Create the /etc/hosts file by running: + +cat > /etc/hosts << "EOF" +# Begin /etc/hosts + +127.0.0.1 localhost.localdomain localhost +127.0.1.1 <FQDN> <HOSTNAME> +<192.168.1.1> <FQDN> <HOSTNAME> [alias1] [alias2 ...] +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters + +# End /etc/hosts +EOF + + The <192.168.1.1>, + <FQDN>, and + <HOSTNAME> values need to be + changed for specific uses or requirements (if assigned an IP address by a + network/system administrator and the machine will be connected to an + existing network). The optional alias name(s) can be omitted. + + + + + + -- cgit v1.2.3-54-g00ecf From a3d0817020eee2b1ea6ebfe10f3a0ea9e26829be Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Fri, 12 Jun 2020 20:42:32 +0000 Subject: Text updated for cross2 chapter 9 git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11928 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter09/etcshells.xml | 2 +- chapter09/inputrc.xml | 6 +- chapter09/introduction.xml | 142 ++------------------------------------------- chapter09/network.xml | 16 +---- chapter09/profile.xml | 10 ++-- chapter09/symlinks.xml | 46 +++++++-------- chapter09/udev.xml | 24 ++++---- chapter09/usage.xml | 68 ++++------------------ 8 files changed, 62 insertions(+), 252 deletions(-) (limited to 'chapter09/network.xml') diff --git a/chapter09/etcshells.xml b/chapter09/etcshells.xml index 30961c80c..a0d5f21a8 100644 --- a/chapter09/etcshells.xml +++ b/chapter09/etcshells.xml @@ -23,7 +23,7 @@ The shells file contains a list of login shells on the system. Applications use this file to determine whether a shell is valid. For each shell a single line should be - present, consisting of the shell's path, relative to the root of the + present, consisting of the shell's path relative to the root of the directory structure (/). For example, this file is consulted by chsh diff --git a/chapter09/inputrc.xml b/chapter09/inputrc.xml index 00d36877f..de5401d2c 100644 --- a/chapter09/inputrc.xml +++ b/chapter09/inputrc.xml @@ -15,14 +15,14 @@ The inputrc file is the configuration file for - the Readline library, which provides editing capabilities while the user is + the readline library, which provides editing capabilities while the user is entering a line from the terminal. It works by translating keyboard inputs - into specific actions. Readline is used by Bash and most other shells as + into specific actions. Readline is used by bash and most other shells as well as many other applications. Most people do not need user-specific functionality so the command below creates a global /etc/inputrc used by everyone who - logs in. If you later decide you need to override the defaults on a per-user + logs in. If you later decide you need to override the defaults on a per user basis, you can create a .inputrc file in the user's home directory with the modified mappings. diff --git a/chapter09/introduction.xml b/chapter09/introduction.xml index cbc197a7b..875003f14 100644 --- a/chapter09/introduction.xml +++ b/chapter09/introduction.xml @@ -18,12 +18,6 @@ process must be organized to ensure the tasks are performed in the correct order but, at the same time, be executed as fast as possible. - - System V @@ -39,15 +33,13 @@ /etc/inittab file and is organized into run levels that can be run by the user: - -0 — halt +0 — halt 1 — Single user mode 2 — Multiuser, without networking 3 — Full multiuser mode 4 — User definable 5 — Full multiuser mode with display manager -6 — reboot - +6 — reboot The usual default run level is 3 or 5. @@ -69,7 +61,7 @@ - Slower to boot. A medium speed base LFS system + May be slower to boot. A medium speed base LFS system takes 8-12 seconds where the boot time is measured from the first kernel message to the login prompt. Network connectivity is typically established about 2 seconds @@ -94,132 +86,6 @@ - - + diff --git a/chapter09/network.xml b/chapter09/network.xml index b527258ee..45cd1d438 100644 --- a/chapter09/network.xml +++ b/chapter09/network.xml @@ -13,17 +13,7 @@ network configuring - + Creating Network Interface Configuration Files @@ -37,7 +27,7 @@ address(es), subnet masks, and so forth. It is necessary that the stem of the filename be ifconfig. - If the procedure in the previous section was not used, Udev + If the procedure in the previous section was not used, udev will assign network card interface names based on system physical characteristics such as enp2s1. If you are not sure what your interface name is, you can always run ip link or ls @@ -64,7 +54,7 @@ EOF If the ONBOOT variable is set to yes the System V network script will bring up the Network Interface Card (NIC) during - booting of the system. If set to anything but yes the NIC + the system boot process. If set to anything but yes the NIC will be ignored by the network script and not be automatically brought up. The interface can be manually started or stopped with the ifup and ifdown commands. diff --git a/chapter09/profile.xml b/chapter09/profile.xml index 226dd9fac..ec39d3a30 100644 --- a/chapter09/profile.xml +++ b/chapter09/profile.xml @@ -103,8 +103,8 @@ LC_ALL=<locale name> locale int_prefix encoding used by the locale, the local currency, and the prefix to dial before the telephone number in order to get into the country. If any of the commands above fail with a message similar to the one shown below, this means - that your locale was either not installed in Chapter 6 or is not supported by - the default installation of Glibc. + that your locale was either not installed in + or is not supported by the default installation of Glibc. locale: Cannot set LC_* to default locale: No such file or directory @@ -114,7 +114,7 @@ LC_ALL=<locale name> locale int_prefix Glibc. - Some packages beyond LFS may also lack support for your chosen locale. One + Other packages can also function incorrectly (but may not necessarily display any error messages) if the locale name does not meet their expectations. In those cases, investigating how other Linux distributions support your locale @@ -145,7 +145,7 @@ export LANG=<ll>_<CC>.<charmap><@modifiers> # End /etc/profile EOF - The C (default) and en_US (the recommended + The C (default) and en_US.utf8 (the recommended one for United States English users) locales are different. C uses the US-ASCII 7-bit character set, and treats bytes with the high bit set as invalid characters. That's why, e.g., the ls command diff --git a/chapter09/symlinks.xml b/chapter09/symlinks.xml index 951e6976d..3b46a67b0 100644 --- a/chapter09/symlinks.xml +++ b/chapter09/symlinks.xml @@ -21,7 +21,7 @@ discovered. For example, on a computer having two network cards made by Intel and Realtek, the network card manufactured by Intel may become eth0 and the Realtek card becomes eth1. In some cases, after a reboot the cards - get renumbered the other way around. + could get renumbered the other way around. In the new naming scheme, typical network device names would then be something like enp5s0 or wlp3s0. If this naming convention is not @@ -44,7 +44,7 @@ Creating Custom Udev Rules - The naming scheme can be customized by creating custom Udev + The naming scheme can be customized by creating custom udev rules. A script has been included that generates the initial rules. Generate these rules by running: @@ -68,24 +68,24 @@ along with its driver in parentheses, if the driver can be found. Neither the hardware ID nor the driver is used to determine which name to give an interface; this information is only for reference. The second line is the - Udev rule that matches this NIC and actually assigns it a name. + udev rule that matches this NIC and actually assigns it a name. - All Udev rules are made up of several keys, separated by commas and + All udev rules are made up of several keys, separated by commas and optional whitespace. This rule's keys and an explanation of each of them are as follows: - SUBSYSTEM=="net" - This tells Udev to ignore + SUBSYSTEM=="net" - This tells udev to ignore devices that are not network cards. - ACTION=="add" - This tells Udev to ignore this + ACTION=="add" - This tells udev to ignore this rule for a uevent that isn't an add ("remove" and "change" uevents also happen, but don't need to rename network interfaces). - DRIVERS=="?*" - This exists so that Udev will + DRIVERS=="?*" - This exists so that udev will ignore VLAN or bridge sub-interfaces (because these sub-interfaces do not have drivers). These sub-interfaces are skipped because the name that would be assigned would collide with their parent devices. @@ -96,14 +96,14 @@ ATTR{type}=="1" - This ensures the rule only - matches the primary interface in the case of certain wireless drivers, + matches the primary interface in the case of certain wireless drivers which create multiple virtual interfaces. The secondary interfaces are skipped for the same reason that VLAN and bridge sub-interfaces are skipped: there would be a name collision otherwise. NAME - The value of this key is the name that - Udev will assign to this interface. + udev will assign to this interface. @@ -133,8 +133,8 @@ default for USB and FireWire devices), where the rules it creates depend on the physical path to the CD or DVD device. Second, it can operate in by-id mode (default for IDE and SCSI devices), where the - rules it creates depend on identification strings stored in the CD or DVD - device itself. The path is determined by Udev's path_id + rules it creates depend on identification strings stored on the CD or DVD + device itself. The path is determined by udev's path_id script, and the identification strings are read from the hardware by its ata_id or scsi_id programs, depending on which type of device you have. @@ -159,11 +159,11 @@ External devices (for example, a USB-connected CD drive) should not use by-path persistence, because each time the device is plugged into a new external port, its physical path will change. All - externally-connected devices will have this problem if you write Udev rules + externally-connected devices will have this problem if you write udev rules to recognize them by their physical path; the problem is not limited to CD and DVD drives. - If you wish to see the values that the Udev scripts will use, then + If you wish to see the values that the udev scripts will use, then for the appropriate CD-ROM device, find the corresponding directory under /sys (e.g., this can be /sys/block/hdd) and @@ -182,18 +182,18 @@ as follows (where mode is one of by-id or by-path): -sed -i -e 's/"write_cd_rules"/"write_cd_rules mode"/' \ - /etc/udev/rules.d/83-cdrom-symlinks.rules +sed -e 's/"write_cd_rules"/"write_cd_rules mode"/' \ + -i /etc/udev/rules.d/83-cdrom-symlinks.rules Note that it is not necessary to create the rules files or symlinks - at this time, because you have bind-mounted the host's - /dev directory into the LFS system, + at this time because you have bind-mounted the host's + /dev directory into the LFS system and we assume the symlinks exist on the host. The rules and symlinks will be created the first time you boot your LFS system. However, if you have multiple CD-ROM devices, then the symlinks generated at that time may point to different devices than they point to on - your host, because devices are not discovered in a predictable order. The + your host because devices are not discovered in a predictable order. The assignments created when you first boot the LFS system will be stable, so this is only an issue if you need the symlinks on both systems to point to the same device. If you need that, then inspect (and possibly edit) the @@ -212,9 +212,9 @@ E.g., if you have a USB web camera and a TV tuner, sometimes /dev/video0 refers to the camera and /dev/video1 refers to the tuner, and sometimes - after a reboot the order changes to the opposite one. + after a reboot the order changes. For all classes of hardware except sound cards and network cards, this is - fixable by creating Udev rules for custom persistent symlinks. + fixable by creating udev rules for custom persistent symlinks. The case of network cards is covered separately in , and sound card configuration can be found in BLFS. @@ -237,10 +237,8 @@ cat > /etc/udev/rules.d/83-duplicate_devs.rules << "EOF" # Persistent symlinks for webcam and tuner -KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \ - SYMLINK+="webcam" -KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \ - SYMLINK+="tvtuner" +KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", SYMLINK+="webcam" +KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", SYMLINK+="tvtuner" EOF diff --git a/chapter09/udev.xml b/chapter09/udev.xml index 6060849be..508795a03 100644 --- a/chapter09/udev.xml +++ b/chapter09/udev.xml @@ -15,7 +15,7 @@ usage - In , we installed the Udev + In , we installed the udev package when eudev systemd was built. Before we go into the details regarding how this works, a brief history of previous methods of @@ -30,7 +30,7 @@ major and minor device numbers for every possible device that might exist in the world. - Using the Udev method, only those devices which are detected by the + Using the udev method, only those devices which are detected by the kernel get device nodes created for them. Because these device nodes will be created each time the system boots, they will be stored on a devtmpfs file system (a virtual file system @@ -135,7 +135,7 @@ /sys/bus/pci/devices/0000:00:0d.0/modalias file might contain the string pci:v00001319d00000801sv00001319sd00001319bc04sc01i00. - The default rules provided with Udev will cause udevd + The default rules provided with udev will cause udevd to call out to /sbin/modprobe with the contents of the MODALIAS uevent environment variable (which should be the same as the contents of the modalias file in sysfs), @@ -149,7 +149,7 @@ be prevented. The kernel itself is also able to load modules for network - protocols, filesystems and NLS support on demand. + protocols, filesystems, and NLS support on demand. @@ -177,12 +177,12 @@ Udev will only load a module if it has a bus-specific alias and the bus driver properly exports the necessary aliases to sysfs. In other cases, one should - arrange module loading by other means. With Linux-&linux-version;, Udev is + arrange module loading by other means. With Linux-&linux-version;, udev is known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, SERIO, and FireWire devices. To determine if the device driver you require has the necessary - support for Udev, run modinfo with the module name as + support for udev, run modinfo with the module name as the argument. Now try locating the device directory under /sys/bus and check whether there is a modalias file there. @@ -190,7 +190,7 @@ If the modalias file exists in sysfs, the driver supports the device and can talk to it directly, but doesn't have the alias, it is a bug in the - driver. Load the driver without the help from Udev and expect the issue + driver. Load the driver without the help from udev and expect the issue to be fixed later. If there is no modalias file in the relevant @@ -206,7 +206,7 @@ - A kernel module is not loaded automatically, and Udev is not + <title>A kernel module is not loaded automatically, and udev is not intended to load it If the wrapper module only enhances the @@ -214,7 +214,7 @@ snd-pcm-oss enhances the functionality of snd-pcm by making the sound cards available to OSS applications), configure modprobe to load the wrapper - after Udev loads the wrapped module. To do this, add a + after udev loads the wrapped module. To do this, add a softdep line to the corresponding /etc/modprobe.d/<filename>.conf file. For example: @@ -279,7 +279,7 @@ Further text assumes that the driver is built statically into the kernel or already loaded as a module, and that you have already checked - that Udev doesn't create a misnamed device. + that udev doesn't create a misnamed device. Udev has no information needed to create a device node if a kernel driver does not export its data to @@ -297,12 +297,12 @@ Device naming order changes randomly after rebooting - This is due to the fact that Udev, by design, handles uevents and + This is due to the fact that udev, by design, handles uevents and loads modules in parallel, and thus in an unpredictable order. This will never be fixed. You should not rely upon the kernel device names being stable. Instead, create your own rules that make symlinks with stable names based on some stable attributes of the device, such as a - serial number or the output of various *_id utilities installed by Udev. + serial number or the output of various *_id utilities installed by udev. See and for examples. diff --git a/chapter09/usage.xml b/chapter09/usage.xml index 4a4cf6c36..d59b38b29 100644 --- a/chapter09/usage.xml +++ b/chapter09/usage.xml @@ -235,50 +235,6 @@ EOF For information on kernel module loading and udev, see . - @@ -293,11 +249,11 @@ EOF (CMOS) clock. If the hardware clock is set to UTC, this script will convert the hardware clock's time to the local time using the /etc/localtime file (which tells the - hwclock program which timezone the user is in). There is no + hwclock program which timezone to use). There is no way to detect whether or not the hardware clock is set to UTC, so this needs to be configured manually. - The setclock is run via + The setclock program is run via udev when the kernel detects the hardware capability upon boot. It can also be run manually with the stop parameter to store the system time to the CMOS clock. @@ -315,7 +271,7 @@ EOF Change the value of the UTC variable below to a value of 0 (zero) if the hardware clock - is not set to UTC time. + is NOT set to UTC time. Create a new file /etc/sysconfig/clock by running the following: @@ -336,7 +292,7 @@ EOF at . It explains issues such as time zones, UTC, and the TZ environment variable. - The CLOCKPARAMS and UTC paramaters may be alternatively set + The CLOCKPARAMS and UTC paramaters may also be set in the /etc/sysconfig/rc.site file. @@ -352,7 +308,7 @@ EOF This section discusses how to configure the console - bootscript that sets up the keyboard map, console font and console kernel log + bootscript that sets up the keyboard map, console font, and console kernel log level. If non-ASCII characters (e.g., the copyright sign, the British pound sign and Euro symbol) will not be used and the keyboard is a U.S. one, much of this section can be skipped. Without the configuration file, (or @@ -505,7 +461,7 @@ EOF Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous example, bright colors are no longer available on the Linux console unless - a framebuffer is used. If one wants to have bright colors without + a framebuffer is used. If one wants to have bright colors without a framebuffer and can live without characters not belonging to his language, it is still possible to use a language-specific 256-glyph font, as illustrated below: @@ -548,7 +504,7 @@ EOF are not multibyte. This deficiency doesn't affect keymaps for European languages, because there accents are added to unaccented ASCII characters, or two ASCII characters are composed together. However, in - UTF-8 mode it is a problem, e.g., for the Greek language, where one + UTF-8 mode it is a problem; e.g., for the Greek language, where one sometimes needs to put an accent on the letter alpha. The solution is either to avoid the use of UTF-8, or to install the X window system that doesn't have this limitation in its input @@ -556,11 +512,11 @@ EOF - For Chinese, Japanese, Korean and some other languages, the Linux + For Chinese, Japanese, Korean, and some other languages, the Linux console cannot be configured to display the needed characters. Users who need such languages should install the X Window System, fonts that cover the necessary character ranges, and the proper input method (e.g., - SCIM, it supports a wide variety of languages). + SCIM, supports a wide variety of languages). @@ -571,7 +527,7 @@ EOF The /etc/sysconfig/console file only controls the Linux text console localization. It has nothing to do with setting the proper keyboard layout and terminal fonts in the X Window System, with - ssh sessions or with a serial console. In such situations, limitations + ssh sessions, or with a serial console. In such situations, limitations mentioned in the last two list items above do not apply. @@ -585,9 +541,9 @@ EOF configuring - At times, it is desired to create files at boot time. For instance, + At times, it is desirable to create files at boot time. For instance, the /tmp/.ICE-unix directory - may be desired. This can be done by creating an entry in the + is often needed. This can be done by creating an entry in the /etc/sysconfig/createfiles configuration script. The format of this file is embedded in the comments of the default configuration file. -- cgit v1.2.3-54-g00ecf