$ ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:08:a1:91:08:a4 inet addr:158.108.xx.yy Bcast:158.108.213.127 Mask:255.255.255.128 inet6 addr: fe80::208:a1ff:fe91:8a4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:130315 errors:0 dropped:0 overruns:0 frame:0 TX packets:71707 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:40944583 (40.9 MB) TX bytes:10263714 (10.2 MB) Interrupt:17 Base address:0x9000
$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 158.108.213.0 0.0.0.0 255.255.255.128 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0 0.0.0.0 158.108.213.1 0.0.0.0 UG 100 0 0 eth0
NETWORKING=yes HOSTNAME=linux.klainfo.com ONBOOT=yes
DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=158.108.xx.yy NETMASK=255.255.255.128 GATEWAY=158.108.213.1
$ service network restart; nslookup www.google.co.jp
$ yum install bind bind-chroot
acl ku {158.108.0.0/16;};
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
listen-on port 53 {127.0.0.1;};
allow-query {127.0.0.1;};
};
zone "yourhost.net"{
type master;
file "yourhost.net.for";
};
zone "xx.108.158.in-addr.arpa"{
type master;
file "yourhost.net.rev";
};
include "/etc/rndc.key";
$TTL 86400 $origin yourhost.net. @ IN SOA yourhost.net. root.yourhost.net. ( 2005081101 ;serial 3H ;refresh 15M ;retry 1W ;expiry 1D) ;minimum IN NS yourhost.net. IN MX 10 yourhost.net. ns IN A 158.108.xx.yy www IN CNAME ns www2 IN CNAME ns
$TTL 86400 @ IN SOA yourhost.net. root.yourhost.net. ( 2005081001 ;serial (d.adams) 3H ;refresh 15M ;retry 1W ;expiry 1D) ;minimum IN NS yourhost.net. yy IN PTR ns.yourhost.net. yy IN PTR www.yourhost.net. yy IN PTR www2.yourhost.net.
$ service named restart $ chkconfig --level 3 named on
domain yourhost.net search yourhost.net nameserver 127.0.0.1
$ nslookup www.yourhost.net # forward lookup $ nslookup 158.108.xx.yy # reverse lookup
tail /var/log/message
$ yum install httpd
Mostly use following this command$ service httpd (start|stop|restart|status)Run Level 3 when booting
$ chkconfig --level 3 httpd on
DocumentRoot "/var/www/html"
#UserDir disable
UserDir public_html
$ service httpd restart
$ lynx http://localhost/~%username
$ chmod 701 /home/$username $ chmod 705 /home/%username/public_html $ chmod 604 -R /home/%username/public_html/*
<Directory /home/webman/htdocs/> Options Indexes Includes ExecCGI AllowOverride None order allow,deny allow from all </Directory>
This directive uses for allow directory overriding
To set allow and deny sequence
order allow,deny deny from all allow from .cpe.ku.ac.th allow from 158.108.The server allow any host which is in .cpe.ku.ac.th domain and has IP address leading 158.108.
But without that allowed host, another host is denied.
order deny,allow deny from .cpe.ku.ac.th deny from 158.108. allow from allThe server deny any host which is in .cpe.ku.ac.th domain and has IP address leading 158.108.
But without that denied host, another host is allowed.
$ vi /etc/httpd/conf/httd.conf หาบรรทัดที่มีคำว่า AllowOverride None ให้แก้เป็น AllowOverride All
AuthUserFile /var/www/html/private/passwords AuthGroupFile /dev/null AuthName “Welcome" AuthType Basic <Limit GET> require valid-user </Limit>
$ htpasswd -c <password file name> <user> # create password file $ htpasswd -c <password file name> <user> # add user