## 방화벽 중지 및 서비스해제
[root@wiki-sanse-vm ~]# systemctl stop firewalld
[root@wiki-sanse-vm ~]# systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
[root@wiki-sanse-vm ~]#

## Iptable 설치
[root@wiki-sanse-vm ~]# yum -y install iptables
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package iptables.x86_64 0:1.4.21-24.1.el7_5 will be updated
---> Package iptables.x86_64 0:1.4.21-28.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
 Package                              Arch                               Version                                     Repository                        Size
============================================================================================================================================================
Updating:
 iptables                             x86_64                             1.4.21-28.el7                               base                             433 k

Transaction Summary
============================================================================================================================================================
Upgrade  1 Package

Total download size: 433 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
iptables-1.4.21-28.el7.x86_64.rpm                                                                                                    | 433 kB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : iptables-1.4.21-28.el7.x86_64                                                                                                            1/2
  Cleanup    : iptables-1.4.21-24.1.el7_5.x86_64                                                                                                        2/2
  Verifying  : iptables-1.4.21-28.el7.x86_64                                                                                                            1/2
  Verifying  : iptables-1.4.21-24.1.el7_5.x86_64                                                                                                        2/2

Updated:
  iptables.x86_64 0:1.4.21-28.el7

Complete!
[root@wiki-sanse-vm ~]#


## iptables services 설치
[root@wiki-sanse-vm ~]# yum install iptables-services
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package iptables-services.x86_64 0:1.4.21-28.el7 will be installed
--> Finished Dependency Resolution

## 서비스 등록
[root@wiki-sanse-vm ~]# systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
[root@wiki-sanse-vm ~]#


## iptables services 시작
[root@wiki-sanse-vm ~]# systemctl start iptables
[root@wiki-sanse-vm ~]#
[root@wiki-sanse-vm ~]#

## iptables services 상태 확인
[root@wiki-sanse-vm ~]# systemctl status iptables
● iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sat 2019-04-20 06:31:37 UTC; 5s ago
  Process: 73664 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
 Main PID: 73664 (code=exited, status=0/SUCCESS)

Apr 20 06:31:37 wiki-sanse-vm systemd[1]: Starting IPv4 firewall with iptables...
Apr 20 06:31:37 wiki-sanse-vm iptables.init[73664]: iptables: Applying firewall rules: [  OK  ]
Apr 20 06:31:37 wiki-sanse-vm systemd[1]: Started IPv4 firewall with iptables.
[root@wiki-sanse-vm ~]#

## iptables 정책 등록
[root@wiki-sanse-vm ~]# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8090
[root@wiki-sanse-vm ~]#
[root@wiki-sanse-vm ~]# service iptables save
[root@wiki-sanse-vm ~]# service iptables restart







  • No labels