본문 바로가기
네트워크 수업/리눅스

[리눅스] DNS 프로젝트관련(3) 23.04.03

by 6^6 2023. 4. 3.
728x90

2023.03.30 - [네트워크 수업/리눅스] - [리눅스] 서버구축 (리눅스의 보안정책 selinux)/프로젝트관련(1) 23.03.30

2023.03.31 - [네트워크 수업/리눅스] - [리눅스] 아파치 - 프로젝트관련(2) 23.03.31

2023.04.03 - [네트워크 수업/리눅스] - [리눅스] 프로젝트관련(3) 23.04.03

 

교재 : 2023.04.03 - [네트워크 수업] - DNS 서버.pdf 23.04.03

 

[root@centos7 ftp]# cd var/ftp/pub

 

 

 

 

[root@centos7 pub]#  vi /etc/sysconfig/network-scripts/ifcfg-ens33


[root@centos7 pub]# systemctl restart network

[root@centos7 pub]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.100  netmask 255.255.255.0  broadcast 192.168.10.255

 

[root@centos7 pub]# setenforce 0
setenforce: SELinux is disabled
[root@centos7 pub]# getenforce
Disabled //만약 여기서 Permissive로 뜬다면 셀리눅스에서 바꿔줘야한다.

vi /etc/sysconfig/selinux

=>  SELINUX=disabled 이걸로 바꿔주기

 

[root@centos7 pub]# init 6

 

[root@centos7 heejae]# firewall-config

 

[root@centos7 heejae]# yum -y install vsftpd

 

[root@centos7 heejae]# systemctl start vsftpd.service //지금 바로 실행시키겠다.
[root@centos7 heejae]# systemctl enable vsftpd.service  //리눅스 켜질때 자동으로 실행하게 하겠다.

[root@centos7 heejae]# vi /etc/vsftpd/vsftpd.conf

12 anonymous_enable=YES.

16 local_enable=YES

19 write_enable=YES

23 local_umask=022

29 anon_upload_enable=YES

33 anon_mkdir_write_enable=YES

 

[root@centos7 html]# systemctl restart vsftpd

 

[root@centos7 html]#  cd /var/ftp/

[root@centos7 ftp]# chown ftp:ftp pub  //권한 바꿔주기 --루트로 되어있어도 됨.(그럼 지울순없다)

[root@centos7 ftp]# chmod 777 pub 
[root@centos7 ftp]# ls -l
합계 4
drwxrwxrwx. 2 ftp  ftp    92  3월 30 17:19 pub

 

 

 

 

Win702로 가서

ftp 에 boa.jpg랑 boa_valenti.avi 랑 인터넷소스 html파일 넣기

 

 

 

[root@centos7 heejae]# cd /var/www
[root@centos7 www]# ls -l
합계 0
drwxr-xr-x 2 root root  6  1월 28 02:37 cgi-bin
drwxr-xr-x 2 root root 62  4월  3 15:06 html   //author에 x가 있어야 접근이 가능하다.

 

 

[root@centos7 www]# cp /var/ftp/pub/* ./
[root@centos7 www]# ls -l
합계 13580
-rw------- 1 root heejae    21662  4월  3 15:24 boa.jpg
-rw------- 1 root heejae 13848936  4월  3 15:24 boa_valenti.mp4
-rw------- 1 root heejae      483  4월  3 15:24 index.html

[root@centos7 www]# chmod 755 *
[root@centos7 www]# ls -1
boa.jpg
boa_valenti.mp4
index.html

[root@centos7 www]# ls -l
합계 13580
-rwxr-xr-x 1 root heejae    21662  4월  3 15:24 boa.jpg
-rwxr-xr-x 1 root heejae 13848936  4월  3 15:24 boa_valenti.mp4
-rwxr-xr-x 1 root heejae      483  4월  3 15:24 index.html

 

[root@centos7 www]# vi /etc/httpd/conf/httpd.conf ==>아파치의 환경설정 파일 (건드릴건 없다)

 

42 Listen 80 =>포트를 42번에서 정한다

119 DocumentRoot "/var/www/html" =>경로를 여기서 바꿀수있다

 

[root@centos7 www]# systemctl start httpd.service
[root@centos7 www]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

 

[root@centos7 www]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@centos7 www]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 월 2023-04-03 15:27:07 KST; 50s ago

 

httpd 의 d는 데먼 = 리눅스의 프로그램(윈도우로 따지자면 프로그램이랑 같은것)

 

 

CentOS7에서 FireFox열기

win702에서 크롬

 

글자 깨지면 직접 바꿔주기
[root@centos7 pub]# pwd
/var/ftp/pub

[root@centos7 pub]# vi index.html

 

[root@centos7 pub]# yum -y install bind bind-chroot  ==>conf 파일이 만들어진다.

 

root@centos7 pub]# vi /etc/named.conf

 

     13         listen-on port 53 { any; };

    21         allow-query     { any; };

54에 놓고 esc 한다음 4yy 를 치기 (4줄 복사)

마지막줄에서 p

     62      zone "kedu.edu" IN {
     63         type master;
     64         file "kedu.edu.db";
     65         allow-update { none; };
     66 };

 

우린 슬레이브가 없어서 none으로 쓴거임.

 

[root@centos7 pub]# named-checkconf =>아무것도 안나오면 오류 없는것.

 

[root@centos7 ~]# vi /var/named/kedu.edu.db ==> 아까 정의한 파일 생성

 

 

$TTL   3H   ==>환경변수 TTL 이 3시간이다. TTL다음 스페이스바 2개 이상 눌러주기
@      SOA   @    root. (2 1D 1H 1W 1H)  ==> 교재 확인. ==>@는 자기 자신.(local host또는 27..?)

        IN    NS   @ ==> IN을 기준으로 A레코드의 종류를 만들어주면된다. 왼쪽은 레코드 종류, NS가 자기자신인 @써주기.

        IN    A    192.168.10.100 ==> www. 안주고 그냥 kedu.edu 해도 열리게 해주기 위해 맨앞칸 비워주는것.

www    IN    A    192.168.10.100 
ftp    IN    A    192.168.10.100 

 

:wq  ==> 얘는 오류검사기능이 없기때문에 오타 잘 확인하기

 

[root@centos7 ~]# systemctl restart named.service
[root@centos7 ~]# systemctl enable named.service
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.
[root@centos7 ~]# systemctl status named.service
● named.service - Berkeley Internet Name Domain (DNS)
   Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
   Active: active (running) since 월 2023-04-03 16:57:26 KST; 18s ago
 Main PID: 6585 (named)
   CGroup: /system.slice/named.service
           └─6585 /usr/sbin/named -u named -c /etc/named.conf

 

 

 

[root@centos7 ~]# nslookup ==>구축
> server 192.168.10.100                         
Default server: 192.168.10.100
Address: 192.168.10.100#53
www.kedu.edu
Server: 192.168.10.100
Address: 192.168.10.100#53

Name: www.kedu.edu
Address: 192.168.10.100
> ftp.kedu.edu
Server: 192.168.10.100
Address: 192.168.10.100#53

Name: ftp.kedu.edu
Address: 192.168.10.100
> kedu.edu
Server: 192.168.10.100
Address: 192.168.10.100#53

Name: kedu.edu
Address: 192.168.10.100

 

 

Win702가

이름 풀이 되는지 확인.

 

 

웹브라우저는 돼도 이건 되야함.

 

ftp> 로 ftp 에 연결이 됐다는 것을 알수있다.(현재 알드라이브의 오류로 알드라이브는 안됨..ㅣ;;;;)

 

 

//오류해결

 

cd /etc/sysconfig

vi named

 

맨 마지막에

OPTIONS="-4"

써주고 

 

service named restart  ==>restart해주고

 

다시 알드라이브로 ftp.kedu.edu해주면 들어가진다!

728x90

댓글