# vmware, FreeBSD, BIND and Apache



## mt82 (Feb 26, 2013)

I need to create a virtual machine using vmware, install FreeBSD on that VM, install and configure BIND, Apache, PHP and MySQL and finally install joomla. This is a part of my class project. I have experinece with windows, ubuntu and centos web servers, but this is new for me.

So far, I have configured VM, FreeBSD, BIND and Apache. I had problem with, network, static IP, gateway, but now everthing looks OK, except I cannot ping local domain.

I can ping domains and IP adresses out of my network. I can ping localhost and my own IP adress (192.168.1.10). From another computers on the network I can acess apache default webpage by typing IP adress 192.168.1.10 in url bar, but when I type mydomain.com it can find it.

this is mydomain.com file (that is not the real name of my domain)


```
$TTL 3600

mydomain.com. IN SOA webserver.mydomain.com. root.mydomain.com. (
1 : Serial
10800 : Refresh
3600 : Retry
604800 : Expire
86400 : Minimum TTL

)
mydomain.com. IN NS webserver.mydomain.com.
webserver.mydomain.com. IN A 192.168.1.10
www IN CNAME webserver.mydomain.com.
mydomain.com. IN MX 10 mailserver.mydomain.com
```

Does anybody have any idea what I did wrong?


----------



## SirDice (Feb 27, 2013)

DNS domains don't 'magically' appear on a network. A client that needs to resolve something will query it's configured nameservers. If those nameservers don't know about this domain the lookup will fail. So you will need to configure your client to use your DNS server.


----------



## mt82 (Feb 27, 2013)

How I can do that. Some hints?

/etc/rc.conf


```
hostname webserver.mojeime.com
keymap."hr.iso.kbd"
ifconfig_em0="192.168.1.10 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sshd_enable="YES"
dumpdev="AUTO"
named_enable="YES"
apache22_enable="YES"
apache22_http_accept_enable="YES"
```

/etc/resolv.conf 


```
search localdomain
nameserver 192.168.1.10
```


----------



## mt82 (Feb 27, 2013)

Sorry

The first line in /etc/rc.conf is


```
hostname webserver.mydomain.com
```


----------



## SirDice (Feb 27, 2013)

Yes, those settings are for your FreeBSD machine, not for your other computers. They need to use the DNS server you have running on FreeBSD.


----------



## mt82 (Feb 27, 2013)

When I ping mydomain.com from my FreeBSD machine I still get message


```
ping: cannot resolve mydomain.com: Host name lookup failure
```

So I can't ping my domain from my FreeBSD machine.


----------



## SirDice (Feb 27, 2013)

mt82 said:
			
		

> ```
> webserver.mydomain.com. IN A 192.168.1.10
> ```


This should be just webserver. It's defined under the domain so you don't have to supply it.


```
webserver   IN A 192.168.1.10
```


----------



## gkontos (Feb 27, 2013)

You might want to read about DNS in the handbook.


----------



## johnblue (Feb 27, 2013)

1. Did named really start?  Run: `# sockstat -4`

2. If it did start, does /var/log/messages have anything to say about the zone it loaded?

3. Did you edit named.conf and what did you change?


----------



## johnblue (Feb 27, 2013)

You forgot an A record for the mailserver, comments start with a semicolon and you missed a trailing period for the MX RR:

```
$TTL 3600

mydomain.com.	IN	SOA	webserver.mydomain.com. root.mydomain.com. (

				201302271	;Serial
				10800		;Refresh
				3600		;Retry
				604800		;Expire
				86400)		;Minimum TTL

mydomain.com.	IN	MX	10	mailserver.mydomain.com.

mydomain.com.	IN	NS	webserver.mydomain.com.

webserver	IN	A	192.168.1.10
www		IN	A	192.168.1.10
mailserver	IN	A	192.168.1.11
```


... neatness counts.  

It is *usually* good SOP to stay away from CNAME's unless you need one, it adds an extra step to the resolution.


----------

