2015년 3월 3일 화요일

RHEL 6.x 교육 1일차


[root@station12 /]# echo \$HOME is '$(date)'
$HOME is $(date)
[root@station12 /]# echo \$HOME is '$(^C
[root@station12 /]# echo \$HOME is $(date)
$HOME is 2015. 03. 02. (월) 23:01:18 KST

\ ' "  사용법 숙지


cpus로 프린터 셋팅하기

localhost:631 #접속하여 셋팅하면됨 very simple#

프린터 출력
lp -d 프린터 이름 -n 16 /etc/sevices  ##16은 출력매수

상태확인
[root@station12 /]# lpstat -t #모든사용자 프린트 상태확인#
일정이 실행 중
시스템 기본 대상 없음
deskjet500에 대한 장비: serial:/dev/ttyS0?baud=57600+bits=8+parity=none+flow=none
 2015년 03월 02일 (월) 오후 09시 25분 19초 이후에 deskjet500 승인 요청
deskjet500 프린터가 대기 중.  2015년 03월 02일 (월) 오후 09시 25분 19초 이후에 활성화됨

[root@station12 /]# lpstat #프린트 상태확인 내 계정
deskjet500-2            root                 0   2015년 03월 02일 (월) 오후 11시 03분 27초
deskjet500-3            root                 0   2015년 03월 02일 (월) 오후 11시 03분 32초

[root@station12 /]# cancel #프린터 출력 취소


cd drd 사용법
ll /dev/cdrom #cdrom 확인


dvd mount 방법

[root@station12 /]# mount -t iso9660 /dev/dvd /mnt   #dvd mount
mount: block device /dev/sr0 is write-protected, mounting read-only

[root@station12 /]# ll /mnt #마운트 확인
합계 3428
dr-xr-xr-x. 3 root root   2048 2013-01-31 05:32 EFI
lr-xr-xr-x. 1 root root      7 2013-01-31 05:32 EULA -> EULA_en
-r--r--r--. 3 root root  10726 2012-11-08 00:17 EULA_de
-r--r--r--. 3 root root   8724 2012-11-08 00:17 EULA_e[root@station12 /]# ll /mnt


/dev/null 사용법
[root@station12 /]# cal > /dev/null  #dev/null로 보내서 출력이 없음
[root@station12 /]# cal # 원래 출력값
      3월 2015     
일 월 화 수 목 금 토
 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 31


tree 사용법  (파일 구조 살피기)

[root@station12 /]# tree | more
.
├── bin
│   ├── alsaunmute
│   ├── arch
│   ├── awk -> gawk
│   ├── basename
│   ├── bash
│   ├── cat
│   ├── cgclassify
│   ├── cgcreate
│   ├── cgdelete

lsmod 모듈 확인
[root@station12 rules.d]# lsmod  #모듈 확인
Module                  Size  Used by
nls_utf8                1455  1
ppdev                   8537  0
parport_pc             22690  0
lp                      9242  0
parport                36209  3 ppdev,parport_pc,lp
bridge                 79078  0
nfs                   416657  0
lockd                  73534  1 nfs
fscache                53874  1 nfs
auth_rpcgss            44917  1 nfs
nfs_acl                 2647  1 nfs
fuse                   69253  2
autofs4                26513  3

[root@station12 rules.d]# lsmod | grep r81
r8169                  60023  0
mii                     5376  1 r8169

[root@station12 rules.d]# modinfo r8169 #모듈 상세확인
filename:       /lib/modules/2.6.32-358.6.1.el6.x86_64/kernel/drivers/net/r8169.ko
firmware:       rtl_nic/rtl8168g-1.fw
firmware:       rtl_nic/rtl8106e-1.fw
firmware:       rtl_nic/rtl8411-1.fw
firmware:       rtl_nic/rtl8402-1.fw
firmware:       rtl_nic/rtl8168f-2.fw
firmware:       rtl_nic/rtl8168f-1.fw
firmware:       rtl_nic/rtl8105e-1.fw
firmware:       rtl_nic/rtl8168e-3.fw
firmware:       rtl_nic/rtl8168e-2.fw
firmware:       rtl_nic/rtl8168e-1.fw
firmware:       rtl_nic/rtl8168d-2.fw
firmware:       rtl_nic/rtl8168d-1.fw
version:        2.3LK-NAPI
license:        GPL
description:    RealTek RTL-8169 Gigabit Ethernet driver
author:         Realtek and the Linux r8169 crew <netdev@vger.kernel.org>

모듈 설치 및 제거
[root@station12 rules.d]# modprobe nfs #설치
[root@station12 rules.d]# modprobe -r nfs #제거
FATAL: Module sunrpc is in use.
WARNING: Error running remove command for sunrpc

삭제된 모듈 정보 복구
[root@station12 rules.d]# > /lib/modules/2.6.32-358.6.1.el6.x86_64/modules.dep  #모듈정보 삭제
[root@station12 rules.d]# ll /lib/modules/2.6.32-358.6.1.el6.x86_64/modules.dep  #확인
-rw-r--r--. 1 root root 0 2015-03-03 00:06 /lib/modules/2.6.32-358.6.1.el6.x86_64/modules.dep

[root@station12 rules.d]# depmod  #모듈 정보 복구
[root@station12 rules.d]# ll /lib/modules/2.6.32-358.6.1.el6.x86_64/modules.dep  #복구 확인
-rw-r--r--. 1 root root 196799 2015-03-03 00:06 /lib/modules/2.6.32-358.6.1.el6.x86_64/modules.dep

모듈 삭제 및 생성
[root@station12 rules.d]# lsmod | grep 8169  # 삭제할 모듈확인
r8169                  60023  0
mii                     5376  1 r8169
[root@station12 rules.d]# modprobe -r r8169  # 삭제
[root@station12 rules.d]# lsmod | grep 8169   # 삭제 된것 확인
[root@station12 rules.d]# insmod r8169           # insmod 설치 시도 절대경로를 알지못하면 아래처럼 설치가안됨
insmod: can't read 'r8169': No such file or directory
[root@station12 rules.d]# modprobe r8169          #modprobe를 이용 하여 설치
[root@station12 rules.d]# lsmod | grep 8169       #설치확인
r8169                  60023  0
mii                     5376  1 r8169




커널 파라미터 수정 ******중요
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all  #icmp 무시 셋팅

[root@station12 rules.d]# ping 10.100.0.11             # 확인 ping이 안나감
PING 10.100.0.11 (10.100.0.11) 56(84) bytes of data.
^C
--- 10.100.0.11 ping statistics ---

[root@station12 Desktop]# sysctl -a | grep icmp_echo_ignore   #sysctl 네트워크 환경 전부확인
net.ipv4.icmp_echo_ignore_all = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1

위에 셋팅은 임시적으로서 재기동 하면 셋팅 초기화됨
영구적으로 하려면 /etc/sysctl.conf 수정
vi /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_all = 1

재기동 후에도 적용하려면
/etc/sysctl.conf 를 수정하여야한다.

24 packets transmitted, 0 received, 100% packet loss, time 23381ms


[root@station12 Desktop]# vi /etc/sysctl.conf # 열어서
net.ipv4.tcp_max_syn_backlog = 200000 # 설정값 수정

[root@station12 Desktop]# sysctl -a | grep back
vm.dirty_background_ratio = 10
vm.dirty_background_bytes = 0
vm.dirty_writeback_centisecs = 500
net.core.netdev_max_backlog = 1000
net.ipv4.tcp_max_syn_backlog = 2048      #아직 변화 없음 기본적으로 재기동시 적용


[root@station12 Desktop]# sysctl -p  #재기동 안하고 적용
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_syn_backlog = 200000

[root@station12 Desktop]# sysctl -a | grep back
vm.dirty_background_ratio = 10
vm.dirty_background_bytes = 0
vm.dirty_writeback_centisecs = 500
net.core.netdev_max_backlog = 1000
net.ipv4.tcp_max_syn_backlog = 200000  #변경 내용확인

RHEL 파일시스템 변천사 (5~7)
RHEL5 -> ext3
RHEL6 -> ext4
RHEL7 -> xfs

램디스크 삭제 및 생성

[root@station12 boot]# ll /boot #폴더 확인
합계 22754
-rw-r--r--. 1 root root  2407872 2013-04-24 04:53 System.map-2.6.32-358.6.1.el6.x86_64
-rw-r--r--. 1 root root   104085 2013-04-24 04:53 config-2.6.32-358.6.1.el6.x86_64
drwxr-xr-x. 3 root root     1024 2015-02-28 00:24 efi
drwxr-xr-x. 2 root root     1024 2015-03-03 01:47 grub
-rw-r--r--. 1 root root 16531618 2015-02-28 00:24 initramfs-2.6.32-358.6.1.el6.x86_64.img
drwx------. 2 root root    12288 2015-02-28 00:20 lost+found
-rw-r--r--. 1 root root   185842 2013-04-24 04:54 symvers-2.6.32-358.6.1.el6.x86_64.gz
-rwxr-xr-x. 1 root root  4045712 2013-04-24 04:53 vmlinuz-2.6.32-358.6.1.el6.x86_64
[root@station12 boot]# rm initramfs-2.6.32-358.6.1.el6.x86_64.img   # 램디스크 삭제
rm: remove 일반 파일 `initramfs-2.6.32-358.6.1.el6.x86_64.img'? y

[root@station12 boot]# dracut # 램디스크 복구 --force 옵션도 있음

만약 커널이 여러개일 경우 특정 램디스크 생성하는법
[root@station12 boot]# dracut /boot/initramfs.img kernel_version

램디스크 내용보기
[root@station12 boot]# ll /boot
합계 22814
-rw-r--r--. 1 root root  2407872 2013-04-24 04:53 System.map-2.6.32-358.6.1.el6.x86_64
-rw-r--r--. 1 root root   104085 2013-04-24 04:53 config-2.6.32-358.6.1.el6.x86_64
drwxr-xr-x. 3 root root     1024 2015-02-28 00:24 efi
drwxr-xr-x. 2 root root     1024 2015-03-03 01:47 grub
-rw-r--r--. 1 root root 16593216 2015-03-03 02:15 initramfs-2.6.32-358.6.1.el6.x86_64.img
drwx------. 2 root root    12288 2015-02-28 00:20 lost+found
-rw-r--r--. 1 root root   185842 2013-04-24 04:54 symvers-2.6.32-358.6.1.el6.x86_64.gz
-rwxr-xr-x. 1 root root  4045712 2013-04-24 04:53 vmlinuz-2.6.32-358.6.1.el6.x86_64
[root@station12 boot]# mkdir tmp  #임시 폴더 생성해서
[root@station12 boot]# cp initramfs-2.6.32-358.6.1.el6.x86_64.img ./tmp #램디스크 파일복사
[root@station12 boot]# cd tmp
[root@station12 tmp]# ll
합계 16206
-rw-r--r--. 1 root root 16593216 2015-03-03 02:20 initramfs-2.6.32-358.6.1.el6.x86_64.img
[root@station12 tmp]# zcat initramfs-2.6.32-358.6.1.el6.x86_64.img | cpio -icdmu  # 압축풀고
92119 blocks
[root@station12 tmp]# ll #확인
합계 16266
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 bin
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 cmdline
drwxr-xr-x. 3 root root     1024 2015-03-03 02:21 dev
-rw-r--r--. 1 root root       19 2013-01-09 22:34 dracut-004-303.el6
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 emergency
drwxr-xr-x. 7 root root     1024 2015-03-03 02:21 etc
-rwxr-xr-x. 1 root root     8879 2013-01-09 22:34 init
drwxr-xr-x. 2 root root     1024 2015-03-03 02:14 initqueue
drwxr-xr-x. 2 root root     1024 2015-03-03 02:14 initqueue-finished
drwxr-xr-x. 2 root root     1024 2015-03-03 02:14 initqueue-settled
drwxr-xr-x. 2 root root     1024 2015-03-03 02:14 initqueue-timeout
-rw-r--r--. 1 root root 16593216 2015-03-03 02:20 initramfs-2.6.32-358.6.1.el6.x86_64.img
drwxr-xr-x. 7 root root     1024 2015-03-03 02:21 lib
drwxr-xr-x. 3 root root     5120 2015-03-03 02:21 lib64
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 mount
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 pre-pivot
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 pre-trigger
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 pre-udev
drwxr-xr-x. 2 root root     1024 2015-03-03 02:14 proc
drwxr-xr-x. 2 root root     1024 2015-03-03 02:21 sbin
drwxr-xr-x. 2 root root     1024 2015-03-03 02:14 sys
drwxr-xr-x. 2 root root     1024 2015-03-03 02:14 sysroot
drwxrwxrwt. 2 root root     1024 2015-03-03 02:14 tmp
drwxr-xr-x. 7 root root     1024 2015-03-03 02:21 usr
drwxr-xr-x. 4 root root     1024 2015-03-03 02:21 var
[root@station12 tmp]# cd lib
[root@station12 lib]# ll
합계 19
-rwxr-xr-x. 1 root root 7248 2013-01-09 22:34 dracut-lib.sh
drwxr-xr-x. 4 root root 1024 2015-03-03 02:21 firmware
drwxr-xr-x. 6 root root 1024 2015-03-03 02:21 kbd
drwxr-xr-x. 3 root root 1024 2015-03-03 02:21 modules
drwxr-xr-x. 6 root root 1024 2015-03-03 02:21 terminfo
drwxr-xr-x. 3 root root 1024 2015-03-03 02:21 udev


댓글 없음:

댓글 쓰기