월별 글 목록: 2021년 10월월

전 세계에서 볼 수있는 주소와 로컬 IP 주소로 동일한 http 성능을 얻습니다. 볼 수 있습니다. 모바일 기기의 목적을 위해,

NAT 뒤에 웹 서버가 있습니다. 따라서 웹 서버에는 두 개의 IP 주소가 있습니다. 하나는 세계적으로 볼 수 있고 다른 하나는 LAN에서만 볼 수 있습니다.

모바일 기기의 목적을 위해, 나는 예 단일 주소에서 서버에 페이지를 참조 할 수 있도록하고 싶습니다 www.myhost.com같은 대신 로컬 IP 주소를 사용하는 두 가지 경우 모두에 192.168.1.x장치가 LAN과 때 www.myhost.com때 장치 LAN 외부에 있습니다. 여기에는 두 가지 이유가 있습니다. 첫째, 위치에 따라 주소를 수동으로 전환해야하는 것이 다소 불편합니다. 둘째, LAN IP 주소에 대한 별도의 SSL 인증서가 없으므로 클릭해야하는 성가신 브라우저 경고가 발생합니다.

그러나 www.myhost.com스타일 주소를 통한 192.168.1.x트래픽은 NAT를 통과해야하고 트래픽은 그렇지 않기 때문에 성능상의 차이가 상당히 큰 것으로 추정 됩니다. LAN의 전송 속도는 6 배 이상 빠릅니다.

항상 세계적으로 보이는 이름을 사용하면서 LAN에서 LAN 성능을 얻을 수있는 방법이 있습니까?

두 경우 모두 DNS 서버에 액세스 할 수 없지만 멀티 캐스트 DNS (일명 Bonjour)와 같은 것이 작동합니까?

좀 더 복잡하게 만들기 위해 두 번째 사이트에서도 작동하고 싶습니다. 예 www.myhost2.com를 들어 첫 번째 호스트를 복제 하는 다른 도메인이 있습니다 . 두 번째 사이트의 LAN에서 www.myhost.comIP로 확인하는 것이 이상적 www.myhost2.com입니다.



답변

가정

  • FW는 80 / tcp 및 443 / tcp를 192.168.1.5 (녹색 httpd)로 전달합니다.
  • FW는 현재 인터넷의 외부 네임 서버를 가리키는 DHCP 옵션 6을 발행합니다 (빨간색 공용 DNS)
  • 대중은 A 레코드를 DNS 에 대한 www.myhost.com198.51.100.20입니다

해결책

  • 빌드 DNS 리졸버 개인 네트워크에 대한 192.168.1.10에서을 (진한 빨강 바인드 / 봉쥬르)
  • 개인 DNS에 개인 영역 파일 추가 myhost.com(진한 빨간색 바인드 / bonjour)
  • 192.168.1.10을 가리 키도록 DHCP 서버의 DHCP 옵션 6 (도메인 이름 서버) 을 구성하십시오.

왜 웹 서버가 느린가요?

일부 방화벽은 내부 인터페이스에서 198.51.100.20을 NAT로 연결하는 방법을 모릅니다. 따라서 모든 트래픽을 ISP로 보냅니다 (그런 다음 트래픽 www.myhost.com을 198.51.100.20으로 다시 보냅니다 ). ISP 라우터를 향한 왕복은 속도를 늦 춥니 다.

다이어그램 참조 :

홈 네트워크

네트워크는 다르게 보일 수 있지만 실제로 중요한 것은 웹 서버와 내부 이름 서버뿐입니다.

bind이 네트워크의 리졸버 구성 예

OSX를 실행하는 것처럼 들리므로 * nix 구성을 제공하지만 Windows와 비슷한 해결 네임 서버를 설정할 수 있습니다.

나는 집에서 비슷한 일을해야한다. 이것은 내 설정의 전사 버전입니다 bind. bind탭 을 좋아 한다는 것을 기억하십시오 . 일단 bind실행 되면 bind와 bonjour를 통합 할 수 있지만 실제로는 필요하지 않습니다.

기술적으로 네임 서버와 httpd를 동일한 컴퓨터로 축소 할 수는 있지만 보안을 위해 분리합니다. 또 다른 참고로, 실제 DMZ없이 웹 서버를 호스팅하는 것은 다소 위험하지만 지금은 귀하의 질문 범위를 벗어납니다.

파일 /etc/bind/named.conf:

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
    type hint;
    file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
    type master;
    file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
    type master;
    file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
    type master;
    file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
    type master;
    file "/etc/bind/db.255";
};

include "/etc/bind/named.conf.local";

파일 /etc/bind/named.conf.options:

acl kill_clients {
        192.168.1.32;  // Black hole requests here (I have a cheap webcam)
};
acl valid_clients {
        192.168.1.0/24;
        127.0.0.0/8;
};

options {
    directory "/var/cache/bind";

    // If there is a firewall between you and nameservers you want
    // to talk to, you may need to fix the firewall to allow multiple
    // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

    // If your ISP provided one or more IP addresses for stable
    // nameservers, you probably want to use them as forwarders.
    // Uncomment the following block, and insert the addresses replacing
    // the all-0's placeholder.

    // forwarders {
    //  0.0.0.0;
    // };

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
    listen-on { any; };
    blackhole { kill_clients; };
    forwarders {4.2.2.2; 8.8.8.8; };  // Replace with your ISP DNS servers
};
// Configure the communication channel for Administrative BIND9 with rndc
// By default, they key is in the rndc.key file and is used by rndc and bind9
// on the localhost
controls {
        inet 127.0.0.1 port 953 allow { 127.0.0.1; };
};

파일 /etc/bind/named.conf.local:

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

zone "myhost.com" {
        type master;
        file "/etc/bind/db.myhost";
};

zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/db.192.168.1.0";
};

파일 /etc/bind/db.myhost:

;
; BIND data file for local loopback interface
;
$TTL    3600
myhost.com. IN  SOA ns.myhost.com. hostmaster.myhost.com. (
           201301091350     ; Serial
               3600     ; Refresh
              86400     ; Retry
            2419200     ; Expire
               3600 )   ; Negative Cache TTL
;
myhost.com. IN  NS  ns.myhost.com.

www IN  A   192.168.1.5
www-public  IN  A   198.51.100.20
ns  IN  A   192.168.1.10
fw  IN  A   192.168.1.254

파일 /etc/bind/db.192.168.1.0:

@   IN  SOA ns.myhost.com. root..     (
2013010901  ;serial
14400   ;refresh
3600    ;retry
604800  ;expire
10800   ;minimum
)

1.168.192.in-addr.arpa. IN  NS  ns.myhost.com.

10  IN  PTR ns.myhost.com.
5   IN  PTR www.myhost.com.
254 IN  PTR fw.myhost.com.


답변