iptables 작업한건데 처음에는잘 되는데 재부팅후 웹서버접근이 안됩니다.

notgood123의 이미지

일단 제가 한 작업을 적어볼게요.

일단 vmware를 사용하였습니다.

window(외부서버)

------------------------------------------------------------------------------------------
vmware
server1(외부서버)
네트워크장치:eno1,eno2
eno1 - ip : 10.1.1.1/24
gateway:10.1.1.1
eno2(외부공인ip)

server2(내부서버)
네트워크장치:eno1
eno1 - ip: 10.1.1.20/24
gateway:10.1.1.1
dns server:168.126.63.1

server3(내부서버)
네트워크장치:eno1
eno1 - ip: 10.1.1.10/24
gateway:10.1.1.1
dns server:168.126.63.1

sever1은 네트워크장치를 2개 설치하여 외부와 내부를 연결해 주는 방화벽 서버입니다.
server2는 내부서버로 apache웹서버이고 ftp 서버입니다.
server3은 일단 제외 시키겠습니다.

server1에 한 작업
- /etc/sysctl.conf 파일 맽밑에 "net.ipv3.ip_forward = 1" 추가 (무슨 작업인지 모르겟음.)
- iptables -P FORWARD DROP
- iptables -P INPUT DROP
- iptables -P OUTPUT DROP
- iptables -A INPUT -i eno1 -s 10.1.1.0/24 --match state NEW,ESTABLISHED -j ACCEPT (eno1장치에서 출발지가 10.1.1.0/24 들어오는 패킷 accept)
- iptables -A OUTPUT -o eno1 -d 10.1.1.0/24 --match state NEW,ESTABLISHED -j ACCEPT (eno1장치이며 목적지가 10.1.1.0/24 패킷 accept)
- iptables -A FORWARD -i eno1 -s 10.1.1.0/24 -d 0.0.0.0/0 --match state --state NEW,ESTABLISHED -j ACCEPT
- iptables -A FORWARD -i eno2 -d 10.1.1.0/24 --match state --state ESTABLISHED -j ACCEPT

마스커레이드 허가
- iptables -t nat -A POSTROUTING -o eno2 -j ACCEPT
- firwall-config 방화벽 설정 -> 영구적 -> 마스커레이딩 영역체크

- server2 httpd 설치후구동
- firewall-cmd --permanent --add-service=httpd
- firewall-cmd --permanent --add-port=80/tcp
- friewall-cmd --reload
- systemctl restart httpd

- server1에서
- iptables -t nat -A PREROUTING -proto tcp -i eno2 --dport 80 -j DNAT --to-destination 10.1.1.20
- service iptables save

처음에는 외부에서 내부 웹서버 연결이 잘됩니다. 하지만 재부팅후에는 안되네요 .. 혹시 작못한 작업이있나요.

백연구원의 이미지

여기 https://www.centos.org/forums/viewtopic.php?t=3853 확인해보시면 도움이 될 것 같습니다.


소곤소곤

notgood123의 이미지

한번 읽어봐야 겠네요..

jaehungim31의 이미지

server1의 sysctl.conf에서 "net.ipv3.ip_forward = 1"이 아니라 "net.ipv4.ip_forward = 1"일겁니다.
그리고 이 설정은 라우터처럼 여러 인터페이스를 가지고 있고 들어온 패킷을 다른 장치에게 전달하는 역할을 할 때 설정해주어야 하죠.
IPv6 포워딩을 활성화하고 싶다면 "net.ipv6.conf.all.forwarding = 1"

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.