| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 | <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [  <!ENTITY % general-entities SYSTEM "../general.ent">  %general-entities;]><sect1 id="ch-scripts-network"><title>Configuring the network script</title><?dbhtml filename="network.html"?><indexterm zone="ch-scripts-network"><primary sortas="d-network">network</primary><secondary>configuring</secondary></indexterm><para>This section only applies if you're going to configure a networkcard.</para><para>If you don't have any network cards, you are most likely not going tocreate any configuration files relating to network cards. If that is thecase, you must remove the <filename class="symlink">network</filename> symlinks from all therun-level directories(<filename class="directory">/etc/rc.d/rc*.d</filename>)</para><sect2><title>Creating network interface configuration files</title><para>Which interfaces are brought up and down by the network script depends onthe files in the <filename class="directory">/etc/sysconfig/network-devices</filename> directory. Thisdirectory should contain subdirectories in the form of<filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is a networkinterface name (such as eth0)</para><para>If you decide to rename or move this<filename class="directory">/etc/sysconfig/network-devices</filename> directory,make sure you update the <filename>/etc/sysconfig/rc</filename> file as well andupdate the <quote>network_devices</quote> by providing it with the new path.</para><para>Now, new files are created in that directory.  The following commandcreates a sample <filename>ipv4</filename> file for the<filename>eth0</filename> device:</para><screen><userinput>cd /etc/sysconfig/network-devices &&mkdir ifconfig.eth0 &&cat > ifconfig.eth0/ipv4 << "EOF"ONBOOT=yesSERVICE=ipv4-staticIP=192.168.1.1GATEWAY=192.168.1.2PREFIX=24BROADCAST=192.168.1.255EOF</userinput></screen><para>Of course, the values of those variables have to be changed in every fileto match the proper setup. If the ONBOOT variable is set to <quote>yes</quote>,the network script will bring up the equivalent interface during the booting ofthe system.  If set to anything but <quote>yes</quote>, the equivalent interfacewill be ignored by the network script and not brought up.</para><para>The SERVICE entry defines the method of obtaining the IP address.  The LFSbootscripts have a modular IP assignment format, and by creating additionalfiles in<filename class="directory">/etc/sysconfig/network-devices/services</filename>,you can allow other IP assignment methods.  This would commonly be used if youneed DHCP, which is addressed in the BLFS book.</para><para>Of course, GATEWAY should contain the IP of your default gateway, if youhave one. If not, then don't include the GATEWAY line in the configurationfile.</para></sect2><sect2 id="resolv.conf"><title>Creating the /etc/resolv.conf file</title><indexterm zone="resolv.conf"><primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary></indexterm><para>If you're going to be connected to the Internet then most likely you'llneed some means of DNS name resolution to resolve Internet domain names to IPaddresses. This is best achieved by placing the IP address of your assigned DNSresolver, available from your ISP (Internet Service Provider) or networkadministrator, into <filename>/etc/resolv.conf</filename>. Create the file byrunning the following:</para><screen><userinput>cat > /etc/resolv.conf << "EOF"# Begin /etc/resolv.confdomain {<replaceable>[Your Domain Name]</replaceable>}nameserver <replaceable>[IP address of your nameserver]</replaceable># End /etc/resolv.confEOF</userinput></screen><para>Of course, replace<replaceable>[IP address of your nameserver]</replaceable> with the IP addressof the DNS resolver assigned for your use. There will often be more than oneentry (requirements demand secondary servers for fallback capability). The IPaddress may even be a router on your local network.</para></sect2></sect1>
 |