忍者ブログ

◆当blogは、Linuxサーバ構築する際の実際の設定手順を個人的メモとして記載しております。LinuC試験の役に立つ情報があるかも…?

LinuC(Linux技術者認定資格)&リナックスサーバ構築設定事例

   
カテゴリー「Linux全般」の記事一覧

【デバイス/ファイル】

[root@A]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
/dev/VolGroup00/LogVol03 /tmp                    ext3    defaults        1 2
/dev/VolGroup00/LogVol02 /var                    ext3    defaults,usrquota,grpquota        1 2
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0

[root@A]# cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc

[root@A]# cat /etc/mtab
/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0

[root@A]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
/dev /dev tmpfs rw 0 0

[root@A]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)

[root@A]# sync

[root@A]# dd if=/dev/zero of=/tmp/swapfile bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.117411 seconds, 447 MB/s

[root@A]# mkswap /tmp/swapfile
Setting up swapspace version 1, size = 52424 kB

[root@A]# swapon /tmp/swapfile

[root@A]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/mapper/VolGroup00-LogVol01         partition       1048568 0       -1
/tmp/swapfile                           file            51192   0       -2

[root@A]# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/mapper/VolGroup00-LogVol01         partition       1048568 0       -1
/tmp/swapfile                           file            51192   0       -2

[root@A]# cdrecord -scanbus
Cdrecord-Clone 2.01 (cpu-pc-linux-gnu) Copyright (C) 1995-2004 Jg Schilling
Note: This version is an unofficial (modified) version with DVD support
Note: and therefore may have bugs that are not present in the original.
Note: Please send bug reports or support requests to http://bugzilla.redhat.com/bugzilla
Note: The author of cdrecord should not be bothered with problems in this version.
cdrecord: Invalid or incomplete multibyte or wide character. Cannot open SCSI driver.
cdrecord: For possible targets try 'cdrecord -scanbus'.
cdrecord: For possible transport specifiers try 'cdrecord dev=help'.

[root@A]# dumpe2fs /dev/sda1 | more
Inode count:              26104
Block count:              104388
Reserved block count:     5219
Free blocks:              89012
Free inodes:              26070
First block:              1
Block size:               1024
Group 1: (Blocks 8193-16384)
  Backup superblock at 8193, Group descriptors at 8194-8194

[root@A]# fsck.ext3
Emergency help:
 -p                   Automatic repair (no questions)
 -n                   Make no changes to the filesystem
 -y                   Assume "yes" to all questions
 -c                   Check for bad blocks and add them to the badblock list
 -f                   Force checking even if filesystem is marked clean
 -v                   Be verbose
 -b superblock        Use alternative superblock
 -B blocksize         Force blocksize when looking for superblock
 -j external_journal  Set location of the external journal
 -l bad_blocks_file   Add to badblocks list
 -L bad_blocks_file   Set badblocks list

[root@A]# e2fsck
Emergency help:
 -p                   Automatic repair (no questions)
 -n                   Make no changes to the filesystem
 -y                   Assume "yes" to all questions
 -c                   Check for bad blocks and add them to the badblock list
 -f                   Force checking even if filesystem is marked clean
 -v                   Be verbose
 -b superblock        Use alternative superblock
 -B blocksize         Force blocksize when looking for superblock
 -j external_journal  Set location of the external journal
 -l bad_blocks_file   Add to badblocks list
 -L bad_blocks_file   Set badblocks list

[root@A]# tune2fs -l /dev/sda1
Inode count:              26104
Block count:              104388
Reserved block count:     5219
Free blocks:              89012
Free inodes:              26070
First block:              1
Block size:               1024

[root@A]# badblocks /dev/sda1

[root@A]# debugfs /dev/sda1
debugfs 1.39 (29-May-2006)
debugfs:  ls
 2  (12) .    2  (12) ..    11  (20) lost+found    16065  (36) grub
 12  (16) message    17  (44) initrd-2.6.18-128.el5.img
 13  (36) System.map-2.6.18-128.el5    14  (32) config-2.6.18-128.el5
 15  (36) symvers-2.6.18-128.el5.gz    16  (780) vmlinuz-2.6.18-128.el5
debugfs:  quit

[root@A]# cat /etc/auto.master
/misc   /etc/auto.misc

[root@A]# /etc/init.d/autofs restart
automount を停止中:                                        [  OK  ]
automount を起動中:                                        [  OK  ]

[root@A]# ls -l /etc/auto.*
-rw-r--r-- 1 root root  717  1月 21  2009 /etc/auto.master
-rw-r--r-- 1 root root  581  1月 21  2009 /etc/auto.misc
-rwxr-xr-x 1 root root 1292  1月 21  2009 /etc/auto.net
-rwxr-xr-x 1 root root  715  1月 21  2009 /etc/auto.smb

[root@A]# cat /etc/auto.master
/misc   /etc/auto.misc

[root@A]# cat /etc/auto.misc
cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

[root@A]# ls -l /dev/sda{,1,2}
brw-r----- 1 root disk 8, 0  1月  5 16:42 /dev/sda
brw-r----- 1 root disk 8, 1  1月  5 16:42 /dev/sda1
brw-r----- 1 root disk 8, 2  1月  5 16:42 /dev/sda2

[root@A]# ls -l /dev/{ttyS0,input/mice,lp0}
crw------- 1 root root 13, 63  1月  5 16:42 /dev/input/mice
crw-rw---- 1 root lp    6,  0  1月  5 16:42 /dev/lp0
crw-rw---- 1 root uucp  4, 64  1月  5 16:41 /dev/ttyS0

[root@A]# cat /proc/devices
Character devices:
  1 mem
  4 ttyS
  5 /dev/tty
  5 /dev/console
  6 lp
 10 misc
180 usb
189 usb_device

Block devices:
  1 ramdisk
  2 fd
  8 sd
  9 md

[root@A]# ls /etc/udev/rules.d
05-udev-early.rules  51-hotplug.rules  60-pcmcia.rules
61-uinput-stddev.rules  90-alsa.rules  95-pam-console.rules
40-multipath.rules   60-libsane.rules  60-raw.rules

[root@A]# cat /etc/udev/rules.d/50-udev.rules
KERNEL=="tty",                  NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule"

[root@A]# udevinfo -q path -n /dev/sda1
/block/sda/sda1

root@A]# udevinfo -q env -n /dev/sda1
ID_VENDOR=VMware,
ID_MODEL=VMware_Virtual_S
ID_REVISION=1.0

PR

【システム起動】

[root@A]# dmesg | more
Linux version 2.6.18-128.el5 (mockbuild@builder16.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed
 Jan 21 10:44:23 EST 2009

[root@A]# cat /etc/inittab
id:5:initdefault:
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

[root@A]# ls /etc/rc3.d
K01dnsmasq         K35dovecot     K88wpa_supplicant   S08iptables    
S19rpcgssd         S50snmpd       S90xfs              K02NetworkManager
K35smb             K89dund        S08mcstrans         S22messagebus

[root@A]# ls -l /etc/rc3.d/S85httpd
lrwxrwxrwx 1 root root 15   羈0  2010 /etc/rc3.d/S85httpd -> ../init.d/httpd

[root@A]# /etc/init.d/httpd start
httpd を起動中:     [ OK ]

[root@A]# chkconfig --list httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

[root@A]# chkconfig httpd off

[root@A]# chkconfig httpd on

[root@A]# chkconfig --level 235 httpd on

[root@A]# ntsysv

[root@A]# cat /boot/grub/menu.lst
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-128.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-128.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-128.el5.img

[root@A]# grub
Probing devices to guess BIOS drives. This may take a long time.
   GNU GRUB  version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported.  For the first word, TAB
  lists possible command completions.  Anywhere else TAB lists the possible
  completions of a device/filename.]
grub> displaymem
 EISA Memory BIOS Interface is present
 Address Map BIOS Interface is present
 Lower memory: 640K, Upper memory (to first chipset hole): 3072K
 [Address Range Descriptor entries immediately follow (values are 64-bit)]
   Usable RAM:  Base Address:  0x0 X 4GB + 0x0,
      Length:   0x0 X 4GB + 0xa0000 bytes
   Reserved:  Base Address:  0x0 X 4GB + 0xa0000,
      Length:   0x0 X 4GB + 0x60000 bytes
   Usable RAM:  Base Address:  0x0 X 4GB + 0x100000,
      Length:   0x0 X 4GB + 0x300000 bytes
grub>
quit

[root@A]# cat /etc/lilo.conf

[root@A]# /sbin/lilo

[root@A]# cat /proc/cmdline
ro root=/dev/VolGroup00/LogVol00 rhgb quiet

【カーネル】

[root@A]# uname -a
Linux sentos5.localdomain 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686 i686 i386 GNU/Linux

[root@A]# uname -r
2.6.18-128.el5

[root@A]# uname -m
i686

[root@A]# cat /proc/version
Linux version 2.6.18-128.el5 (mockbuild@builder16.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Jan 21 10:44:23 EST 2009

[root@A]# head -4 /usr/src/linux/Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL =18
EXTRAVERSION = -128.el5

[root@A]# ls /boot/vmlinuz*
/boot/vmlinuz-2.6.18-128.el5

[root@A]# ls -ld /lib/modules/2.6.18-128.el5/kernel/*
drwxr-xr-x  3 root root 4096    羇  2010 /lib/modules/2.6.18-128.el5/kernel/arch
drwxr-xr-x 39 root root 4096    羇  2010 /lib/modules/2.6.18-128.el5/kernel/drivers
drwxr-xr-x 30 root root 4096    羇  2010 /lib/modules/2.6.18-128.el5/kernel/fs
drwxr-xr-x  2 root root 4096    羇  2010 /lib/modules/2.6.18-128.el5/kernel/kernel
drwxr-xr-x  4 root root 4096    羇  2010 /lib/modules/2.6.18-128.el5/kernel/lib
drwxr-xr-x 21 root root 4096    羇  2010 /lib/modules/2.6.18-128.el5/kernel/net

[root@A]# lsmod
Module                  Size  Used by
nfsd                  202097  17
exportfs                9665  1 nfsd
lockd                  61257  2 nfsd
nfs_acl                 7617  1 nfsd

[root@A]# cat /proc/modules
nfsd 202097 17 - Live 0xe0c3a000
exportfs 9665 1 nfsd, Live 0xe0b72000
lockd 61257 2 nfsd, Live 0xe0bf7000
nfs_acl 7617 1 nfsd, Live 0xe0b6f000
auth_rpcgss 43105 1 nfsd, Live 0xe0bd7000

[root@A]# modinfo ext3
filename:       /lib/modules/2.6.18-128.el5/kernel/fs/ext3/ext3.ko
license:        GPL
description:    Second Extended Filesystem with journaling extensions
author:         Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others

[root@A]# modinfo -n ext3
/lib/modules/2.6.18-128.el5/kernel/fs/ext3/ext3.ko

[root@A]# modinfo -l ext3
GPL

[root@A]# modinfo -d ext3
Second Extended Filesystem with journaling extensions

[root@A]# modinfo -a ext3
Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others

[root@A]# insmod /lib/modules/2.6.18-128.el5/kernel/fs/ext2/ext2.ko

[root@A]# modprobe -c
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias eth0 pcnet32

[root@A]# modprobe -lt fs
/lib/modules/2.6.18-128.el5/kernel/fs/autofs4/autofs4.ko
/lib/modules/2.6.18-128.el5/kernel/fs/cachefiles/cachefiles.ko
/lib/modules/2.6.18-128.el5/kernel/fs/cifs/cifs.ko

[root@A]# modprobe --show-depends ext3
insmod /lib/modules/2.6.18-128.el5/kernel/fs/jbd/jbd.ko
insmod /lib/modules/2.6.18-128.el5/kernel/fs/ext3/ext3.ko

[root@A]# ls /lib/modules/2.6.18-128.el5/modules.dep
/lib/modules/2.6.18-128.el5/modules.dep

[root@A]# cat /etc/modprobe.conf
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias eth0 pcnet32

[root@A]# ls -l /etc/modprobe.d/*
-rw-r--r-- 1 root root  810    羚  2009 /etc/modprobe.d/blacklist
-rw-r--r-- 1 root root   83   羃2  2009 /etc/modprobe.d/blacklist-firewire
-rw-r--r-- 1 root root 6111   羃1  2009 /etc/modprobe.d/modprobe.conf.dist

[root@A]# cat /etc/modprobe.d/modprobe.conf.dist
alias usb-uhci uhci-hcd
alias usb-ohci ohci-hcd
install scsi_hostadapter /bin/true
install usbmouse /sbin/modprobe --first-time --ignore-install usbmouse && { /sbin/modprobe hid; /bin/true; }
remove usbmouse { /sbin/modprobe -r hid; } ; /sbin/modprobe -r --first-time --ignore-remove usbmouse
remove nfsd { /bin/umount /proc/fs/nfsd > /dev/null 2>&1 || :; } ; /sbin/modprobe -r --first-time --ignore-remove nfsd

[root@A]# ls -ld /proc/sys/kernel/*
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/ctrl-alt-del
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/domainname
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/hostname
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/hotplug
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/modprobe
-r--r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/osrelease
-r--r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/ostype
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/sem
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/shmall
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/shmmax
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/shmmni
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/sysrq
-r--r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/tainted
-rw-r--r-- 1 root root 0    羌 17:26 /proc/sys/kernel/threads-max

[root@A]# ls -ld /proc/sys/fs/*
-rw-r--r-- 1 root root 0    羌 17:29 /proc/sys/fs/file-max
-r--r--r-- 1 root root 0    羌 17:29 /proc/sys/fs/file-nr

[root@A]# ls -ld /proc/sys/net/*
dr-xr-xr-x 6 root root 0    羌 17:30 /proc/sys/net/ipv4
dr-xr-xr-x 6 root root 0    羌 17:30 /proc/sys/net/ipv6

[root@A]# ls -ld /proc/sys/net/ipv4/*
-rw-r--r-- 1 root root 0    羌 17:31 /proc/sys/net/ipv4/ip_forward
-rw-r--r-- 1 root root 0    羌 17:31 /proc/sys/net/ipv4/icmp_echo_ignore_all
-rw-r--r-- 1 root root 0    羌 17:31 /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

[root@A]# cat /etc/sysctl.conf
net.ipv4.ip_forward = 0

[root@A]# cat /etc/rc.local
net.ipv4.ip_forward = 0

[root@A]# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

[root@A]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1

[root@A]# sysctl -a
sunrpc.max_resvport = 1023
sunrpc.min_resvport = 665
sunrpc.tcp_slot_table_entries = 16

【mailコマンド】の使用例

[root]# mail←未読メールを読む場合
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/root": 5 messages 5 new
>N  1 root@reverie.example  Fri Oct 15 23:42  19/819   "Anacron job 'cron.daily'"
 N  2 root@reverie.example  Tue Oct 19 22:30  56/1735  "LogWatch for reverie.example.com"
 N  3 root@reverie.example  Tue Oct 19 22:31  19/821   "Anacron job 'cron.daily'"
 N  4 root@reverie.example  Mon Nov  1 14:52  19/818   "Anacron job 'cron.daily'"
 N  5 root@dgx.example.com  Wed Nov  3 15:29  19/796   "Anacron job 'cron.daily'"
& t1←メールを選択
Message 1:
From root@reverie.example.com  Fri Oct 15 23:42:19 2010
Date: Fri, 15 Oct 2010 23:42:18 +0900
From: root@reverie.example.com (Anacron)
To: root@reverie.example.com
Subject: Anacron job 'cron.daily'

/etc/cron.daily/tripwire-check:
****    Error: Tripwire database for reverie.example.com not found.    ****
**** Run /etc/tripwire/twinstall.sh and/or tripwire --init. ****

[root]# ls -al mbox
-rw-------    1 root     root         5044 11月  3 15:38 mbox

[root]# mail -f←既読メールを読む場合

[root]# mail -s test-mail reverie@example.com←メールを作成して送る
TEST MAIL.
.
Cc:

[root]# tail /var/log/maillog←メールのログ確認
Nov  3 15:43:11 reverie sendmail[1764]: oA36hBj5001764: from=root, size=55, class=0, nrcpts=1, msgid=<201011030643.oA36hBj5001764@reverie.example.com>, relay=root@localhost
Nov  3 15:43:11 reverie sendmail[1766]: oA36hB0K001766: from=<root@reverie.example.com>, size=346, class=0, nrcpts=1, msgid=<201011030643.oA36hBj5001764@reverie.example.com>, proto=ESMTP, daemon=Daemon0, relay=localhost.localdomain [127.0.0.1]
Nov  3 15:43:11 reverie sendmail[1764]: oA36hBj5001764: to=reverie@example.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30044, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (oA36hB0K001766 Message accepted for delivery)
Nov  3 15:43:11 reverie sendmail[1767]: oA36hB0K001766: to=<reverie@example.com>, ctladdr=<root@reverie.example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=pmlocal, pri=30549, dsn=2.0.0, stat=Sent

【自動起動(chkconfig)】の設定メモ

・例えば、namedを自動起動する場合

[root]# /sbin/chkconfig --list named
named           0:オフ  1:オフ  2:オフ  3:オフ  4:オフ  5:オフ  6:オフ

[root]# /sbin/chkconfig --level 35 named on ←ランレベル3、5で自動起動

[root]# /sbin/chkconfig --list named
named           0:オフ  1:オフ  2:オフ  3:オン  4:オフ  5:オン  6:オフ

【DNS動作確認】メモ

[root]# nslookup
Note:  nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead.  Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
> reverie
Server:         192.168.0.99
Address:        192.168.0.99#53

Name:   reverie.example.com
Address: 192.168.0.99
> reverie.example.com
Server:         192.168.0.99
Address:        192.168.0.99#53

Name:   reverie.example.com
Address: 192.168.0.99
> www
Server:         192.168.0.99
Address:        192.168.0.99#53

www.example.com canonical name = reverie.example.com.
Name:   reverie.example.com
Address: 192.168.0.99
> www.example.com
Server:         192.168.0.99
Address:        192.168.0.99#53

www.example.com canonical name = reverie.example.com.
Name:   reverie.example.com
Address: 192.168.0.99
> mail
Server:         192.168.0.99
Address:        192.168.0.99#53

mail.example.com        canonical name = reverie.example.com.
Name:   reverie.example.com
Address: 192.168.0.99
> mail.example.com
Server:         192.168.0.99
Address:        192.168.0.99#53

mail.example.com        canonical name = reverie.example.com.
Name:   reverie.example.com
Address: 192.168.0.99
> ftp
Server:         192.168.0.99
Address:        192.168.0.99#53

ftp.example.com canonical name = reverie.example.com.
Name:   reverie.example.com
Address: 192.168.0.99
> ftp.example.com
Server:         192.168.0.99
Address:        192.168.0.99#53

ftp.example.com canonical name = reverie.example.com.
Name:   reverie.example.com
Address: 192.168.0.99
> 192.168.0.99
Server:         192.168.0.99
Address:        192.168.0.99#53

99.0.168.192.in-addr.arpa       name = reverie.example.com.
> example.com
Server:         192.168.0.99
Address:        192.168.0.99#53

Name:   example.com
Address: 192.168.0.0
> www.yahoo.co.jp
Server:         192.168.0.99
Address:        192.168.0.99#53

Non-authoritative answer:
www.yahoo.co.jp canonical name = www.ya.gl.yahoo.co.jp.
Name:  
www.ya.gl.yahoo.co.jp
Address: 203.216.247.249
> set type=MX
> example.com
Server:         192.168.0.99
Address:        192.168.0.99#53

example.com     mail exchanger = 10 reverie.example.com.
> set type=AXFR
> example.com
Server:         192.168.0.99
Address:        192.168.0.99#53

example.com
        origin = reverie.example.com
        mail addr = postmaster.example.com
        serial = 2010101901
        refresh = 10800
        retry = 3600
        expire = 604800
        minimum = 86400
example.com     mail exchanger = 10 reverie.example.com.
example.com     nameserver = reverie.example.com.
Name:   example.com
Address: 192.168.0.0
ftp.example.com canonical name = reverie.example.com.
Name:   localhost.example.com
Address: 127.0.0.1
mail.example.com        canonical name = reverie.example.com.
Name:   reverie.example.com
Address: 192.168.0.99
www.example.com canonical name = reverie.example.com.
example.com
        origin = reverie.example.com
        mail addr = postmaster.example.com
        serial = 2010101901
        refresh = 10800
        retry = 3600
        expire = 604800
        minimum = 86400
> exit
[root]# dig reverie.example.com
; <<>> DiG 9.2.1 <<>> reverie.example.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16532
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;reverie.example.com.           IN      A

;; ANSWER SECTION:
reverie.example.com.    86400   IN      A       192.168.0.99

;; AUTHORITY SECTION:
example.com.            86400   IN      NS      reverie.example.com.

;; Query time: 1 msec
;; SERVER: 192.168.0.99#53(192.168.0.99)
;; WHEN: Tue Oct 19 22:28:16 2010
;; MSG SIZE  rcvd: 67

[root]# dig -x 192.168.0.99
; <<>> DiG 9.2.1 <<>> -x 192.168.0.99
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44119
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;99.0.168.192.in-addr.arpa.     IN      PTR

;; ANSWER SECTION:
99.0.168.192.in-addr.arpa. 86400 IN     PTR     reverie.example.com.

;; AUTHORITY SECTION:
0.168.192.in-addr.arpa. 86400   IN      NS      reverie.example.com.

;; ADDITIONAL SECTION:
reverie.example.com.    86400   IN      A       192.168.0.99

;; Query time: 1 msec
;; SERVER: 192.168.0.99#53(192.168.0.99)
;; WHEN: Tue Oct 19 22:28:48 2010
;; MSG SIZE  rcvd: 106

[root]# dig example.com mx
; <<>> DiG 9.2.1 <<>> example.com mx
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65275
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;example.com.                   IN      MX

;; ANSWER SECTION:
example.com.            86400   IN      MX      10 reverie.example.com.

;; AUTHORITY SECTION:
example.com.            86400   IN      NS      reverie.example.com.

;; ADDITIONAL SECTION:
reverie.example.com.    86400   IN      A       192.168.0.99

;; Query time: 0 msec
;; SERVER: 192.168.0.99#53(192.168.0.99)
;; WHEN: Tue Oct 19 22:30:27 2010
;; MSG SIZE  rcvd: 83

[root]# dig example.com axfr
; <<>> DiG 9.2.1 <<>> example.com axfr
;; global options:  printcmd
example.com.            86400   IN      SOA     reverie.example.com. postmaster.example.com. 2010101901 10800 3600 604800 86400
example.com.            86400   IN      MX      10 reverie.example.com.
example.com.            86400   IN      NS      reverie.example.com.
example.com.            86400   IN      A       192.168.0.0
ftp.example.com.        86400   IN      CNAME   reverie.example.com.
localhost.example.com.  86400   IN      A       127.0.0.1
mail.example.com.       86400   IN      CNAME   reverie.example.com.
reverie.example.com.    86400   IN      A       192.168.0.99
www.example.com.        86400   IN      CNAME   reverie.example.com.
example.com.            86400   IN      SOA     reverie.example.com. postmaster.example.com. 2010101901 10800 3600 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.0.99#53(192.168.0.99)
;; WHEN: Tue Oct 19 22:30:35 2010
;; XFR size: 11 records

[root]# tail /var/log/messages
Oct 19 22:17:37 reverie named[1455]: no IPv6 interfaces found
Oct 19 22:17:37 reverie named[1455]: listening on IPv4 interface lo, 127.0.0.1#53
Oct 19 22:17:37 reverie named[1455]: listening on IPv4 interface eth0, 192.168.0.99#53
Oct 19 22:17:37 reverie named[1455]: command channel listening on 127.0.0.1#953
Oct 19 22:17:37 reverie named[1455]: zone 0.0.127.in-addr.arpa/IN: loaded serial 2010101901
Oct 19 22:17:37 reverie named[1455]: zone 0.168.192.in-addr.arpa/IN: loaded serial 2010101901
Oct 19 22:17:37 reverie named[1455]: zone example.com/IN: loaded serial 2010101901
Oct 19 22:17:37 reverie named[1455]: running
Oct 19 22:26:26 reverie named[1455]: client 192.168.0.99#32772: transfer of 'example.com/IN': AXFR started
Oct 19 22:30:35 reverie named[1455]: client 192.168.0.99#32773: transfer of 'example.com/IN': AXFR started

[root]# dig example.com hinfo
; <<>> DiG 9.2.1 <<>> example.com hinfo
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40241
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com.                   IN      HINFO

;; AUTHORITY SECTION:
example.com.            86400   IN      SOA     reverie.example.com. postmaster.example.com. 2010101901 10800 3600 604800 86400

;; Query time: 0 msec
;; SERVER: 192.168.0.99#53(192.168.0.99)
;; WHEN: Tue Oct 19 22:32:15 2010
;; MSG SIZE  rcvd: 84

[root]# dig www.yahoo.co.jp
; <<>> DiG 9.2.1 <<>> www.yahoo.co.jp
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22639
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 3, ADDITIONAL: 3

;; QUESTION SECTION:
;www.yahoo.co.jp.               IN      A

;; ANSWER SECTION:
www.yahoo.co.jp.        430     IN      CNAME   www.ya.gl.yahoo.co.jp.
www.ya.gl.yahoo.co.jp.  60      IN      A       203.216.235.201
;; AUTHORITY SECTION:
gl.yahoo.co.jp.         430     IN      NS      gns01.net.djm.yahoo.co.jp.
gl.yahoo.co.jp.         430     IN      NS      gns02.net.bbt.yahoo.co.jp.
gl.yahoo.co.jp.         430     IN      NS      gns01.net.bbt.yahoo.co.jp.

;; ADDITIONAL SECTION:
gns01.net.bbt.yahoo.co.jp. 430  IN      A       202.93.64.132
gns01.net.djm.yahoo.co.jp. 430  IN      A       124.83.159.36
gns02.net.bbt.yahoo.co.jp. 430  IN      A       202.93.64.133

;; Query time: 22 msec
;; SERVER: 192.168.0.99#53(192.168.0.99)
;; WHEN: Tue Oct 19 22:32:31 2010
;; MSG SIZE  rcvd: 197

【smbclient 】の使用メモ

smbclientは、ftpと同じような感覚で使えるから便利だと思う。

・コマンド実行例
[root]# smbclient '\\win50\temp' -I 192.168.0.50 -U Administrator
added interface ip=192.168.0.99 bcast=192.168.0.255 nmask=255.255.255.0
Password:パスワード入力
Domain=[EXAMPLE.COM] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
smb: \>

【プロンプト表示の変更】メモ

一時的にプロンプト表示を変更するには
下記コマンド投入
export PS1="[\u@\h \W]\\$ "

プロンプト表示設定を固定化するには
上記のコマンドを「~/.bashrc」に追記
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
PS1="[\u]\\$ "

更新日付

03 2025/04 05
S M T W T F S
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

RECOMMEND

プロフィール

HN:
Account
HP:
性別:
非公開
職業:
--- NODATA ---
趣味:
--- NODATA ---
自己紹介:
◆当blogは、Linuxサーバ構築する際の実際の設定手順を個人的メモとして記載しております。LinuC試験の役に立つ情報があるかも…?

リンク

<<前のページ  | HOME | 
Copyright ©  -- LinuC(Linux技術者認定資格)&リナックスサーバ構築設定事例 --  All Rights Reserved
Design by CriCri / Photo by Melonenmann / powered by NINJA TOOLS / 忍者ブログ / [PR]