# Losing Nameserver access



## GrizzlyKing (Feb 16, 2011)

Hello.  I'm 100% new to FreeBSD.  I just installed it on a recycled DeskPC with a 200GB harddrive, 1GB memory and an AMD 1600+ CPU.  The install went smoothly, including installing Diablo Java and TomCat6.  Some really great documentation out there for us newcomers. Thanks!

However, I seem to be losing reference to my nameserver (DNS) as is evidenced when FTP will fail with this error message: 
	
	



```
hostname nor servname provided, or not known
```
 I do not, however, lose remote access over my network (using Putty) to the computer so I do not think that there is a problem with my NIC.

If I run [cmd=]dhclient fxp0[/cmd] I get the following:


```
DHCPREQUEST on fxp0 to 255.255.255.255 port 67
DHCPACK from 192.168.50.1
bound to 192.168.50.72 -- renewal in 43200 seconds.
```

and then the FTP works correctly.  

I want to use a static address and not DHCP.  My firewall hardware is also a DHCP server (192.168.50.1) and it is connected to the internet via a ADLS Modem supplied by my ISP (192.168.1.1) which is thus my default nameserver (DNS).

Below are excerpts from rc.conf, resolv.conf and *ifconfig*.  Thanks for any help.....GK

/etc/rc.conf contents:


```
#ifconfig_fxp0="DHCP"
ifconfig_fxp0="inet 192.168.50.72 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
inetd_enable="YES"
moused_enable="YES"
moused_type="auto"
sshd_enable="YES"
```

/etc/resolv.conf contents, note this file was populated by the system and not me:


```
nameserver 192.168.1.1
nameserver 80.10.246.2
nameserver 80.10.246.129
```

*ifconfig* content:


```
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=2008<VLAN_MTU,WOL_MAGIC>
        ether 00:08:c7:b3:58:98
        inet 192.168.50.72 netmask 0xffffff00 broadcast 192.168.50.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
vr0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=82808<VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE>
        ether 00:0c:76:e6:6a:cd
        media: Ethernet autoselect (none)
        status: no carrier
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
```


----------



## DutchDaemon (Feb 16, 2011)

What does your /etc/resolv.conf look like immediately after a reboot, and what does it look like after running a DHCP request? I see that you have a static IP defined in your /etc/rc.conf, but that you can also get one from a DHCP server. If the latter always produces the desired result, the obvious suggestion would be to use 
	
	



```
ifconfig_fxp0="SYNCDHCP"
```
 and never look back.


----------



## SirDice (Feb 16, 2011)

GrizzlyKing said:
			
		

> I want to use a static address and not DHCP.


Then you also need to create a /etc/resolv.conf file containing your DNS servers. See resolv.conf(5).

When using DHCP this file is created automatically with the data sent by the DHCP server.


----------



## DutchDaemon (Feb 16, 2011)

BTW, getting a _static_ address from DHCP is not exactly rocket surgery ..


----------



## jalla (Feb 16, 2011)

Your defaultrouter (192.168.1.1) isn't reachable from 192.168.50.72
If you insist on using a fixed ipaddress, you should probably point your default route at 192.168.50.1.


----------



## GrizzlyKing (Feb 16, 2011)

Gentlemen....Many thanks for your replies.

First, to address DutchDaemon's question, the resolv.conf after boot was as I indicated in my original post and 
`FTP ftp.xxx.com` 
failed as in my original post.  

I deleted resolv.conf content and rebooted.  Now the file remained empty, ie no nameserver entries.
`FTP ftp.xxx.com`
failed as in my original post.

Running 
`dhclient fxp0`
fixed the problem, ie FTP worked and the resolv.conf was again populated as in the original post.

Rebooting here returned the system to its original state, ie FTP failing.

Now, SirDice, thanks for your comment.  I guess since I used DHCP originally during the setup process this file was automatically created and populated. I have added a comment about this into my notes.

Finally, Jalla, I think you may have hit on the solution to the problem.  When I changed the 
	
	



```
defaultrouter
```
 line in rc.conf from 192.168.1.1 to 192.168.50.1 and rebooted, magic, the FTP works.  I guess I had the roles of my ISP's ADLS modem/router and my hardware firewall router mixed up. A beginner's mistake.

Last, yes I know I said finally for Jalla, but DutchDaemon, you are right about setting up my DHCP server to issue a static address for this MAC address.  As I am basically just 'playing' with FreeBSD I did not want to setup anything permanent at this time.

For now I assume the problem has been fixed so I will list this as solved.....GK


----------

