忍者ブログ

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

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

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

【Linux】サーバーの状態確認(6)

疎通確認
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# ping 192.168.0.10
 Pinging 192.168.1.10 with 32 bytes of data:        

 Reply from 192.168.1.10: bytes=32 time<10ms TTL=128
 Reply from 192.168.1.10: bytes=32 time=20ms TTL=128
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

経路情報を表示する
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# traceroute 192.168.1.1
traceroute to itpro.nikkeibp.co.jp (202.214.174.88), 30 hops max, 38 byte packets
 1  192.168.1.1 (192.168.1.1)  0.386 ms  0.363 ms  0.322 ms
 2  218.xxx.xxx.xxx (218.xxx.xxx.xxx)  3.426 ms  4.137 ms  5.710 ms
 3  218.xxx.xxx.xxx (218.xxx.xxx.xxx)  7.711 ms  3.820 ms  3.123 ms
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

DNSサーバーへ問合せ(名前解決テスト)
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# nslookup 192.168.0.1
サーバー:  xxxxx.example.com
Address:  192.168.0.11

名前:    XXX.example.com
Address:  192.168.0.1

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

PR

【Linux】サーバーの状態確認(1)

メモリやCPUの使用状況(5秒間隔で2回チェック)
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# vmstat 5 2
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0    300  51472 166104 116804    0    0     0     0    2    2  0  0 100  0  0
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---


現在動作中のプロセスを表示する
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.2  19360  1388 ?        Ss   Mar08   0:04 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Mar08   0:01 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Mar08   0:00 [migration/0]
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---


物理メモリ,仮想メモリの使用状況を表示する
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# free
             total       used       free     shared    buffers     cached
Mem:        502360     450904      51456          0     166104     116768
-/+ buffers/cache:     168032     334328
Swap:      1048568        300    1048268
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---


ハードディスクのパーテション情報などを表示する
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# df -h
Filesystem            Size  Used Avail Use% マウント位置
/dev/sda3             6.7G  3.4G  3.0G  54% /
tmpfs                 246M     0  246M   0% /dev/shm
/dev/sda1             248M   37M  199M  16% /boot
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

【Linux】サーバーの状態確認(5)

プロセスの状態表示
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.2  19360  1388 ?        Ss   Mar08   0:04 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Mar08   0:01 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Mar08   0:00 [migration/0]
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

パケットフィルタリングの状態表示
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# iptables -L
DROP       all  --  anywhere             255.255.255.255    
DROP       all  --  anywhere             224.0.0.1          
ACCEPT     all  --  192.168.0.0/24       anywhere           
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  172.20.0.0/24        anywhere            tcp dpt:ssh state NEW
ACCEPT     udp  --  172.20.0.0/24        anywhere            udp dpts:snmp:snmptrap
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

TCPラッパー (/etc/hosts.allow) によるアクセス制限①
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# cat /etc/hosts.allow
sshd: 192.168.0.16
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

TCPラッパー (/etc/hosts.allow) によるアクセス制限②
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# cat /etc/hosts.allowdeny
ALL: ALL
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

ホスト名とIPアドレスの対応付け
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

【Linux】サーバーの状態確認(4)

サービスの自動起動 on/off をリスト表示
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# chkconfig --list
NetworkManager  0:off 1:off 2:off 3:off 4:off 5:off 6:off
abrt-ccpp       0:off 1:off 2:off 3:off 4:off 5:off 6:off
abrtd           0:off 1:off 2:off 3:off 4:off 5:off 6:off
acpid           0:off 1:off 2:on 3:on 4:on 5:on 6:off
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

サービスの状態確認①
--- --- --- --- --- --- --- --- --- --- --- --- ---
# cat /etc/services
# service-name  port/protocol  [aliases ...]   [# comment]
tcpmux          1/tcp                           # TCP port service multiplexer
tcpmux          1/udp                           # TCP port service multiplexer
rje             5/tcp                           # Remote Job Entry
rje             5/udp                           # Remote Job Entry
echo            7/tcp
echo            7/udp
--- --- --- --- --- --- --- --- --- --- --- --- ---

サービスの状態確認②
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# service --status-all
NetworkManager は停止しています
abrt-ccpp hook is not installed
abrt-dump-oops は停止しています
abrtd は停止しています
acpid (pid  1909) を実行中...
atd (pid  2221) を実行中...
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

【Linux】サーバーの状態確認(3)

NICの設定
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0C:29:28:80:7C 
          inet addr:192.168.0.190  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9084557 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5672669 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1702563285 (1.5 GiB)  TX bytes:1512798167 (1.4 GiB)
eth1      Link encap:Ethernet  HWaddr 00:0C:29:28:80:86 
          inet addr:172.20.0.10  Bcast:172.20.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:294575 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:38004181 (36.2 MiB)
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

DNSの設定
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# cat /etc/resolv.conf
# Generated by NetworkManager
search cloud.local
nameserver 127.0.0.1
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

ネットワークの状態を表示する①
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.20.0.0      *               255.255.255.0   U         0 0          0 eth1
192.168.0.0     *               255.255.255.0   U         0 0          0 eth0
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

ネットワークの状態を表示する②
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.20.0.0      *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

【Linux】サーバーの状態確認(2)

インストール済みパッケージを表示
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# rpm -qa
xorg-x11-drv-acecad-1.5.0-6.el6.x86_64
sg3_utils-1.28-4.el6.x86_64
net-snmp-utils-5.5-44.el6.x86_64
libXi-1.6.1-3.el6.x86_64
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

稼動状況をタイムリーに表示(「Shift+o」でソート)
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# top
top - 15:32:49 up 191 days,  6:47,  2 users,  load average: 0.00, 0.00, 0.00
Tasks: 102 total,   1 running, 101 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    502360k total,   452400k used,    49960k free,   166108k buffers
Swap:  1048568k total,      300k used,  1048268k free,   118104k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND

11477 root      20   0 15028 1096  840 R  1.9  0.2   0:00.03 top
    1 root      20   0 19360 1388 1140 S  0.0  0.3   0:04.02 init
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

SELinuxが有効か無効かを調べる
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# getenforce
Enforcing
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

【DNS】名前解決確認

[root@sentos5 ~]# nslookup www.lpi.or.jp
Server:         192.168.0.1
Address:        192.168.0.1#53
Non-authoritative answer:
Name:   www.lpi.or.jp
Address: 202.218.212.222

[root@sentos5 ~]# nslookup
> server 192.168.0.1
Default server: 192.168.0.1
Address: 192.168.0.1#53
> www.isc.org
Server:         192.168.0.1
Address:        192.168.0.1#53

Non-authoritative answer:
Name:   www.isc.org
Address: 149.20.64.42
>
exit

[root@sentos5 ~]# host sv1.lpi.jp
sv1.lpi.jp has address 203.174.74.34

[root@sentos5 ~]# host 203.174.74.34
34.74.174.203.in-addr.arpa domain name pointer sv1.lpi.jp.

[root@sentos5 ~]# host -t mx lpi.org
lpi.org mail is handled by 10 mail.lpi.org.

[root@sentos5 ~]# host -t ns lpi.org
lpi.org name server server1.moongroup.com.
lpi.org name server ns.starnix.com.

[root@sentos5 ~]# host www.lpi.org 172.17.0.1
Using domain server:
Name: 192.168.0.1
Address: 192.168.0.1#53
Aliases:
www.lpi.org has address 24.215.7.162

[root@sentos5 ~]# dig lpi.org mx
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> lpi.org mx
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63305
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;lpi.org.                       IN      MX
;; ANSWER SECTION:
lpi.org.                3600    IN      MX      10 mail.lpi.org.
;; AUTHORITY SECTION:
lpi.org.                3600    IN      NS      server1.moongroup.com.
lpi.org.                3600    IN      NS      ns.starnix.com.
;; ADDITIONAL SECTION:
mail.lpi.org.           3600    IN      A       24.215.7.168
ns.starnix.com.         3600    IN      A       24.215.7.99
;; Query time: 1870 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Mon Jan 10 16:30:53 2011
;; MSG SIZE  rcvd: 138

[root@sentos5 ~]# cat /etc/named.rfc1912.zones
zone "." IN {
        type hint;
        file "named.ca";
};
zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
};
zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.ip6.local";
        allow-update { none; };
};
zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};
zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};

[root@sentos5 named]# cat /etc/named.caching-nameserver.conf
options {
        listen-on port 53 { 127.0.0.1; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; };
        allow-query-cache { localhost; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { localhost; };
        match-destinations { localhost; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

[root@sentos5 etc]# dig @m.root-servers.net ns > /var/named/named.ca

[root@sentos5 etc]# cat /var/named/named.ca
;; ANSWER SECTION:
.                       518400  IN      NS      m.root-servers.net.
.                       518400  IN      NS      c.root-servers.net.
;; ADDITIONAL SECTION:
b.root-servers.net.     3600000 IN      A       192.228.79.201
c.root-servers.net.     3600000 IN      A       192.33.4.12

[root@sentos5 etc]# rndc status
number of zones: 6
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running

[root@sentos5 etc]# cat /var/named/named.local
$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      localhost.
1       IN      PTR     localhost.

[root@sentos5 etc]# dig @localhost version.bind chaos txt
;; ANSWER SECTION:
version.bind.           0       CH      TXT     "9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2"

[root@sentos5 etc]# ps -f -C named
UID        PID  PPID  C STIME TTY          TIME CMD
named     2495     1  0 15:26 ?        00:00:00 /usr/sbin/named -u named -t /var/named/chroot

[root@sentos5 etc]# dnssec-keygen -a RSA -b 1024 -n ZONE example.net.
[root@sentos5 etc]# dnssec-keygen -a RSA -b 4096 -n ZONE example.net.
[root@sentos5 etc]# dnssec-signzone -k Kexample.net.+005+28778.key example.net

[root@sentos5 etc]# dig +dnssec @localhost smtp.exaple.com
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> +dnssec @localhost smtp.exaple.com

【システムメンテナンス】

[root@A]# tar -cvzf software.tar.gz software
software

[root@A]# tar -cvjf software.tar.bz2 software
software

[root@A]# gzip -dc software.tar.gz | tar xvf -
software

[root@A]# bzip2 -dc software.tar.bz2 | tar xvf -
software

/// Makefile作成~コンパイル~インストールの手順 ///
[user@A]# ./configure
[user@A]# make
[user@A]$ su
パスワード:
[root@sentos5 user]#make install
/// Makefile作成~コンパイル~インストールの手順 ///

[root@A]# ls -ld /usr/local/bin
drwxr-xr-x 2 root root 4096  3月 10  2009 /usr/local/bin

[root@A]# ls -ld /usr/local/sbin
drwxr-xr-x 2 root root 4096  3月 10  2009 /usr/local/sbin

/// バックアップ予備知識 ///
完全「full
差分「incremental
増分「differential
/// バックアップ予備知識 ///

/// バックアップ媒体 ///
追記不可:「DVD-R,DVD-R DL
追記可能:「DVD-RW,DVD-RAM,DVD+R,DVD+R DL,DVD+RW
容量:4.7~8.54GB
DDS4」 40GB
DLT-320」 320GB
LTO」 800GB
/// バックアップ媒体 ///

/// バックアップ方法 ///
AMANDA,Bacura」ネットワーク経由バックアップツール
NAS」でネットワーク接続バックアップ
SAN」ファイバーチャネルのストレージ専用ネットワーク
tar,cpio,dd,dump,restore」バックアップコマンド
/// バックアップ方法 ///

[root@A]# tar cjvf /tmp/home.tar.bz2 /home/user
tar: メンバ名から先頭の `/' を取り除きます
/home/user/
/home/user/.gnome/

[root@A]# tar tjf /tmp/home.tar.bz2
home/user/
home/user/.gnome/

[root@A]# tar vjf /tmp/home.tar.bz2 --delete readtest.sh
アボートしました

[root@sentos5 /]# tar xjf /tmp/home.tar.bz2

[root@sentos5 /]# tar xvf /dev/st0 var/log/secure

[root@sentos5 testuser]# ls | cpio -o > /tmp/backup
1 block

[root@sentos5 testuser]# dd if=/dev/sr0 /of=/tmp/cdrom.iso

[root@sentos5 testuser]# dump 0uf /dev/nst0 /dev/sda2
  DUMP: Date of this level 0 dump: Sat Jan  8 17:13:14 2011
  DUMP: Dumping /dev/sda2 (an unlisted file system) to /dev/nst0
/dev/sda2: Bad magic number in super-block while opening filesystem
  DUMP: The ENTIRE dump is aborted.

[root@sentos5 testuser]# cat /etc/dumpdates
/dev/mapper/VolGroup00-LogVol02 0 Wed Jun  2 00:50:26 2010 +0900

[root@sentos5 testuser]# restore rf /dev/st0

[root@sentos5 testuser]# rsync -auv --delete dir /backup
building file list ... rsync: link_stat "/root/home/testuser/dir" failed: No such file or directory (2)
done
sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00

  

【ネットワーク】

[root@A]# dmesg | grep eth
eth0: registered as PCnet/PCI II 79C970A
eth0: link up
eth0: no IPv6 routers present

[root@A]# lspci
02:01.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)

[root@A]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:C9:99:4C
          inet addr:192.168.0.55  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fec9:994c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3702 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2489 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:360938 (352.4 KiB)  TX bytes:301017 (293.9 KiB)
          Interrupt:75 Base address:0x2000

[root@A]# ifconfig eth0:0 192.168.0.56 netmask 255.255.255.0 up

[root@A]# ifconfig eth0:0
eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:C9:99:4C
          inet addr:192.168.0.56  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:75 Base address:0x2000

[root@A]# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.0.21             ether   E0:CB:4E:11:FC:EC   C                     eth0
buffalo.setup            ether   00:0D:0B:B6:0A:B6   C                     eth0

[root@A]# arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.0.21             ether   E0:CB:4E:11:FC:EC   C                     eth0
192.168.0.1              ether   00:0D:0B:B6:0A:B6   C                     eth0

[root@A]# traceroute sentos5
traceroute to sentos5 (127.0.0.1), 30 hops max, 40 byte packets
 1  sentos5.localdomain (127.0.0.1)  0.019 ms  0.011 ms  0.009 ms

[root@A]# traceroute -n sentos5
traceroute to sentos5 (127.0.0.1), 30 hops max, 40 byte packets
 1  127.0.0.1  0.018 ms  0.009 ms  0.013 ms

[root@A]# tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22:50:53.721877 IP 192.168.0.55.ssh > 192.168.0.21.52146: P 2187861119:2187861235(116) ack 2768986704 win 7504
22:50:53.722047 IP 192.168.0.55.ssh > 192.168.0.21.52146: P 116:232(116) ack 1 win 7504

[root@A]# tcpdump -nli eth0 port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22:52:56.040693 IP 192.168.0.21.53094 > 192.168.0.1.domain:  17340+ A? www.nicovideo.jp. (34)
22:52:56.073466 IP 192.168.0.1.domain > 192.168.0.21.53094:  17340 1/2/1 A 202.248.110.243 (116)

[root@A]# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 sentos5.localdomain:2208    *:*                         LISTEN
tcp        0      0 *:nfs                       *:*                         LISTEN

[root@A]# netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0     8091      0      0      0     8978      0      0      0 BMRU
lo        16436   0     3180      0      0      0     3180      0      0      0 LRU

[root@A]# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.0.0     buffalo.setup   255.255.255.0   UG        0 0          0 eth0
192.168.0.0     *               255.255.255.0   U         0 0          0 eth0
default         buffalo.setup   0.0.0.0         UG        0 0          0 eth0

[root@A]# nc 192.168.0.55 25
220 sentos5.localdomain ESMTP Postfix

[root@A]# nc -vz 192.168.0.55 1-1000
nc: connect to 192.168.0.55 port 1 (tcp) failed: Connection refused
nc: connect to 192.168.0.55 port 2 (tcp) failed: Connection refused

[root@A]# nc -vzu 192.168.0.55 1-1000
Connection to 192.168.0.55 111 port [udp/sunrpc] succeeded!
Connection to 192.168.0.55 161 port [udp/snmp] succeeded!

[root@A]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

[root@A]# route add default gw 192.168.0.1

[root@A]# route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1

[root@A]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     buffalo.setup   255.255.255.0   UG    0      0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
default         buffalo.setup   0.0.0.0         UG    0      0        0 eth0

[root@A]# ip route show
192.168.0.0/24 via 192.168.0.1 dev eth0
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.55
default via 192.168.0.1 dev eth0

[root@A]# iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
sit0      no wireless extensions.

[root@A]# iwconfig wlan0
wlan0     No such device

[root@A]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               sentos5.localdomain sentos5 localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

[root@A]# cat /etc/nsswitch.conf
passwd:     files ldap
shadow:     files ldap
group:      files ldap
hosts:      files ldap dns

[root@A]# cat /etc/resolv.conf
nameserver 192.168.0.1

[root@A]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=sentos5.localdomain

[root@A]# ls -l /etc/sysconfig/network-scripts/*
-rw-r--r-- 3 root root   193    羌  2010 /etc/sysconfig/network-scripts/ifcfg-eth0

[root@A]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:0c:29:c9:99:4c
NETMASK=255.255.255.0
IPADDR=192.168.0.55
GATEWAY=192.168.0.1
TYPE=Ethernet

[root@A]# cat /etc/hosts.allow

[root@A]# cat /etc/hosts.deny

[root@A]# tracepath 192.168.0.55
 1:  192.168.0.55 (192.168.0.55)                            0.079ms pmtu 16436
 1:  192.168.0.55 (192.168.0.55)                            0.021ms reached
     Resume: pmtu 16436 hops 1 back 1

[root@A]# cat /etc/issue
CentOS release 5.3 (Final)
Kernel \r on an \m

[root@A]# cat /etc/issue.net
CentOS release 5.3 (Final)
Kernel \r on an \m

[root@A]# cat /etc/motd

[root@A]# wall "Test Message !"
Broadcast message from root (pts/2) (Wed Jan  5 23:28:43 2011):
Test Message !

[root@A]# shutdown -k now "Test Message!!!"
Broadcast message from root (pts/2) (Wed Jan  5 23:29:23 2011):
Test Message!!!
The system is going down to maintenance mode NOW!
Shutdown cancelled.

 

【ストレージ】

[root@A]# fdisk -l /dev/sda
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes
デバイス Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1044     8281507+  8e  Linux LVM

[root@A]# cat /proc/mdstat
Personalities :
unused devices: <none>

[root@A]# lvscan
  /dev/cdrom: read failed after 0 of 2048 at 0: 入力/出力エラーです
  ACTIVE            '/dev/VolGroup00/LogVol00' [4.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol03' [1.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol02' [1.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [1.00 GB] inherit

[root@A]# df -T
Filesystem    Type   1K-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/VolGroup00-LogVol00
              ext3     4062912   3460740    392460  90% /
/dev/mapper/VolGroup00-LogVol03
              ext3     1015704     88808    874468  10% /tmp
/dev/mapper/VolGroup00-LogVol02
              ext3     1015704    274912    688364  29% /var
/dev/sda1     ext3      101086     12074     83793  13% /boot
tmpfs        tmpfs      257720         0    257720   0% /dev/shm
/dev/mapper/VolGroup00-LogVol02
              ext3     1015704    274912    688364  29% /mnt

[root@A]# ls -l /dev/mapper/VolGroup00-LogVol0*
brw-rw---- 1 root disk 253, 0  1月  5 21:15 /dev/mapper/VolGroup00-LogVol00
brw-rw---- 1 root disk 253, 3  1月  5 21:15 /dev/mapper/VolGroup00-LogVol01
brw-rw---- 1 root disk 253, 2  1月  5 21:15 /dev/mapper/VolGroup00-LogVol02
brw-rw---- 1 root disk 253, 1  1月  5 21:15 /dev/mapper/VolGroup00-LogVol03

[root@A]# pvdisplay /dev/sda2
  /dev/cdrom: read failed after 0 of 2048 at 0: 入力/出力エラーです
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               VolGroup00
  PV Size               7.90 GB / not usable 23.41 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              252
  Free PE               28
  Allocated PE          224
  PV UUID               NZOvJm-9UF6-sXaW-y1Fd-1pJ0-fpzW-OVk750

[root@A]# pvscan
  /dev/cdrom: open failed: 読み込み専用ファイルシステムです
  Attempt to close device '/dev/cdrom' which is not open.
  PV /dev/sda2   VG VolGroup00   lvm2 [7.88 GB / 896.00 MB free]
  Total: 1 [7.88 GB] / in use: 1 [7.88 GB] / in no VG: 0 [0   ]

[root@A]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.88 GB
  PE Size               32.00 MB
  Total PE              252
  Alloc PE / Size       224 / 7.00 GB
  Free  PE / Size       28 / 896.00 MB
  VG UUID               V9Kj8z-YYNg-1nxg-WqfE-0c9v-kDrM-HlQ2Rs

[root@A]# lvdisplay /dev/VolGroup00/LogVol02
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol02
  VG Name                VolGroup00
  LV UUID                JTByn9-eKq8-61Kj-f8Y0-aggW-gX1x-fo4XQa
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.00 GB
  Current LE             32
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

[root@A]# pvs
  PV         VG         Fmt  Attr PSize PFree
  /dev/sda2  VolGroup00 lvm2 a-   7.88G 896.00M

[root@A]# vgs
  VG         #PV #LV #SN Attr   VSize VFree
  VolGroup00   1   4   0 wz--n- 7.88G 896.00M

[root@A]# lvs
  LV       VG         Attr   LSize Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao 4.00G
  LogVol01 VolGroup00 -wi-ao 1.00G
  LogVol02 VolGroup00 -wi-ao 1.00G
  LogVol03 VolGroup00 -wi-ao 1.00G

[root@A]# hdparm /dev/sda
/dev/sda:
 readonly     =  0 (off)
 readahead    = 256 (on)
 geometry     = 1044/255/63, sectors = 16777216, start = 0

[root@A]# hdparm -tT /dev/sda
/dev/sda:
 Timing cached reads:   30276 MB in  2.00 seconds = 15175.83 MB/sec
 Timing buffered disk reads:   74 MB in  3.09 seconds =  23.98 MB/sec

更新日付

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]