how to set hostname on a cable line?

Polytropon freebsd at edvax.de
Wed Mar 21 22:23:03 UTC 2018


On Wed, 21 Mar 2018 21:30:05 +0000, Anton Shterenlikht wrote:
> On Thu, Mar 22, 2018 at 12:47:50AM +0530, Manish Jain wrote:
> > On 03/22/18 00:04, Anton Shterenlikht wrote:
> > > I cannot seem to set hostname
> > > correctly on a home laptop,
> > > which has a wireless connection
> > > to a cable router.
> > > 
> > > How do I do it?
> > > 
> > > I have
> > > 
> > > hostname=""
> > > ifconfig_wlan0="SYNCDHCP WPA"
> > > 
> > > in /etc/rc.conf
> > > 
> > > According to rc.conf(5):
> > > 
> > >                   If dhclient(8) is used to set the hostname via DHCP, this
> > >                   variable should be set to an empty string.
> > > 
> > > But I still get empty hostname after boot:
> > > 
> > > # hostname
> > > 
> > > #
> > > 
> > > # cat /var/db/dhclient.leases.wlan0
> > > lease {
> > >    interface "wlan0";
> > >    fixed-address 192.168.1.104;
> > >    next-server 192.168.1.1;
> > >    option subnet-mask 255.255.255.0;
> > >    option routers 192.168.1.1;
> > >    option domain-name-servers 194.168.4.100,194.168.8.100;
> > >    option host-name "00215c5068c3";
> > >    option domain-name "cable.virginmedia.net";
> > >    option dhcp-lease-time 86400;
> > >    option dhcp-message-type 5;
> > >    option dhcp-server-identifier 192.168.1.1;
> > >    option dhcp-renewal-time 43200;
> > >    option dhcp-rebinding-time 75600;
> > >    renew 4 2018/3/22 07:21:14;
> > >    rebind 4 2018/3/22 16:21:14;
> > >    expire 4 2018/3/22 19:21:14;
> > > }
> > > 
> > > # cat /etc/resolv.conf
> > > # Generated by resolvconf
> > > search cable.virginmedia.net
> > > nameserver 194.168.4.100
> > > nameserver 194.168.8.100
> > > 
> > > 
> > > Does that help me?
> > > 
> > > I cannot run MPI programs without having a correct
> > > hostname, i.e. I should be able to do ssh `hostname`.
> > > 
> > > What am I missing?
> > > 
> > > Thanks
> > > 
> > > Anton
> > 
> > 
> > Have you tried setting the hostname with 'bsdconfig networking' ?
> 
> Maybe I didn't explain myself well.
> 
> I need a fully qualified domain name (FQDM).
> 
> Perhaps I just cannot have one from a wireless router
> at home?

Check the configuration of the device that hands out configuration
data via DHCP to check if you can define the FQDN from within there.
If not, you can always manually set it using

	hostname="fqdn.example.com"

in /etc/rc.conf (or using "bsdconfig networking" interactively).

If yout DHCP server runs FreeBSD + isc-dhcpd, you can use its
configuration file dhcpd.conf with the setting

	option domain-name "fqdn.example.com";

to have it send a FQDN to a specific host upon DHCP request;
make sure that only the intended machine will receive that
one FQDN, for example by using its MAC address for correct
identification:

	host someserver {
		hardware ethernet 00:11:22:33:44:55;
		fixed-address 123.45.678.90;
		option domain-name "fqdn.example.com";
	}

See "man dhcpd.conf" for details (in case this applies).




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list