<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chesty&#039;s Blog &#187; hostname</title>
	<atom:link href="http://chesterton.id.au/blog/tag/hostname/feed/" rel="self" type="application/rss+xml" />
	<link>http://chesterton.id.au/blog</link>
	<description>Press Belly Button to Begin</description>
	<lastBuildDate>Sat, 02 Apr 2011 01:24:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Basic Hostname Set Up Part 2</title>
		<link>http://chesterton.id.au/blog/2010/06/04/basic-hostname-set-up-part-2/</link>
		<comments>http://chesterton.id.au/blog/2010/06/04/basic-hostname-set-up-part-2/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 16:16:38 +0000</pubDate>
		<dc:creator>chesty</dc:creator>
				<category><![CDATA[LA]]></category>
		<category><![CDATA[Slug]]></category>
		<category><![CDATA[ubuntu-au]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://chesterton.id.au/blog/?p=85</guid>
		<description><![CDATA[<p><a href="http://chesterton.id.au/blog/2010/06/04/basic-hostname-set-up-part-2/">Basic Hostname Set Up Part 2</a></p>
Basic Hostname Set Up Part 2 I left a few things unsaid in my previous post basic hostname set up, and after talking with some people about /etc/hosts, I thought a quick follow up is in order. Firstly, my preference is to use the ethernet&#8217;s ip address to tie the host name to the FQDN, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://chesterton.id.au/blog/2010/06/04/basic-hostname-set-up-part-2/">Basic Hostname Set Up Part 2</a></p>
<p>I left a few things unsaid in my previous post <a href="http://chesterton.id.au/blog/2010/06/02/basic-hostname-set-up/">basic hostname set up</a>, and after talking with some people about <code>/etc/hosts</code>, I thought a quick follow up is in order.</p>
<p>Firstly, my preference is to use the ethernet&#8217;s ip address to tie the host name to the FQDN, but others like to use <code>127.0.1.1</code>. There&#8217;s a case where you really should use <code>127.0.1.1</code> and that&#8217;s in laptops where the ethernet interface might disappear when it&#8217;s disconnected, probably desktops with dynamic ip addresses, too. But for servers with a static ip address, take your pick, I chose to use eth0.</p>
<p>An example <code>/etc/hosts</code> for a laptop<br />
<code>127.0.0.1 localhost<br />
127.0.1.1 mymailname.com myhostname<br />
</code></p>
<p>Where myhostname is the host name configured in the kernel.</p>
<p>An example <code>/etc/hosts</code> for a server<br />
<code>127.0.0.1 localhost<br />
192.168.1.1 mymailname.com myhostname.mymailname.com someothername myhostname<br />
</code></p>
<p>When the kernel first boots, the host name is configured. How depends on the distribution. Ubuntu seems to use <code>/etc/hostname</code>. In my example <code>/etc/hostname</code> contains myhostname .</p>
<p>When you run the command <code>hostname</code> it does a <code>gethostname()</code> to get the configured host name. It doesn&#8217;t reread <code>/etc/hostname</code> every time, it&#8217;s stored in the kernel, presumably.</p>
<p>When you want the FQDN, you run <code>hostname -f</code>, it does a <code>gethostname()</code> to get the configured host name, then does a <code>getaddrinfo("myhostname",...)</code> to get the FQDN. Using the last <code>/etc/hosts</code> example, the FQDN is mymailname.com because it&#8217;s the first string after the ip address in the line where myhostname appears.</p>
<p>Short names such as the host name myhostname should go at the end of the line, what you want the FQDN to be should be the first string after the ip address, and any other names goes in the middle.</p>
<p>In my examples, I made the FQDN the mail name, because some distributions use the FQDN by default as the mail name. Ubuntu doesn&#8217;t, it appears to use <code>/etc/mailname</code>.</p>
<p>Anyway, that&#8217;s my understanding based on messing around and reading a man page. Hopefully I&#8217;ve explained how the host name and the FQDN is tied together in <code>/etc/hosts</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://chesterton.id.au/blog/2010/06/04/basic-hostname-set-up-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Hostname Set Up</title>
		<link>http://chesterton.id.au/blog/2010/06/02/basic-hostname-set-up/</link>
		<comments>http://chesterton.id.au/blog/2010/06/02/basic-hostname-set-up/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 08:15:21 +0000</pubDate>
		<dc:creator>chesty</dc:creator>
				<category><![CDATA[LA]]></category>
		<category><![CDATA[Slug]]></category>
		<category><![CDATA[ubuntu-au]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://chesterton.id.au/blog/?p=80</guid>
		<description><![CDATA[<p><a href="http://chesterton.id.au/blog/2010/06/02/basic-hostname-set-up/">Basic Hostname Set Up</a></p>
Basic Hostname Set Up I was helping out someone with a postfix issue, and something just clicked that will speed up diagnosing similar problems. It&#8217;s not so much a postfix problem as a hostname problem, and it&#8217;s very basic. The symptom was, mail sent to the server at domain.com was being bounced. Looking at postfix [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://chesterton.id.au/blog/2010/06/02/basic-hostname-set-up/">Basic Hostname Set Up</a></p>
<p>I was helping out someone with a postfix issue, and something just clicked that will speed up diagnosing similar problems. It&#8217;s not so much a postfix problem as a hostname problem, and it&#8217;s very basic.</p>
<p>The symptom was, mail sent to the server at domain.com was being bounced. Looking at postfix logs, postfix was trying to deliver the mail to s123.s123. (something like that, anyway)</p>
<p>To the quick, <code>hostname</code> printed s123 and <code>hostname -f</code> said something to the tune of it couldn&#8217;t find the FQDN. </p>
<p>The fix, edit <code>/etc/hosts</code> to look like</p>
<p><code><br />
127.0.0.1 localhost<br />
1.2.3.4 domain.com s123<br />
</code></p>
<p>Where <code>1.2.3.4</code> is the ethernet&#8217;s ip address.</p>
<p>Now, <code>hostname</code> said s123 and <code>hostname -f</code> said domain.com . A restart of postfix, and it was accepting mail again.</p>
<p>The thing that clicked was the relationship between <code>/etc/hosts</code>, <code>hostname</code> and <code>hostname -f</code>.</p>
<p>See <a href="http://chesterton.id.au/blog/2010/06/04/basic-hostname-set-up-part-2/">basic hostname set up part 2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://chesterton.id.au/blog/2010/06/02/basic-hostname-set-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

