Installing A FreeBSD 7.0 DNS Server With BIND - Page 4

Want to support HowtoForge? Become a subscriber!
 
Submitted by msghaleb (Contact Author) (Forums) on Fri, 2008-07-18 15:28. ::

You will then go back to the sysinstall main menu, you can then highlight X Exit Install and press [ENTER].

Remove the CD, highlight [YES] and press [ENTER].

After the reboot you can login with root to do administrative tasks, however if you are logging in via SSH you will need to login using the user you created and then switch to root using the su command.

Before installing 3rd party applications we need to configure FreeBSD to find the 3rd Party commands before the usual FreeBSD commands we will thus have to change the order of the default search path, we can do that by opening the .cshrc file:

cd /root
ee .cshrc

Then we will comment out (disable) the default path by adding a "#" at the beginning of the line so it looks like that:

#set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin)

Now we will add a new line for the new default search path:

set path = (/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin $HOME/bin)

Now save and exit the file, to save and exit just press escape then choose option a to leave and it will then ask you if you want to save or not.

Now logout [CTRL+D] and then login again, if you want to display the current search path use the following command:

echo $path

A good thing to do is to limit the SSH Access, to specify specific users add them to the sshd_config file, do to that open the file using easy editor:

ee /etc/ssh/sshd_config

Add the following line and remember to modify the users based on the users you want to allow, in the below example I'll allow user1 and user2 to access my server via SSH:

AllowUsers user1 user2

Save and Exit, then restart the ssh daemon using the command below:

/etc/rc.d/sshd restart

 

4 Configuring Static IP

If you have chosen DHCP during the installation, you can follow the following steps to configure a static IP, just remember to exclude then the server's IP from the DHCP so that it wont conflict with another network device.

We will edit the rc.conf file using the following command:

ee /etc/rc.conf

You should then see something like:

hostname="dnsfreebsd.tm.local"
ifconfig_xlo="DHCP"

Please change your hostname if it's not correct, it should be your servers' FQDN.

Then we will modify the rest to look like that:

hostname="dnsfreebsd.tm.local"
ifconfig_xlo="inet 192.168.0.100 netmask 255.255.255.0"
defaultrouter="192.168.0.2"

As you can see above, we removed the word DHCP and typed our IP and netmask, and in a new line we added our router's IP.

Now save and exit.

 

5 Checking the Hosts and DNS IPs configuration

We need also to make sure that the hosts file and the resolve.conf file are configured correctly, so we will start by the hosts file:

ee /etc/hosts

It should look like this, please modify your domain name (e.g. tm.local), and your hostname (e.g. dnsfreebsd). based on your configuration:

::1  localhost localhost.tm.local
127.0.0.1  localhost localhost.tm.local
192.168.0.100  dnsfreebsd dnsfreebsd.tm.local

Now save and exit.

We will now check the resolv.conf file:

ee /etc/resolv.conf

It should look like that, feel free to change based on your configuration, you should put the domain name at the top and then any DNS servers you have (your ISP ..etc) below after the word nameserver

domain tm.local
nameserver 192.168.0.2
nameserver 192.168.0.100

 

6 Updating the system

To make sure you are connected to the internet you can ping any website (e.g. www.google.com) if all good you can update and reboot the system using the following commands:

freebsd-update fetch
freebsd-update install
reboot

After rebooting you can display the release level using the following command:

uname -r

 

7 Configuring FreeBSD Ports Collection

The Ports Collection provides a centralized and simple way to install softwares, it is designed to be automated and relatively easy to use.

We will carry on the following steps also with the superuser.

First we will need to copy the ports-supfile to the /root to find it easily later:

cp /usr/share/examples/cvsup/ports-supfile /root

You need now to choose the nearest update server to your location, you can go to:

http://www.freebsd.org/doc/en/books/handbook/cvsup.html

And choose the nearest server to you.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.