클라우드 엔지니어 수업 7일차

태기·2023년 3월 2일
0
post-thumbnail

리눅스 네트워크 만들기

Router (IP 공유기; AWS VPC NAT Gateway)

Public Subnet
192.168.0.0./24

192.168.0.0 ~ 192.168.0.255 (256개 IP - 2개 = 254개)

192.168.0.0 네트워크 주소(시작 IP)
192.168.0.255 브로드캐스팅 주소(마지막 IP)

Private Subnet
172.31.0.0/24

172.31.0.0 ~ 172.31.0.255 (256개 IP - 2개 = 254개) -1개(게이트웨이 주소) = 253개(host ip)

172.31.0.0 네트워크 주소(시작 IP)
172.31.0.255 브로드캐스팅 주소(마지막 IP)

enp0s3 외부
enp0s8 내부

vi 편집기에서 모두 지우기ggdG(insert모드 아님)

systemctl status firewalld

방화벽이지만 센토스에서 NAT과 Port Forward의 기능 가짐

firewall-cmd --get-active-zone

정의되어 있는 서비스 목록 확인

랜카드 존 나누기

nmcli c mod enp0s3 connection.zone external
nmcli c mod enp0s8 connection.zone internal
firewall-cmd --get-active-zone

여기까지 NAT 세팅 끝

지금부터 DHCP 세팅 시작

yum install dhcp -y
vi /etc/dhcp/dhcpd.conf

systemctl enable --now dhcpd
dhcp 재부팅 및 실행

systemctl status dhcpd
dhcp 상태 확인

172.31.0.1 GW
172.31.0.100 samba
172.31.0.101 web02
172.31.0.102 web01

firewall-cmd --permanent --zone=external --add-forward-port=port=139:proto=tcp:toport=139:toaddr=172.31.0.100
firewall-cmd --permanent --zone=external --add-forward-port=port=445:proto=tcp:toport=445:toaddr=172.31.0.100
firewall-cmd --permanent --zone=external --add-forward-port=port=2201:proto=tcp:toport=22:toaddr=172.31.0.100
firewall-cmd --permanent --zone=external --add-forward-port=port=2202:proto=tcp:toport=22:toaddr=172.31.0.101
firewall-cmd --permanent --zone=external --add-forward-port=port=2203:proto=tcp:toport=22:toaddr=172.31.0.102
firewall-cmd --permanent --zone=external --add-forward-port=port=8001:proto=tcp:toport=80:toaddr=172.31.0.100
firewall-cmd --permanent --zone=external --add-forward-port=port=8002:proto=tcp:toport=80:toaddr=172.31.0.101
firewall-cmd --reload

firewall-cmd --list-all --zone=external

외부 포트 포워드 현황

enp0s8
WEB01_SAMBA 172.31.0.100 2201
WEB02_NFS 172.31.0.101 2202
DNS_DATABASE 172.31.0.102 2203

enp0s3
192.168.0.116 22
192.168.0.116 8001
192.168.0.116 8002

WEB01_SAMBA 172.31.0.100 2201 <-> 192.168.0.116 22
WEB02_NFS 172.31.0.101 2202 <-> 192.168.0.116 22
DNS_DATABASE 172.31.0.102 2203 <-> 192.168.0.116 22
WEB01_SAMBA 172.31.0.100 8001 <-> 192.168.0.116 80
WEB02_NFS 172.31.0.101 8002 <-> 192.168.0.116 80

네트워크 주소

호스트 ID가 모두 0인 주소
네트워크 자체를 나타내는 주소

브로드캐스트 주소

호스트 ID가 모두 1인 주소
네트워크의 모든 호스트로 데이터를 전달하기 위한 통로로서의 주소

서브넷마스크

네트워크 아이디와 호트스 아이디 구분위해 서브넷팅 담당
255.255.255.0 c
255.255.0.0 B
255.0.0.0 A

profile
경제적 자유를 향해

0개의 댓글