# broadcasting hostname to local network



## kaivai (Aug 14, 2014)

Hey Folks!

I fear I might be a little green for most of the discussion here, but I was hoping that someone might be able to make some suggestions to help me with my networking configuration.

I can ping/ssh into my FreeBSD server/jails using their IP, but I cannot using their hostnames.

I think the issue might have something to do with how I configured a static IP using rc.conf instead of using DHCP. My default gateway just my regular consumer router, but I'm not allowing dynamic IPs to be assigned within a certain range which I keep for select computers on my home network (but I leave DHCP for visitors). Is there any way that I might be able to send hostnames to my router so that hostnames are resolvable from other computers?


```
#/etc/rc.conf
#-----------------
hostname="leebo"
defaultrouter="192.168.1.1"
ifconfig_rl0="inet 192.168.1.201/24"
sshd_enable="YES"
```

I tried adding 
	
	



```
send host-name "leebo";
```
 to my dhclient.conf but I don't believe that I'm using dhclient() if I'm not using DHCP. I could be pretty wrong here though.

Alternatively, would it be a cleaner solution to try configuring a static IP with dhclient() to play nicer with my router? Or maybe have the router point to the BSD machine as a nameserver? It's pretty old (2.8ghz no hyperthreading 256mb ram). Right now I'm just using it as a git repo, and orchestrating a handful of cron() jobs for other computers. 

Sorry if this question isn't very focused, I guess I'm looking for a good direction to work in. Thank you so much.


----------



## wblock@ (Aug 14, 2014)

The nice way to do this is to set the DHCP server to assign your chosen fixed addresses to the machines by MAC address.  Then each client can use DHCP and set their hostname... if the router supports that.  Stock router firmware might not, it's traditionally terrible.  However, given what has come out over the last year or so, nobody should be running stock firmware on a router anyway.  The DHCP servers in dd-wrt or OpenWRT should be full-featured.

An old P4 is more than adequate to provide DNS and DHCP and other services.  But it's a big, power-hungry computer, and the router can probably do this okay.

The catch: DHCP is not going to work for jails.  If the router allows DNS settings, you can define the static IP addresses for the jails there.


----------



## kaivai (Aug 14, 2014)

Hahaha, I tried installing ddwrt when I heard about that joelbackdoor thing on dlink routers, but after a day or so without internet and glares from the girlfriend I caved and I switched back to the standard firmware. She's pretty understanding with me playing with my own computers all the time, but bring down netflix on a weekend and those glares will burn a hole straight through you. I'll make my own as soon as I can afford a new machine to play with 

Darn - I'll check about DNS settings in the router, but I've got a feeling that for now I'll just define them in the /etc/hosts files on my other computers as a temporary fix. Some extra incentive to put some money away.

By the way, if this @wblock is Warren Block, thanks so much again - you helped me around Christmas with your tutorial on diskSetup for FreeBSD, and when I wrote to thank you you wrote back explaining about another issue I was having with the default unit being blocks instead of bytes. Thank you so much, you've been like my BSD fairy godmother. Cheers!

-Will


----------



## wblock@ (Aug 14, 2014)

Find a second router at a yard sale.  The various WRT54 versions are still fairly common.  They don't do 802.11n, and some versions don't have enough memory to use replacement firmware.  But find one that does, and they are rock-solid.

Yes, that's me.  I've been called many things, but that's a new one.   Welcome to the forums!


----------



## asteriskRoss (Aug 14, 2014)

kaivai said:
			
		

> after a day or so without internet and glares from the girlfriend I caved and I switched back to the standard firmware.


I feel your pain, @kaivai.  I solved this particular issue by taking advantage of my router's support for port-based VLANs.  Your router may or may not support this.  The devices that need to work when I'm not on hand to provide ad-hoc support are connected directly to the router on one VLAN, which has a basic DHCP server.  On a separate VLAN I have an old machine that I bought very cheaply running FreeBSD, providing services like DHCP and DNS just to that VLAN.  This means that I can use a more complicated configuration on my bit of the network but if my old and cheap box ever falls over then nobody but me cares or complains. Even running ZFS and quite a few service jails with only 512MB RAM and infrequent losses of mains power it hasn't failed me yet.


----------



## kaivai (Aug 14, 2014)

Thank you so much you guys!

That settles it then, I'll take another look at the ddwrt/tomato compatibility list and tour some thrift stores this weekend. I think that Value Village has a handful of old electronics at the back. 

@asteriskRoss - that sounds amazing, that's definitely the type of setup I'd like to work towards. I can tinker all day long, and comfortably break things for as long as I need to without worrying about having everything back online by noon or so when she wakes up.

This is great, thank you guys so much - I have a weekend project in the making!


----------

