Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Name based
IP based
Port based
Slide 6
Requirements
Packages
httpd-2.0.52-9.ent.i386.rpm
httpd-devel-2.0.52-9.ent.i386.rpm
httpd-manual-2.0.52-9.ent.i386.rpm
httpd-suexec-2.0.52-9.ent.i386.rpm
Port Numbers
80 Http
Configuration File
/etc/httpd/conf/httpd.conf
Service
httpd
Daemon
httpd
2
Virtual Hosting Name Based Configuration
DNS
DNS
Server
Server
192.168.0.253
192.168.0.253 server
server
Web
Web
Server
Server www.zoom.com
www.zoom.com
192.168.0.254
192.168.0.254
www.ibm.com
www.ibm.com
Linux
Linux Windows
Windows
Client
Client Client
Client
192.168.0.1
192.168.0.1 client1
client1 192.168.0.2
192.168.0.2 client2
client2
ZOOM.COM
ZOOM.COM
3
Configuring DNS Server
Install
Installthe
thepackage
packageby
byusing
usingone
oneof
ofthe
theinstallation
installationmethods
methods
[root@comp1~]#
[root@comp1~]# mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS/ /mnt
mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS/ /mnt
[root@comp1
[root@comp1~]#
~]#cd cd /mnt
/mnt
[root@comp1
[root@comp1~]#
~]#rpm
rpm -ivh
-ivh bind*
bind* caching*
caching* --force
--force --aid
--aid
Open
Openconfiguration
configurationfor
forediting
editing
[root@comp1~]# vi /etc/named.conf
[root@comp1~]# vi /etc/named.conf
4
/etc/named.conf
To
Tochange
change the
theoptions
options
zone "zoom.com" IN
zone"zoom.com" IN{{
type
typemaster;
master;
file zoom.for";
file zoom.for";
};
};
zone
zone ibm.com"
ibm.com" IN
IN{{
type
typemaster;
master;
file
file ibm.for";
ibm.for";
};
};
5
Configuring Forward Lookup
Copying
CopyingForward
Forwardlookup
lookupzone
zonefile
file
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1
[root@comp1named]#
named]# cp
cp localhost.zone
localhost.zone zoom.for
zoom.for
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 named]# vi zoom.for
[root@comp1 named]# vi zoom.for
6
/var/named/chroot/var/named/zoom.for
To
Toadd
addthe
theoptions
options
$TTL
$TTL 86400
86400
@@ IN
IN SOA
SOA server.zoom.com.
server.zoom.com.root.zoom.com.(
root.zoom.com.(
42
42 ;;serial
serial(d.
(d.adams)
adams)
3H
3H ;;refresh
refresh
15M
15M ;;retry
retry
1W
1W ;;expiry
expiry
1D
1D)) ;;minimum
minimum
IN
IN NS
NS server.zoom.com.
server.zoom.com.
server
server IN
IN AA 192.168.0.253
192.168.0.253
server2
server2 IN
IN AA 192.168.0.254
192.168.0.254
www
www IN
IN CNAME
CNAME server2
server2
7
Configuring Forward Lookup
Copying
CopyingForward
Forwardlookup
lookupzone
zonefile
file
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1
[root@comp1named]#
named]# cp
cp localhost.zone
localhost.zone ibm.for
ibm.for
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 named]# vi ibm.for
[root@comp1 named]# vi ibm.for
8
/var/named/chroot/var/named/ibm.for
To
Toadd
addthe
theoptions
options
$TTL
$TTL 86400
86400
@@ IN
IN SOA
SOA server.ibm.com.
server.ibm.com.root.ibm.com.(
root.ibm.com.(
42
42 ;;serial
serial(d.
(d.adams)
adams)
3H
3H ;;refresh
refresh
15M
15M ;;retry
retry
1W
1W ;;expiry
expiry
1D
1D)) ;;minimum
minimum
IN
IN NS
NS server.ibm.com.
server.ibm.com.
server
server IN
IN AA 192.168.0.253
192.168.0.253
server2
server2 IN
IN AA 192.168.0.254
192.168.0.254
www
www IN
IN CNAME
CNAME server2
server2
9
Configuring DNS Server IP address
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 ~]# vi /etc/resolv.conf
[root@comp1 ~]# vi /etc/resolv.conf
Add
Addthe
theDNS
DNSserver
serverIP
IPaddress
addressin
infile
file/etc/resolv.conf
/etc/resolv.conf
nameserver 192.168.0.253
nameserver 192.168.0.253
10
DNS Server
To
Torestart
restartthe
theDNS
DNSservices
services
[root@comp1 ~]# service named restart
[root@comp1 ~]# service named restart
11
Checking from DNS Server
Checking
CheckingForward
ForwardLookup
Lookup
[root@comp1 ~]# dig www.zoom.com
[root@comp1 ~]# dig www.zoom.com
[root@comp1
[root@comp1~]#
~]#dig
dig www.ibm.com
www.ibm.com
Checking
CheckingName
Nameresolution
resolution
[root@comp1 ~]# ping www.zoom.com
[root@comp1 ~]# ping www.zoom.com
[root@comp1
[root@comp1~]#
~]#ping
ping www.ibm.com
www.ibm.com
12
Configuring HTTP Server
Install
Installthe
thepackage
packageby
byusing
usingone
oneof
ofthe
theinstallation
installationmethods
methods
[root@comp1
[root@comp1 ~]# mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS//mnt
~]# mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS/ /mnt
[root@comp1
[root@comp1~]#
~]#cd
cd /mnt
/mnt
[root@comp1
[root@comp1~]#
~]#rpm
rpm -ivh
-ivh httpd*
httpd* --force
--force --aid
--aid
Open
Openconfiguration
configurationfor
forediting
editing
[root@comp1~]#
[root@comp1~]#vi
vi etc/httpd/conf/httpd.conf
etc/httpd/conf/httpd.conf
13
/etc/httpd/conf/httpd.conf
Add
Addthe
thebelow
belowlines
lines
NameVirtualHost
NameVirtualHost*:80
*:80
<VirtualHost
<VirtualHost*:80>
*:80>
ServerAdmin
ServerAdmin root@zoom.com
root@zoom.com
DocumentRoot
DocumentRoot /var/www/html
/var/www/html
ServerName
ServerName www.zoom.com
www.zoom.com
DirectoryIndex
DirectoryIndex zoom.html
zoom.html
</VirtualHost>
</VirtualHost>
<VirtualHost
<VirtualHost*:80>
*:80>
ServerAdmin
ServerAdmin root@ibm.com
root@ibm.com
DocumentRoot
DocumentRoot /var/www/html
/var/www/html
ServerName www.ibm.com
ServerName www.ibm.com
DirectoryIndex
DirectoryIndex ibm.html
ibm.html
</VirtualHost>
</VirtualHost>
14
HTTP Server
To
Torestart
restartthe
theHTTP
HTTP services
services
[root@comp1 ~]# service httpd restart
[root@comp1 ~]# service httpd restart
15
Configuring DNS on Client
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 ~]# vi /etc/resolv.conf
[root@comp1 ~]# vi /etc/resolv.conf
Add
Addthe
theDNS
DNSserver
serverIP
IPaddress
addressin
infile
file/etc/resolv.conf
/etc/resolv.conf
nameserver 192.168.0.253
nameserver 192.168.0.253
16
HTTP Client Linux
Accessing
AccessingWebserver
Webserver
Open Mozilla or Fire Fox browser.
Open Mozilla or Fire Fox browser.
In
Inthe
theaddress
addressbox
boxtype
type http://www.zoom.com
http://www.zoom.com and
and
http://www.ibm.com
http://www.ibm.com
17
HTTP Client Windows
Accessing
AccessingWebserver
Webserver
Open
Open Internet Explorer or NetscapeNavigator
Internet Explorer or Netscape Navigator browser.
browser.
In
Inthe
theaddress
addressbox
boxtype
type http://www.zoom.com
http://www.zoom.com andand
http://www.ibm.com
http://www.ibm.com
18
Virtual Hosting IP based Configuration
DNS
DNS
Server
Server
192.168.0.253 server
server
192.168.0.253
Web
Web
Server
Server www.zoom.com
www.zoom.com
192.168.0.254
192.168.0.254
192.168.0.252
192.168.0.252
www.google.com
www.google.com
Linux
Linux Windows
Windows
Client
Client Client
Client
192.168.0.1
192.168.0.1 client1
client1 192.168.0.2
192.168.0.2
client2
client2
ZOOM.COM
ZOOM.COM
19
Configuring DNS Server
Open
Openconfiguration
configurationfor
forediting
editing
[root@comp1~]# vi /etc/named.conf
[root@comp1~]# vi /etc/named.conf
20
/etc/named.conf
To
Toadd
addthe
thebelow
belowlines
lines
zone
zone google.com"
google.com" IN
IN{{
type master;
type master;
file
file google.for";
google.for";
};
};
21
Configuring Forward Lookup
Copying
CopyingForward
Forwardlookup
lookupzone
zonefile
file
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1
[root@comp1named]#
named]# cp
cp localhost.zone
localhost.zone google.for
google.for
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 named]# vi google.for
[root@comp1 named]# vi google.for
22
/var/named/chroot/var/named/google.for
To
Toadd
addthe
theoptions
options
$TTL
$TTL 86400
86400
@@ IN
IN SOA
SOA server.google.com.
server.google.com.root.google.com.(
root.google.com.(
42
42 ;;serial
serial(d.
(d.adams)
adams)
3H
3H ;;refresh
refresh
15M
15M ;;retry
retry
1W
1W ;;expiry
expiry
1D
1D)) ;;minimum
minimum
IN
IN NS
NS server.google.com.
server.google.com.
server
server IN
IN AA 192.168.0.253
192.168.0.253
server2
server2 IN
IN AA 192.168.0.252
192.168.0.252
www
www IN
IN CNAME
CNAME server2
server2
23
Configuring DNS Server IP address
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 ~]# vi /etc/resolv.conf
[root@comp1 ~]# vi /etc/resolv.conf
Add
Addthe
theDNS
DNSserver
serverIP
IPaddress
addressin
infile
file/etc/resolv.conf
/etc/resolv.conf
nameserver 192.168.0.253
nameserver 192.168.0.253
24
DNS Server
To
Torestart
restartthe
theDNS
DNSservices
services
[root@comp1 ~]# service named restart
[root@comp1 ~]# service named restart
25
Checking from DNS Server
Checking
CheckingForward
ForwardLookup
Lookup
[root@comp1 ~]# dig www.google.com
[root@comp1 ~]# dig www.google.com
Checking
CheckingName
Nameresolution
resolution
[root@comp1 ~]# ping www.google.com
[root@comp1 ~]# ping www.google.com
26
Configuring HTTP Server
Assinging
AssingingVirtual
VirtualIP
IPaddress
address
[root@comp1 ~]# netconfig --device eth0:1
[root@comp1 ~]# netconfig --device eth0:1
[root@comp1
[root@comp1~]#
~]#service
servicenetwork
networkrestart
restart
Open
Openconfiguration
configurationfor
forediting
editing
[root@comp1 ~]# vi etc/httpd/conf/httpd.conf
[root@comp1 ~]# vi etc/httpd/conf/httpd.conf
27
/etc/httpd/conf/httpd.conf
Add
Addthe
thebelow
belowlines
lines
<VirtualHost 192.168.0.252:80>
<VirtualHost 192.168.0.252:80>
ServerAdmin
ServerAdmin root@google.com
root@google.com
DocumentRoot
DocumentRoot /var/www/html
/var/www/html
ServerName
ServerName www.google.com
www.google.com
DirectoryIndex
DirectoryIndex google.html
google.html
</VirtualHost>
</VirtualHost>
28
HTTP Server
To
Torestart
restartthe
theHTTP
HTTP services
services
[root@comp1 ~]# service httpd restart
[root@comp1 ~]# service httpd restart
29
Configuring DNS on Client
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 ~]# vi /etc/resolv.conf
[root@comp1 ~]# vi /etc/resolv.conf
Add
Addthe
theDNS
DNSserver
serverIP
IPaddress
addressin
infile
file/etc/resolv.conf
/etc/resolv.conf
nameserver 192.168.0.253
nameserver 192.168.0.253
30
HTTP Client Linux
Accessing
AccessingWebserver
Webserver
Open Mozilla or Fire Fox browser.
Open Mozilla or Fire Fox browser.
In
Inthe
theaddress
addressbox
boxtype
type http://www.google.com
http://www.google.com or
or
http://192.168.0.252
http://192.168.0.252
31
HTTP Client Windows
Accessing
AccessingWebserver
Webserver
Open
Open Internet Explorer or NetscapeNavigator
Internet Explorer or Netscape Navigator browser.
browser.
In
Inthe
theaddress
addressbox
boxtype
type http://www.google.com
http://www.google.com or or
http://192.168.0.252
http://192.168.0.252
32
Virtual Hosting Port based Configuration
DNS
DNS
Server
Server
192.168.0.253 server
server
192.168.0.253
Web
Web
Server
Server www.zoom.com
www.zoom.com
192.168.0.254
192.168.0.254
www.redhat.com
www.redhat.com
Linux
Linux Windows
Windows 5000
5000
Client
Client Client
Client
192.168.0.1
192.168.0.1 client1
client1 192.168.0.2
192.168.0.2
client2
client2
ZOOM.COM
ZOOM.COM
33
Configuring DNS Server
Open
Openconfiguration
configurationfor
forediting
editing
[root@comp1~]# vi /etc/named.conf
[root@comp1~]# vi /etc/named.conf
34
/etc/named.conf
To
Toadd
addthe
thebelow
belowlines
lines
zone
zone redhat.com"
redhat.com" IN
IN {{
type master;
type master;
file
file redhat.for";
redhat.for";
};
};
35
Configuring Forward Lookup
Copying
CopyingForward
Forwardlookup
lookupzone
zonefile
file
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1 ~]# cd /var/named/chroot/var/named/
[root@comp1
[root@comp1named]#
named]# cp
cp localhost.zone
localhost.zone redhat.for
redhat.for
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 named]# vi redhat.for
[root@comp1 named]# vi redhat.for
36
/var/named/chroot/var/named/redhat.for
To
Toadd
addthe
theoptions
options
$TTL
$TTL 86400
86400
@@ IN
IN SOA
SOA server.redhat.com.
server.redhat.com.root.redhat.com.(
root.redhat.com.(
42
42 ;;serial
serial(d.
(d.adams)
adams)
3H
3H ;;refresh
refresh
15M
15M ;;retry
retry
1W
1W ;;expiry
expiry
1D
1D)) ;;minimum
minimum
IN
IN NS
NS server.redhat.com.
server.redhat.com.
server
server IN
IN AA 192.168.0.253
192.168.0.253
server2
server2 IN
IN AA 192.168.0.254
192.168.0.254
www
www IN
IN CNAME
CNAME server2
server2
37
Configuring DNS Server IP address
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 ~]# vi /etc/resolv.conf
[root@comp1 ~]# vi /etc/resolv.conf
Add
Addthe
theDNS
DNSserver
serverIP
IPaddress
addressin
infile
file/etc/resolv.conf
/etc/resolv.conf
nameserver 192.168.0.253
nameserver 192.168.0.253
38
DNS Server
To
Torestart
restartthe
theDNS
DNSservices
services
[root@comp1 ~]# service named restart
[root@comp1 ~]# service named restart
39
Checking from DNS Server
Checking
CheckingForward
ForwardLookup
Lookup
[root@comp1 ~]# dig www.redhat.com
[root@comp1 ~]# dig www.redhat.com
Checking
CheckingName
Nameresolution
resolution
[root@comp1 ~]# ping www.redhat.com
[root@comp1 ~]# ping www.redhat.com
40
Configuring HTTP Server
Open
Openconfiguration
configurationfor
forediting
editing
[root@comp1
[root@comp1~]#
~]#vi
vi etc/httpd/conf/httpd.conf
etc/httpd/conf/httpd.conf
41
/etc/httpd/conf/httpd.conf
Add
Addthe
thebelow
belowlines
lines
LISTEN
LISTEN5000
5000
<VirtualHost
<VirtualHost 192.168.0.253:5000>
192.168.0.253:5000>
ServerAdmin
ServerAdmin root@redhat.com
root@redhat.com
DocumentRoot
DocumentRoot /var/www/html
/var/www/html
ServerName www.redhat.com
ServerName www.redhat.com
DirectoryIndex
DirectoryIndex redhat.html
redhat.html
</VirtualHost>
</VirtualHost>
42
HTTP Server
To
Torestart
restartthe
theHTTP
HTTP services
services
[root@comp1 ~]# service httpd restart
[root@comp1 ~]# service httpd restart
43
Configuring DNS on Client
Open
Openconfiguration
configurationfor
for editing
editing
[root@comp1 ~]# vi /etc/resolv.conf
[root@comp1 ~]# vi /etc/resolv.conf
Add
Addthe
theDNS
DNSserver
serverIP
IPaddress
addressin
infile
file/etc/resolv.conf
/etc/resolv.conf
nameserver 192.168.0.253
nameserver 192.168.0.253
44
HTTP Client Linux
Accessing
AccessingWebserver
Webserver
Open Mozilla or Fire Fox browser.
Open Mozilla or Fire Fox browser.
In
Inthe
theaddress
addressbox
boxtype
type http://www.redhat.com:5000
http://www.redhat.com:5000 or
or
http://192.168.0.254:5000
http://192.168.0.254:5000
45
HTTP Client Windows
Accessing
AccessingWebserver
Webserver
Open
Open Internet Explorer or NetscapeNavigator
Internet Explorer or Netscape Navigator browser.
browser.
In
Inthe
theaddress
addressbox
boxtype
type http://www.redhat.com:5000
http://www.redhat.com:5000 or or
http://192.168.0.254:5000
http://192.168.0.254:5000
46