공부공부 공부공부내용
0611 실습3 _ Masquarade 본문
실습 3 masquerade
snat
dnat
네트워크 2개중 두번째거 지우고 남은거 인터널로 바꾸기 web1 192.168.123.11,web2 192.168.123.12
프록시 게이트웨이는 첫번째것만 설정해주면 된다(나트에 있는것만)
proxy 만 네트워크 두개 eth0 eth1
존활성화는 두개규칙중 하나만 있으면 된다. -> interface or source addresses
-> 기본적으로는 public존이 활성화 상태,
출발지주소를 비교하고 허용되는 규칙이없으면 인터페이스 존으로 간다.
[proxy]
firewall-cmd --get-active-zones
eth1을 external존에 추가할건데 conflict가 든다./.?
동일한 소스address를 갖고잇어서 안되는 것. 중복이 안됨. 어떤 존으로 들어갈지 판단하는 영역이기 때문에 (interface ,소스어드레스)
체인지 인터페이스 해줌 firewlll cmd change interface
c최종적으로 겟 엑티브 존은 두개 external 과 퍼브릭 퍼블릭이eth0
POSTROUTING -> snat을 의미
논리볼륨 파일시스템 만들고 -> etc/exports 에 /var/www/ 192.168.124.0/24
웹1,2 에다가 dns등록해줘여함 ****************** 8..8.8.8
Masquerade(또는 MASQ, IPMASQ)란?
리눅스의 NAT(Network Address Translation) 기능으로써 내부 컴퓨터들이 리눅스 서버를 통해서 인터넷 등 다른 네트워크에 접속할 수 있도록 해주는 기능.
내부 컴퓨터들이 생성한 모든 네트워크 요청은 MASQ를 통해서 리눅스 서버의 외부 공인IP로 변환되어 인터넷에 연결되기 때문에, 외부에서는 리눅스 서버의 IP만 알 수 있을 뿐, 내부 컴퓨터의 존재를 전혀 알 수 없다.
이는 높은 보안성이라는 장점을 제공한다.
하지만, 반면에 외부에서 먼저 내부컴퓨터와 통신을 시도할 수 없기 때문에 상당한 제약으로 작용할 수 있다.
이러한 제약은 포워딩(iptable 이용)을 통해서 해소할 수 있다.
즉, 외부에서 특정 포트나 프로토콜로 리눅스 서버에 요청할 경우
지정한 내부 컴퓨터로 연결하도록 규칙을 지정 수 있다.



proxy 는 외부로 통신하는 NAT 하나, 내부통신하는 internal 하나
web1 은 내부통신을 위한 internal 네트워크 하나 ( 이 네트워크의 게이트웨이주소는 proxy 서버의 내부네트워크와 연결된다. 외부 Nat 와는 연결되지 않기 때문에 ping 8.8.8.8 을 던지면 통신이되지않지만 ping 192.168.123.10으로 proxy내부나외부로던졌을경우에는통신이된다)
web2도 마찬가지
오후실습
[root@proxy www]# history
13 yum -y install haproxy
14 firewall-cmd --chagne-interface=eth1 --zone=external
15 firewall-cmd --get-active-zones
16 firewall-cmd --direct --add-rule ipv4 nat POSTROUTING 0 -o eth0 -jMASQUERADE
17 firewall-cmd --chagne-interface=eth1 --zone=external
18 sudo firewall-cmd --permanent --new-zone=external
19 firewall-cmd --permanent --new-zone=external
20 firewall-cmd --chagne-interface=eth1 --zone=external
21 firewall-cmd --chagne-interface=eth0 --zone=external
22 firewall-cmd --chagne-interface=eth1 --zone=external
23 firewall-cmd --get-active-zones
24 firewall-cmd --change-interface=eth1 --zone=external --
25 firewall-cmd --change-interface=eth1 --zone=external
26 firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i eth1 -oeth0 -j ACCEPT
27 firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i eth0 -oeth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
28 firewall-cmd --get-active-zones
29 vi /etc/haproxy/haproxy.cfg
30 systemctl start haproxy
31 systemctl enable haproxy
32 setenforce 0
33 vi /etc/selinux/config
34 ip a
35 curl 192.168.123.11
36 firewall-cmd --list-all
37 yum -y install haproxy
38 vi /etc/haproxy/haproxy.cfg
39 curl 192.168.123.11
40 systemctl start httpd
41 source /etc/bashrc
42 systemctl start haproxy
43 systemctl enable haproxy
44 yum install http
45 systemctl start httpd
46 systemctl start http
47 firewall-cmd --permanent --zone=public --add-service=http
48 firewall-cmd --permanent --zone=external --add-service=http
49 firewall-cmd --reload
50 systemctl start http
51 systemctl start httpd
52 journalctl -xe
53 systemctl status http
54 yum install httpd
55 systemctl start http
56 systemctl start httpd
57 journalctl -xe
58 cd /var/www/
59 ls
60 systemctl start http
61 systemctl start httpd
62 firewall-cmd --permanent --add-service=http
63 firewall-cmd --reload
64 systemctl start httpd
65 journalctl -xe
66 ls
67 selinux 0
68 setenforce 0
69 systemctl status http
70 systemctl status httpd
71 systemctl start httpd
72 systemctl enable httpd
73 systemctl start httpd
74 vi /etc/httpd/conf/httpd.conf
75 systemctl start httpd
76 journalctl -xe
77 ip a
78 systemctl restart http
79 systemctl restart httpd
80 firewall-cmd --list-all
81 systemctl start httpd
82 journalctl -xe
83 systemctl status httpd
84 firewall-cmd --list-all
85 firewall-cmd --list-all --zone
86 firewall-cmd --list-all --zone external
87 여기는 hhtp 까는거아님...
88 curl 192.168.123.11
89 curl 192.168.123.12
90 ip a
91 nmcli connection modify eth2 ipv4.addresses 192.168.124.10/24
92 ip a
93 nmcli con modify eth2 ipv4.addresses 192.168.124.10/24
94 nmcli con sho
95 nmcli con add con-name eth2 type ethernet ifname eth2
96 nmcli con show
97 nmcli con modify eth2 ipv4.addresses 192.168.124.10/24
98 nmcli con modify eth2 ipv4.dns 8.8.8.8
99 nmcli con modify eth2 ipv4.method manual
100 nmcli con modify eth2 ipv4.gateway 192.168.123.10
101 nmcli con up eth2e
102 nmcli con up eth2
103 nmcli con show
104 ping 8.8.8.8
105 ip a
106 nmcli con show eth2
107 ping 8.8.8.8
108 ping 192.168.122.10
109 nmcli con show
110 nmcli con delete ipv4.gateway 192.168.123.10
111 history
storage history
14 lsblk -f
15 fdisk /dev/vdb
16 lsblk -f
17 mkfs.xfs /dev/vdb1
18 lsblk -f
19 umount /dev/vdb1
20 lsblk -f
21 fdisk /dev/vdb1
22 pvcreate /dev/vdb1
23 lsblk -f
24 pvcreate /dev/vdb1
25 vgcreate vg0 /dev/vdb1
26 lvcreate vg0 -n lv0 -L +3G
27 lvcreate -n lv0 -L +3G vg0
28 lsblk -f
29 lvcreate vg0 -n lv -L 3G
30 lvcreate vg0 -n st_lv -L 3G
31 fdisk /dev/vdb1
32 fdisk /dev/vdb
33 lsblk -f
34 fdisk /dev/vdb
35 lsblk -f
36 fdisk /dev/vdb
37 lsblk -f
38 pvcreate /dev/vdb1
39 partprobe
40 pvcreate /dev/vdb1
41 pvcreate /dev/vdb
42 pvcreate /dev/vdb1
43 reboot
44 pvcreate /dev/vdb1
45 lsblk -f
46 vgcreate st_vg /dev/vdb1
47 lvcreate st_vg -n st_lv -L 3G
48 lvcreate st_vg -n st-lv -L 3G
49 lsblk -f
50 reboot
51 fdisk /dev/vdb
52 lsblk -f
53 pvcreate /dev/vdb
54 pvcreate /dev/vdb1
55 lsblk -f
56 vgcreate vg0 /dev/vdb1
57 lvcreate vg0 -n lv0 -L 3G /dev/vdb1
58 lsblk -f
59 mkfs.xfs /dev/vg0/lv0
60 lsblk -f
61 mkdir -p /var/www/
62 mount -o /dev/vg0/lv0 /var/www/
63 vi /etc/exports
64 vi /etc/fstab
65 mount -a
66 lsblk -f
67 df -Th
68 exports -r
69 exportfs -r
70 yum install -y nfs-utils.x86_64
71 yum install -y rpcbind
72 systemctl start nfs
73 systemctl enable nfs
74 firewall-cmd --permanent --add-service=nfs
75 firewall-reload
76 firewall-cmd --reload
77 systemctl status nfs
78 exportfs -r
79 exportfs -v
80 hostnamectl set-hostname storage.cccr.co.kr
81 bash
82 lsblk -f
83 chmod 777 /var/www
84 firewall-cmd --list-all
85 systemctl restart rpcbind
86 systemctl restart nfs
87 vi /etc/exports
88 umount /dev/vg0/lv0
89 lsblk -f
90 vi /etc/fstab
91 cd /var/www
92 cd /var
93 ls
94 rm -rf www
95 ls
96 mkdir -p /exports/contents
97 cd /exports
98 ls
99 vi /etc/fstab
100 mount -a
101 lsblk -f
102 vi /etc/fstab
103 exportfs -r
104 vi /etc/fstab
105 reboot
106 lsblk -f
107 exportfs -r
108 vi /etc/exports
109 exportfs -r
110 exportfs -v
111 vi /etc/exports
112 history
[root@web1 www]# history
13 nmcli con show
14 ip a
15 setenforce 0
16 vi /etc/selinux/config
17 yum install httpd
18 systemctl start httpd
19 systemctl start http
20 systemctl start httpd
21 firewall-cmd --permanent --add-service=http
22 firewall-cmd --reload
23 systmectl start http
24 systmectl start httpd
25 systemctl start httpd
26 systemctl start http
27 yum install http
28 yum install httpd
29 systemctl start httpd
30 firewall-cmd --permanent --add-service=http
31 systemctl status httpd
32 systemctl status http
33 firewall-cmd --list-all
34 echo web1 > /var/www/html/index.html
35 yum install httpd
36 systemctl start httpd
37 systemctl start http
38 firewall-cmd --permanent --add-service=http
39 history
40 nmcli con mod eth0 ipv4.gateway 192.168.123.10
41 nmcli con up eth0
42 hostnamectl set-hostname web1.cccr.co.kr
43 bash
44 systemctl start httpd
45 systemctl start http.service
46 yum install -y http
47 yum install -y http*
48 ping 8.8.8.8
49 ip a
50 ping 8.8.8.8
51 systemctl restart httpd
52 systemctl restart http
53 cd /etc/httpd/conf.d
54 systemctl start http
55 systemctl start httpd
56 yum install httpd
57 ping 8.8.8.8
58 ip a
59 ping 192.168.123.10
60 vi /etc/resolv.conf
61 nmcli con show
62 nmcli con show eth0
63 nmcli con mod eth0 ipv4.dns 8.8.8.8
64 nmcli con up eth0
65 yum install httpd
66 systemctl start httpd
67 systemctl enable httpd
68 firewall-cmd --permanent --add-service=http
69 cd /var/www/
70 ls
71 echo "web1" > /var/www/html/index.html
72 setfacl -Rm u:apache:rwX /var/www/html
73 systemctl restart nfs
74 firewall-cmd --list-all
75 systemctl start nfs
76 yum install -y nfs-utils.x86_64
77 yum install -y rpcbind
78 systemctl start nfs
79 systemctl start rpcbind
80 firewall-cmd --permanent --add-service=nfs
81 firewall-cmd --permanent --add-service=rpcbind
82 firewall-cmd --permanent --add-service=mountd
83 firewall-cmd --reload
84 ping 192.168.124.13
85 nmlci con show
86 nmcli con show
87 firewall-cmd --list-all
88 sytemctl status http
89 sytemctl status httpd
90 yum install -y httpd
91 systemctl start http
92 systemctl restart httpd
93 systemctl enable httpd
94 systemctl status httpd
95 ip a
96 nmcli con mod eth2 ipv
97 nmcli con mod eth2 ipv4.addresses 192.168.124.11/24
98 nmclil con show
99 nmcli con show
100 nmcli con add con-name eth2 type ethernet ifname eth1
101 nmcli con show
102 nmcli con mod eth2 ipv4.addresses 192.168.124.11/24
103 nmcli con mod eth2 ipv4.method manual
104 nmcli con up eth2
105 nmcli con show
106 nmcli con show eth2
107 nmcli con mod eth2 ipv4.dns 8.8.8.8
108 nmcli con mod eth2 ipv4.gateway 192.168.123.10
109 nmcli con up eth2
110 nmcli con show
111 df Th
112 df -Th
113 vi /etc/fstab
114 mount -a
115 systemctl start http
116 systemctl start httpd
117 systemctl start nfs
118 mount -a
119 df -Th
120 nmcli con show eth2
121 history
'IT 기초, 네트워크, 리눅스 > 리눅스 번외_ 기초 활용 및 심화실습' 카테고리의 다른 글
[Linux] LoadBalncer, ISCSI, NFS,wordpress 를 이용한 인프라 구성 (0) | 2020.06.25 |
---|---|
0611 실습 4 ) target에 논리볼륨 디스크 추가 후, 블록스토리지(iscsi) 연결하고 initiator 2개와 연결하기 (0) | 2020.06.11 |
0611_실습1_ HAproxy (0) | 2020.06.11 |
0610 워드프로세스 db 구성 (0) | 2020.06.10 |
0610 실습 9일차 가상머신 3개 세팅 , php + 10일차 워드프로세스 php (0) | 2020.06.10 |