네트워크교육 25일차 (2022.02.09) - 정리

정상훈·2022년 2월 9일
0

NFS

윈도우 클라이언트
Win7 엔터프라이즈 부터 지원

가상 윈도우 cmd
-> mount 서버ip:/share *

centos2
cd
umount /nfs_share
showmount -e 10.0.2.5 -> 1번 서버 확인
Export list for 10.0.2.5:
share 10.0.2.*

AutoFS

  • 자동 마운트 데몬의 작동을 제어하는 프로그램
  • 자동 마운트 데몬은 자동으로 파일 시스템을 마운트 하며, 파일을 시스템이 사용되지 않고 일정 시간이 흐르면 자동으로 언마운트
  • 네트워크 파일 시스템, CD-ROM, USB등을 마운트 하는데 사용

AutoFs 파일 시스템과 맵(map)
: autofs 모듈이 동작하는데 필요한 정보가 저장된 설정 파일

<map 파일의 종류 : 3가지>

  1. master map : 기본파일
  • AutoFs 파일 시스템에서 가장 기준이 되는 맵
    /etc/auto.master.d/에 이름.autofs 파일에 설정 저장
    직접맵이나 간접맵 파일의 이름과 포인터를 정의하는 역할
  1. direct map : 직접 맵 마운트
  • /etc/auto.이름 파일명으로 관습적으로 파일을 만들어서 설정 저장
    맵 내부의 마운트 포인터로 절대 경로명을 사용한다.
  1. indirect map : 간접 맵 마운트
  • /etc/auto.이름으로 관습적으로 파일을 만들어서 설정저장
    맵 내부의 마운트 포인터로 상대경로를 사용한다.

centos2

직접 맵 마운트

yum install -y autofs 
vi /etc/auto.master.d/direct.autofs
/-      /etc/auto.direct

vi /etc/auto.direct
/nfs_share	-rw,sync	10.0.2.5:/share

systemctl restart autofs
systemctl enable autofs

cd~
systemctl stop autofs
umount /nfs_share

rm -rf /etc/auto.master.d/direct.autofs

간접 맵 마운트

vi /etc/auto.master.d/indirect.autofs
/indirect       /etc/auto.indirect



vi /etc/auto.indirect
share   -rw,sync        10.0.2.5:/share

systemctl restart autofs
systemctl enable autofs

mkdir /indirect/share
mount

samba : 리눅스,유닉스,윈도우 등 다른 운영체제간의 자료 공유를 위한 서비스

SMB : 윈도우에서 자료/프린터 공유를 위한 프로토콜
CIFS : 다른 시스템 간의 자료 공유를 위한 SMB 확장 프로토콜

samba를 이용해서 윈도우와 리눅스끼리 서로 공유

centos1
rpm -qa | grep samba
yum -y install samba-client samba-common cifs-utils

smbclient -L 10.0.2.15
mkdir /samba1
mount -t cifs //10.0.2.15/samba /samba1
touch 1
touch 2
확인
cd
umount /samba1

vi /etc/cred
username=root
password=1234
mount -t cifs -o credentials=/etc/cred //10.0.2.15/samba /samba1

cd
umount /samba1

autofs를 이용한 자동 마운트

centos1
yum install -y autofs

직접 맵 마운트

yum install autofs
vi /etc/auto.master.d/direct.autofs
/- /etc/auto.direct

vi /etc/auto.direct
/samba1 -fstype=cifs,credentials=/etc/cred ://10.0.2.15/samba

systemctl restart autofs
cd /samba1
ls

cd
systemctl stop autofs
rm -rf /etc/auto.master.d/direct.autofs

간접 맵 마운트

vi /etc/auto.master.d/indirect.autofs
/indirect /etc/auto.indirect

vi /etc/auto.indirect
share -fstype=cifs,credentials=/etc/cred ://10.0.2.15/samba

mkdir /indirect/share
cd /indirect/share
확인
cd
systemctl stop autofs
rm -rf /etc/auto.master.d/indirect.autofs

리눅스가 samba 서버역할로 samba 구성

-> 리눅스가 마치 자기가 윈도우인것처럼 꾸미고 폴더 공유하는 것 처럼 위장

centos2

yum -y install samba

systemctl restart smb
systemctl enable smb

mkdir /samba
chmod 777 /samba
touch /samba/test1

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

vi /etc/samba/smb.conf

security = user -> 로그인해야 사용가능
workgroup = samba -> workgroup 으로

맨 밑줄에 입력 ->
[samba]
comment = 'test samba'
path = /samba
read only = no
valid users = test

testparm /etc/samba/smb.conf
useradd test
passwd test

smbpasswd -a test

systemctl restart smb
systemctl enable smb

firewall-cmd --permanent --add-service=samba
firewall-cmd --permanent --add-service=samba-client
firewall-cmd --reload

리눅스가 클라이언트 (centos1)

smbclient -L //10.0.2.4/samba -U test

smbclient //10.0.2.4/samba -U test
get test1

vi /etc/cred
username=test
password=1234

mount -t cifs -o credentials=/etc/cred //10.0.2.4/samba /samba1

cd
umount /samba1

윈도우가 클라이언트


Map network drive 클릭

DHCP

컴퓨터가 부팅할 때 자동으로 IP주소 서브넷마스크,
게이트웨이 주소, DNS서버 등을 할당해주는 서비스

참고 : 한정된 IP주소를 유용하게 사용하게 해준다.

centos1

nmcli con add con-name "DHCP Static" ifname enp0s17 type ethernet ipv4.addresses 10.0.2.5/24 ipv4.dns 8.8.8.8 ipv4.gateway 10.0.2.1

nmcli con up "DHCP Static"

<DHCP 서버 구축 > -> centos1

yum -y install dhcp

ps -ef | grep dnsmasq

kill -9 PID번호

systemctl disable dnsmasq

vi /etc/dhcp/dhcpd.conf

subnet 10.0.2.0 netmask 255.255.255.0 {
option routers 10.0.2.1;
options subnet-mask 255.255.255.0;
range dynamic-bootp 10.0.2.20 10.0.2.80;
option domain-name-servers 8.8.8.8;
default-lease-time 10000;
max-lease-time 50000;
}

firewall-cmd --permanent --add-service=dhcp
firewall-cmd --permanent --add-service=dhcpv6
firewall-cmd --reload

프록시 서버 :

네트워크 중간에서 대리인 역할을 하는 서버

centos1

yum -y install squid

vi /etc/squid/squid.conf

 52 # http_access allow localnet
 53 http_access allow all

firewall-cmd --permanent --add-port=3128/tcp
firewall-cmd --reload

win7 -> explorer -> tools -> internet option -> connections -> LAN settings -> proxy server 10.0.2.5(ip) , 3128(port)

profile
"@____

0개의 댓글