0

I am running on my raspberry (Debian wheezy) the services DHCP, Apache2, MySQL and Bind9. All work fine within the internal network. However, when I try to access the website from internet, it can't be loaded.

I am aware that registrars usually request 2 dns, mine accepted the entry of only one dns. For my purpose I don't want to set up a second one if it is not really absolutely necessary.

The hostname is "rpi-server" has a static IP 192.168.1.5 and all services are hosted on the same machine.
The modem/router/gateway has IP 192.168.1.1.
The public IP is 83.78.107.216.

These are the bind settings:

File /etc/bind/named.conf.local

zone "famwagner.ch" {
        type master;
        file "/etc/bind/db.famwagner.ch";
};

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

File /etc/bind/named.conf.options

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

    dnssec-validation auto;

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
};

File /etc/bind/db.famwagner.ch

$TTL    3600
@   IN  SOA rpi-server.famwagner.ch root.famwagner.ch (
            2015030305  ; Serial
            3600        ; Refresh
            120     ; Retry
            600     ; Expire
            86400)  ; Negative Cache TTL

; Name servers
@       IN  NS  rpi-server.famwagner.ch.
@       IN  MX  10 rpi-server.famwagner.ch.

; A records for name servers
internal-rpi-server IN  A   192.168.1.5
rpi-server      IN      A   83.78.107.216

; Other A records
internetbox     IN      A   192.168.1.1
nas             IN      A   192.168.1.10
raspberry       IN      A   192.168.1.130

; CNAME records
router          IN      CNAME   internetbox
www             IN      CNAME   rpi-server
phpmyadmin      IN      CNAME   rpi-server

File /etc/bind/db.famwagner.ch.inv

@       IN  SOA     rpi-server.famwagner.ch. root.famwagner.ch. (
            2015022401
            3600
            600
            86400
            600 )

; define the authoritative name servers
        IN  NS      rpi-server.famwagner.ch.

; our hosts, in numeric order
1       IN  PTR     internetbox.famwagner.ch.
5       IN  PTR     rpi-server.famwagner.ch.
10      IN  PTR     nas.famwagner.ch.
130     IN  PTR     raspberry.famwagner.ch.

File /etc/hosts

127.0.0.1   localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0     ip6-localnet
ff00::0     ip6-mcastprefix
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

192.168.1.5 rpi-server.famwagner.ch rpi-server

Can anyone advise if I'm having a wrong bind config causing the issue that I can't access the websites from the web?

Any help is appreciated.

Thanks+

  • 4
    Did you forward the port in your router. The Ip address you set is not routable on the internet (it is a private IP). – Steve Robillard Feb 27 '15 at 12:48
  • Yes, my router forwards all ports to the raspberry acting as server. I can access the site using the public IP. – Marco Feb 27 '15 at 12:59
  • This question is really way off-topic here. If you can't find an answer that works, you should use U&L or Superuser -- but please don't cross-post, leave a comment @goldilocks and I will close this. – goldilocks Mar 6 '15 at 17:16
  • @goldilocks Why is this way off-topic? I'm running a webserver (with some more services) on my raspberry and having this issue. – Marco Mar 9 '15 at 6:38
  • Because the fact that it's a raspberry pi is irrelevant. By that logic, there should be a Thinkpad site where people can ask exactly the same question "but it's on a Thinkpad" or an Asus motherboard site where people can ask the exact same question "but my desktop has an Asus mobo w/ newer Intel socket" -- who cares? Anyway, looks like you've got an answer and solved your problem, so no worries. The point is, you'd get more help from people with more particular expertise solving networking problems on linux on one of the much busier, much larger userbase sites. – goldilocks Mar 9 '15 at 13:59
1

If you put rpi-server.mydomain.com in the address of a web browsers that is not on your loacl network the browser will be told by your DNS to contact 192.168.1.5

dig rpi-server.famwagner.ch | grep -v \; | grep ..
rpi-server.famwagner.ch. 604775 IN  A   192.168.1.5

192.168.1.5 is a private IP and is not reachable. Adding the WAN IP of your NAT to your DNS and port forwarding will correct this.

internal-rpi-server  IN  A   192.168.1.5
rpi-server  IN  A   83.78.107.216

DNS can take 72h to propagate if you don't apply other tricks so wait to be sure.

Additionally your NS is setup wrong:

dig rpi-server.famwagner.ch NS | grep -v \; | grep ..
famwagner.ch.       3547    IN  SOA rpi-server.famwagner.ch.famwagner.ch. root.famwagner.ch.famwagner.ch. 2015030306 3600 120 600 86400

so your updates won't propagate. (rpi-server.famwagner.ch.famwagner.ch should be rpi-server.famwagner.ch)

putting a $ORIGIN . before your SOA will let you use the full name without suffixing it, use $ORIGIN famwagner.ch. to restore the default suffix.

Some ISPs offer IPv6 which would be another way around NAT.

If you are asking a different question please clarify.

  • I have a registered domain and a fix public IP. Also the DNS (rpi-server. mydomain.com) and the IP are registered with my TLD registrar. – Marco Mar 2 '15 at 5:52
  • Domain name is not required to access IP from internet. – Chetan Bhargava Mar 2 '15 at 6:37
  • @Chetan, Marco said "I can access the site using the public IP." – user1133275 Mar 2 '15 at 6:41
  • @Marco please be more specific (list every setting in the chain of events) (real IPs and domains would help us help you, and everyone has to learn sometime so there is no reason to hide what is public information) – user1133275 Mar 3 '15 at 0:47
  • @user1133275 I have updated my post with the domain / public IP and added the content of my hosts file. In apache2 I use the default configuration. What else would be helpful information? – Marco Mar 3 '15 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.