Date: Sun, 14 Jun 1998 16:26:48 -0700 From: Tim Gerchmez <fewtch@serv.net> To: nik@FreeBSD.ORG Cc: freebsd-newbies@FreeBSD.ORG Subject: Re: Setting up a local nameservice. Message-ID: <3.0.5.32.19980614162648.007e5d10@mx.serv.net> In-Reply-To: <19980614235021.17830@nothing-going-on.org> References: <3.0.5.32.19980614142847.007eacc0@mx.serv.net> <3.0.5.32.19980614093142.007e5100@mx.serv.net> <3.0.5.32.19980613224241.007ecb30@mx.serv.net> <3.0.5.32.19980613224241.007ecb30@mx.serv.net> <19980614181014.41433@welearn.com.au> <3.0.5.32.19980614093142.007e5100@mx.serv.net> <19980614204319.17599@nothing-going-on.org> <3.0.5.32.19980614142847.007eacc0@mx.serv.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Actually, there is a MUCH easier way, as Sue got me started learning (and I fleshed out myself), and everything is now working to my satisfaction. (1) In BSD, comment out BIND in /etc/host.conf, then in /etc/hosts, add the IP addresses and names of all PC's on the local network. (2) On the win95 end of things, edit the file "hosts.sam" in \windows with essentially the same parameters, and copy it to a file named "hosts" in \windows. At this point everything is up and running, and you're not limited to any special IP addresses. I'm using 1.1.1.1 (desktop.local.net) for my main PC (easy to remember) and 1.1.1.2 (extra.local.net) for my secondary machine. Much easier, and 1.1.1.1 / 1.1.1.2 are not likely to be real Internet addresses, so it eliminates confusion on that end as well. Thanks for the tutorial though, I'll save it for future reference, as it might come in handy sometime. At 11:50 PM 6/14/98 +0100, you wrote: >On Sun, Jun 14, 1998 at 02:28:47PM -0700, Tim Gerchmez wrote: >> Is there any way to run named (I.E. so I can use http://extra-pc.local.net >> instead of http://123.123.123.1 (which is the IP address I chose for my >> BSD box) without having to go through the InterNIC and all that? > >Yes. Here's an outline below. If you can flesh this out and want to submit >this as documentation based on your experiences, that would be great. > >The basic premise is as follows: you're going to create a private network >for your own use. This network contains one or more machines. One machine >will be connected to the Internet (is the 'gateway'), all the other machines >connect through the gateway. > >Any IP addresses and/or hostnames that you use on your internal network >*will not be visible* to the wider Internet. This is a very important point. > >You're going to need two sorts of nameservice. Firstly, you need a way for >hosts on your network to look up IP addresses of machines that they connect >to on the wider Internet. Secondly, you need to be able to assign your >internal machines IP addresses, safe in the knowledge that they won't >clash with anyone elses. > >Your network numbers can be in one of three blocks: > > 10.0.0.0 thru 10.255.255.255 > >or > > 172.16.0.0 thru 172.31.255.255 > >or > > 192.168.0.0 thru 192.168.255.255 > >(see the comments in your /etc/hosts file). These addresses *must not* be >propogated on to the Internet. As long as everyone follows this rule it >means that you can use them and know that they won't clash. Someone, >somewhere, has 123.123.123.1, and you're using it. This will eventually >cause problems. > >For simplicities sake (because I can cut-n-paste most of my config) this >example is going to assume that you're using addresses from the 192.168 >set. > >Now to create your local DNS. Since it's local you can have any names you >want, including your own top-level domain. For this example, lets assume >that you want all your machines to be in the .tim top level domain, with >machines like smtp.tim, www.tim, news.tim, and so on. > >You will need to configure a nameserver to be authoritative for this domain, >and then tell all the machines on your network to look up their names from >this nameserver. > >Imagine your network is set up like this (keep in mind that a computer can >have multiple IP addresses) > > IP Host Description > ---------------------------------------------------------------------- > 192.168.1.1 gw.tim Gateway, connected to the Internet. All > other machines are told that this IP is their > default route. > > 192.168.1.2 ns-1.tim The (first) nameserver. All machines are told > to use this for their nameservice. > > 192.168.1.8 smtp.tim Incoming and outgoing SMTP (mail) > > 192.168.1.9 nntp.tim Incoming and outgoing NNTP (news). Will also be > known as 'news.tim' > > 192.168.1.16 http.tim Internal web server. Will also be known as > www.tim > > 192.168.1.32 win95.tim A Windows 95 machine > >Notice that the IP addresses don't increase lineraly. This is just a little >foible of mine. Important machines (gateway, DNS etc) get from 1-7, text >based communication hosts are in 8-15, other services are on 16-31, and >user's machines start from 32 and go on from there. This is just my >personal preference when assigning numbers to hosts. > >Now, assume that you have one machine (FreeBSD) and it's performing all >the functions from .1 through to .31. In other words it's gateway, mail, >news, and web. > >First, you need to configure /etc/rc.conf.local > >[/etc/rc.conf.local] > # Note how you don't need to edit /etc/rc.conf, you can put your changes > # in /etc/rc.conf.local. This makes seeing what you've changed (and > # upgrading) much easier. > > # My main hostname is 'gw.tim' > hostname="gw.tim" > > # I have two configurable network interfaces, the loopback (lo0) and the > # network card (ed0 in this example, although yours may be different) > network_interfaces="lo0 ed0" > > # Configure the loopback if > ifconfig_lo0="inet 127.0.0.1" > > # Assign the primary IP address to the network card > ifconfig_ed0="inet 192.168.1.1" > > # This machine has multiple IP addresses assigned to it. We put these > # addresses on the ed0 interface. > ifconfig_ed0_alias0="inet 192.168.1.2 netmask 0xffffffff" > ifconfig_ed0_alias1="inet 192.168.1.8 netmask 0xffffffff" > ifconfig_ed0_alias2="inet 192.168.1.9 netmask 0xffffffff" > ifconfig_ed0_alias3="inet 192.168.1.16 netmask 0xffffffff" > > # Start named at boot > named_enable="YES" > named_flags="-b /etc/namedb/named.boot" > > # We'll be gatewaying packets > gateway_enable="YES" > >That will (at boot time) assign those IP addresses to your network interface, >ready to be queried. > >Now you need to configure up your nameserver. This is not the simplest task >in the world, but can be simplified with the O'Reilly book "DNS And Bind" >by (I think) Cricket and Liu. > >This is the named boot file, which configures named and specifies several >other files. > >[/etc/namedb/named.boot] > directory /etc/namedb > > ; I'm primary for the .tim domain and the 192.168.1 reverse domain, so > ; say so, and specify the files that contain that info > primary tim tim.db > primary 1.168.192.IN-ADDR.ARPA tim.rev > > ; I'm also primary for the 127.* addresses, since that's the loopback > primary 0.0.127.IN-ADDR.ARPA localhost.rev > > ; My ISP must run some nameservers. I put their IP addresses in here, > ; so that if I don't know the answer to a query I can ask them. > forwarders a.b.c.d > > ; And that's all I want to do > options forward-only > >We can then configure the other files mentioned there. I haven't got the >time (or space) to properly explain the format of this file -- the O'Reilly >book I mentioned covers it all in great detail. > >This covers the mappings between names to IP addresses (referred to as the >'forward' mapping. > >[/etc/namedb/tim.db] > @ IN SOA gw.tim. root.gw.tim. ( > 19980614 ; Serial number, update this each time this file changes > 10800 ; Refresh time (seconds) > 3600 ; Retry time (seconds) > 604800 ; Expire time (seconds) > 86400 ) ; Minimum time (seconds) > > tim. IN NS ns-1.tim. > > ; That's the (fairly standard) preamble out of the way. Now we start > ; defining the name -> IP mapping > > localhost IN A 127.0.0.1 > IN MX 5 smtp.tim. > > gw IN A 192.168.1.1 > IN MX 5 smtp.tim. > > ns-1 IN A 192.168.1.2 > IN MX 5 smtp.tim. > > smtp IN A 192.168.1.8 > IN MX 5 smtp.tim. > > ; nntp and http have aliases to the slighly more common names 'news' and > ; 'www' > nntp IN A 192.168.1.9 > IN MX 5 smtp.tim. > IN CNAME news.tim. > > http IN A 192.168.1.16 > IN MX 5 smtp.tim. > IN CNAME www.tim. > > > ; Now the user machines > win95 IN A 192.168.1.32 > IN MX 5 smtp.tim. > >This covers IP addresses to names (the reverse mapping). In this file, IP >addresses are written in reverse order. > >[/etc/namedb/tim.rev] > @ IN SOA gw.tim. root.gw.tim. ( > 19980614 ; Serial number, update this each time this file changes > 10800 ; Refresh time (seconds) > 3600 ; Retry time (seconds) > 604800 ; Expire time (seconds) > 86400 ) ; Minimum time (seconds) > > 1.168.192.in-addr.arpa. IN NS ns-1.tim. > > 1 IN PTR gw.tim. > 2 IN PTR ns-1.tim. > 8 IN PTR smtp.tim. > 9 IN PTR nntp.tim. > 16 IN PTR http.tim. > > 32 IN PTR win95.tim. > >Finally, you also need a reverse file for the 127.* range > >[/etc/namedb/localhost.rev] > @ IN SOA gw.tim. root.gw.tim. ( > 19980614 ; Serial number, update this each time this file changes > 10800 ; Refresh time (seconds) > 3600 ; Retry time (seconds) > 604800 ; Expire time (seconds) > 86400 ) ; Minimum time (seconds) > > IN NS ns-1.tim. > > 1 IN PTR localhost.tim. > >That's that part of the config done. Note that the trailing '.' on the >hostnames is significant. > >You can now probably remove a lot of the IP addresses you have in /etc/hosts >and put 'bind' back in /etc/host.conf. You also need to tell your system >where to do its name lookups in /etc/resolv.conf. > >[/etc/resolv.conf] > nameserver ns-1.tim > domain tim > >while /etc/hosts will probably need to look like > >[/etc/hosts] > 127.0.0.1 localhost.tim localhost > 192.168.1.1 gw.tim gw > 192.168.1.2 ns-1.tim ns-1 > >In essence, /etc/hosts only needs to contain an IP address for the loopback, >it's own IP address, and the IP address of the name server. > >After a reboot, that should be sufficient for you to run 'nslookup' as root >and see something like > > # nslookup > Default Server: gw.tim > Address: 0.0.0.0 > > > smtp > Server: gw.tim > Address: 0.0.0.0 > > Name: smtp.tim > Address: 192.168.1.8 > > ^D > >which is a pretty good sign that things are working. > >You should then be able to configure your Windows 95 machine that > > Its name is "win95.tim" (obviously you'll want to change this in here > and in the other config files I've just listed to something more useful). > > Its IP address is 192.168.1.32. > > Its netmask is 255.255.255.0 > > Its default gateway is 192.168.1.1 > > Its default nameserver is 192.168.1.2 > >and things should just work. > >If you've got other software configured that may need reconfiguring with the >new IP addresses. > >Note also that there's no need for the machine's primary interface to be >called .1 (and for you to call your machine gw). You could instead >call it something like freebsd.tim with .33 as it's IP address. In this >case, you would put the .33 in the ifconfig_ed0 line in /etc/rc.conf.local >and add an ifconfig_ed0_alias line to add .1 as an alias on ed0 as well. > >Make sense? > >I've set replies to this message to go to nik@freebsd.org, where they'll >be redirected to me if you reply tomorrow. > >N -- My web site starts at http://www.serv.net/~fewtch/index.html - lots of goodies for everyone, have a look if you have the time. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-newbies" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.5.32.19980614162648.007e5d10>