Jump to content

[SOLVED] Network / DNS info wanted


sKunKbad

Recommended Posts

I've been setting up my first web server, and everything seems to be working fine. I installed Ubuntu Server Edition 8.04. I've configured name based virtual hosting, ddclient for updating my A record on zoneedit.com, a static connection to my router, etc. During the configuration of the server, I mainly used info I found from the internet to help me. I found myself editing:

  • /etc/hosts
  • /etc/resolv.conf
  • /etc/apache2/sites-available
  • /etc/apache2/sites-enabled
  • /etc/network/interfaces

The problem, at least for me, is that I am setting up this server to learn, not to just set up a server. In fact, I don't consider the hardware or environment suitable for a real server. I just want to know how all of this stuff is working, and not just do it by example. I have a couple of Ubuntu books, one is specific to server administration, but these books don't go into great detail about how these files work. Can someone suggest a book or website that explains what I am seeking to learn? I am primarily a web designer, but have done work in php, and am interested in expanding my knowledge by learning linux server administration.

Link to comment
Share on other sites

Can someone suggest a book or website that explains what I am seeking to learn?

 

Its probably not something your going to find one simple resource for, but the internet in general has many good resources. There's a link to a free book in my signature that I still find helpful from time to time, also the Linux Documentation Project is a great resource. As well as those, and seeing as how your using a Debian derivative, you should find the Debian Documentation pretty useful.

 

Of course having said all that, locally, invest some time in getting to know man and info.

Link to comment
Share on other sites

Oh and PS, there are a few commands (a2ensite and a2delsite) that are specifically designed to maintain the /etc/apache2/sites-available & /etc/apache2/sites-enabled directories. Just in case you weren't aware.

Link to comment
Share on other sites

Oh and PS, there are a few commands (a2ensite and a2delsite[/url]) that are specifically designed to maintain the /etc/apache2/sites-available & /etc/apache2/sites-enabled directories. Just in case you weren't aware.

 

No. I was not aware of those commands.

 

I will take a look at the everything you have shared. I really hate reading real books, so the more info I can get in pdf, html, or txt the better.

 

Thanks

Link to comment
Share on other sites

In the standard unix-like operating system, name resolution goes through two steps. It first checks /etc/hosts for name assignments in the form of:

 

an.ip.addr.ess    some_hostname [other_hostname] [another_one]

 

Note that underscores may not actually be valid as hostnames (I don't know) - check the host naming RFC if you're interested. :)

 

If the name is not resolved then, it performs a DNS lookup using the nameserver directives in /etc/resolv.conf.

 

/etc/network/interfaces is the Debian (maybe Red Hat, too?) way of describing network connections. This is the place to enable or disable network interfaces and define connection parameters (set hostnames, for example).

 

/etc/apache2/sites-{available,enabled} is the Debian (again, maybe Red Hat too) way of making Apache admins' lives easier. VirtualHosts are defined in files in sites-available, symlinked to in sites-enabled, and Include'd in /etc/apache/apache2.conf. Note that you should not create the files in sites-enabled[tt], or [tt]cp the files from sites-available. I suppose a hardlink would be acceptable, but a symlink is preferable.

 

If TLDP (one of my favorite resources) doesn't help, these man pages may be able to. Note that similar commands should work for most system configuration files.

 

man hosts

man resolv.conf

man interfaces

Link to comment
Share on other sites

  • 2 weeks later...

So, specifically in regards to my etc/resolv.conf, I want to ask if I configured it correctly. First, I listed my linksys router's IP as a nameserver, then I listed my ISP's DNS nameservers (both primary and secondary) as nameservers, then I have search set to lan.

 

nameserver 192.168.1.1

nameserver 66.51.205.100

nameserver 66.51.206.100

search lan

 

I understand that names would need to be resolved, and I am thinking that my router should not be listed as a nameserver, but I might be wrong. Would there be a reason for my router to be listed as a nameserver? Also, I only chose search lan because of the book I am reading says this is the default. This was not what it was after installation of the O/S, but since I didn't back up resolv.conf, and can't remember what search was set to, I can't tell you what it was. Do I need the search setting at all?

Link to comment
Share on other sites

Some router can be configured to act as a local dns relay. What you would do then is list your isp's nameservers in the routers configuration, then you only need your routers ip listed within your /etc/resolv.conf file. I find it just as easy to list your isp's nameservers within /etc/resolv.conbf and don't worry about adding your routers ip.

 

As for the search section. You would use this if you have multiple machines on the same domain. eg;

 

foo.domain.com
bar.domain.com

 

With domain.com listed in your search you can simply refer to these machines as foo and bar and the names will reolv to your local domain. If you don't have mulitiple machines, theres not much point in setting the search section.

Link to comment
Share on other sites

Thorpe, thanks for your response. I finally understand /etc/resolv.conf.

 

Now, how about /etc/hosts. If there are no other hosts that my server would need to communicate with, should the only entry in /etc/hosts be 127.0.0.1 localhost?

Link to comment
Share on other sites

Thorpe, thanks for your response. I finally understand /etc/resolv.conf.

 

Now, how about /etc/hosts. If there are no other hosts that my server would need to communicate with, should the only entry in /etc/hosts be 127.0.0.1 localhost?

 

Yeah, theres really no need to add any other entries to the /etc/hosts file unless there are other machines on your network. It also comes in handy when used with vhosts in apache though.

 

This way you could have foo.localhost and bar.localhost resolv to the same local machine.

Link to comment
Share on other sites

Yeah, theres really no need to add any other entries to the /etc/hosts file unless there are other machines on your network. It also comes in handy when used with vhosts in apache though.

 

This way you could have foo.localhost and bar.localhost resolv to the same local machine.

 

Excellent. It's one thing to read books about linux, and then it's another to actually know whats going on. Thanks for your help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.