Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet185/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   181   182   183   184   185   186   187   188   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

hostname
. This script might also establish values for variables such as 
GATEWAY, GATEWAYDEV, and NOZEROCONF that store the IP address of the net-
work’s gateway device, the type of device, and whether zero-configuration networking
*
is available or not. The network script makes sure the program /sbin/ip exists because, 
without this, the computer is unable to assign IP addresses to the interface device(s).
Next, the network service’s script executes the script
/etc/sysconfig/network-
scripts/network-functions
. The functions defined here perform three types of 
tasks. First, they query devices for status such as whether an interface is up or down, what 
the MAC address is of a given interface, or whether there is a wireless device available. 
Second, they establish values such as hostnames, IP addresses, and add to default routes. 
Third, they can locate the gateway of the local network.
The network service script concludes by establishing all available interface devices (other 
than lo). This includes establishing information about each device such as the device’s 
name and manner by which an IP address is obtained. We describe this in more detail in 
the next section.
At this point, your interfaces should be up and available along with IP addresses as 
obtained by a DHCP server or established as static (see Section 12.4). Most of these activi-
ties are handled through scripts in /etc/sysconfig/network-scripts. These include ifup-eth, 
*
Zero-configuration networking permits computers on a network to establish communication automatically without the 
need for an administrator to set up the necessary services. For instance, in a network with zero configuration, comput-
ers should be able to automatically obtain an IP address and the location of their local DNS servers. Avahi-daemon, 
discussed later, is an example of a zero-configuration service.


Network Configuration

495
ifup-ipv6, ifup-ppp, ifup-routes, and init.ipv6-global. The ifup scripts start the various 
device interfaces, obtain IPv4 and IPv6 addresses, and establish data to be placed into the 
ifcfg configuration files (e.g., ifcfg-eth0 and ifcfg-lo).
12.3.2 The /etc/sysconfig/network-scripts Directory’s Contents
Let us explore the /etc/sysconfig/network-scripts directory in a little more detail. The list-
ing is shown in Figure 12.3. There are four types of files here. First, there are two data files: 
ifcfg-eth0
and 
ifcfg-lo
. These files contain configuration information about this 
computer’s two interface devices, eth0 and lo. Next, there are several executable scripts. 
These are all named 
ifdown-
device
and 
ifup-
device
as in 
ifdown-eth
and 
ifup-
ippp
. There are two such scripts, 
ifdown-isdn
and 
ifup-isdn
, which are actually sym-
bolic links to 
ifdown-ippp
and 
ifup-ippp,
respectively. The files 
ifdown
and 
ifup
are also symbolic links, but in this case to services located in 
/sbin

/sbin/ifdown
and 
/sbin/ifup
. Finally, the files 
network-functions
and 
network-functions-ipv6
are script files containing network script functions, as mentioned earlier.
Most of the scripts in this directory are of the form 
ifdown
or 
ifup
. As you might 
expect, 
ifdown
is used to bring an interface down while 
ifup
is used to start an inter-
face. The scripts ifdown and ifup expect an interface as an argument as in 
ifdown eth0

The remainder of these scripts are named after specific interfaces, so that, for instance, 
ifdown eth0
and 
ifdown-eth
will accomplish the same thing. The interfaces covered 
by these scripts are bnep, eth, ippp, ipv6, isdn, post, ppp, routes, sit, and tunnel. The ifup 
version also includes scripts for aliases, plip, plusb, and wireless. We will not explore the 
content of these 
ifup
and 
ifdown
scripts as they are very involved. If you are interested 
in studying these devices, you should explore a text on Linux networking.
Let us instead focus on one of the two configuration files, 
ifcfg-eth0
. You will have 
a configuration file for each network interface device. In the computer illustrated in Figure 
12.3, there are only two interface devices, eth0 and lo. The ifcfg-eth0 file contains a listing 
of a number of environment variables as used by the networking services. These values are 
established at the time the network is brought up (or when ifup-eth0 is called upon to bring 
up the Ethernet device).
Some of the most important variables and their content are shown in Table 12.3 along 
with the meaning and range of values permissible. Of particular note are BOOTPROTO, 
BROADCAST, GATEWAY, HWADDR, and ONBOOT. These five values specify the 
mechanism by which this device will be given an IP address (statically assigned, assigned 
by DHCP, or none), the IP address of this device’s broadcast device, the IP address of this 
FIGURE 12.3 
Contents of the network-scripts directory.


496

Linux with Operating System Concepts
device’s gateway device, the MAC address of this device, and whether the device should be 
started upon boot.
Notice that BROADCAST and GATEWAY are IP addresses of the network/subnet-
work’s broadcast device and gateway device, respectively. These variables are typically 
not assigned if BOOTPROTO is dhcp. If BOOTPROTO is static, you should have one but 
not necessarily both values assigned. Also, if BOOTPROTO is dhcp, you would not have 
an entry for IPADDR; instead, this is filled in only if you want to statically assign an IP 
address to your interface.
Let us consider the role of the value NETMASK. A broadcast device may need to deter-
mine a network address from an IP address. This is performed by ANDing the IP address 
to the network’s netmask. Thus, we store this value in the variable NETMASK. Let us look 
at a couple of examples.
If the netmask is 255.255.240.0 and the IP address is 10.11.12.13, then we obtain the local 
network’s address as 255.255.240.0 AND 10.11.12.13. First, we have to convert these two 
sets of octets from decimal to binary.
255.255.192.0 
=
11111111.11111111.11110000.00000000
10.11.12.13 
=
00001010.00001011.00001100.00001101
TABLE 12.3 
Contents of eth0 Configuration File

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   181   182   183   184   185   186   187   188   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish