<?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>WiredRevolution.com &#187; IP address</title>
	<atom:link href="http://www.wiredrevolution.com/tag/ip-address/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wiredrevolution.com</link>
	<description>A Bit of Linux Wisdom</description>
	<lastBuildDate>Wed, 18 Jan 2012 22:45:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Clone a VirtualBox Guest VM</title>
		<link>http://www.wiredrevolution.com/virtualbox/clone-a-virtualbox-guest-vm?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=clone-a-virtualbox-guest-vm</link>
		<comments>http://www.wiredrevolution.com/virtualbox/clone-a-virtualbox-guest-vm#comments</comments>
		<pubDate>Mon, 13 Sep 2010 14:23:20 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[virtualbox]]></category>
		<category><![CDATA[clone]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[disk image]]></category>
		<category><![CDATA[drive]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[guest]]></category>
		<category><![CDATA[hard disk]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[IP address]]></category>
		<category><![CDATA[mac address]]></category>
		<category><![CDATA[static IP]]></category>
		<category><![CDATA[VBoxManage]]></category>
		<category><![CDATA[vdi]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[VM]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=1279</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/virtualbox-icon.png" width="91" height="100" alt="" title="virtualbox" /><br/>Having a clone of a particular VM is helpful whether you want to keep a backup vanilla image to use in the future, or create a cluster of identical machines that can run in parallel. This process is not well documented and can be slightly tricky. Hopefully this guide will help many of you through [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/virtualbox/setup-ssh-access-between-virtualbox-host-and-guest-vms' rel='bookmark' title='Permanent Link: Setup SSH access between VirtualBox Host and Guest VMs'>Setup SSH access between VirtualBox Host and Guest VMs</a></li>
<li><a href='http://www.wiredrevolution.com/virtualbox/mount-a-virtualbox-shared-folder-inside-a-guest-vm' rel='bookmark' title='Permanent Link: Mount a VirtualBox shared folder inside a guest VM'>Mount a VirtualBox shared folder inside a guest VM</a></li>
<li><a href='http://www.wiredrevolution.com/virtualbox/setup-usb-support-in-oracle-virtualbox' rel='bookmark' title='Permanent Link: Setup USB support in Oracle VirtualBox'>Setup USB support in Oracle VirtualBox</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/virtualbox-icon.png" width="91" height="100" alt="" title="virtualbox" /><br/><p>Having a clone of a particular VM is helpful whether you want to keep a backup vanilla image to use in the future, or create a cluster of identical machines that can run in parallel. This process is not well documented and can be slightly tricky. Hopefully this guide will help many of you through the process.</p>
<p>First off make sure your Guest virtual machine is shut down and <strong>not running or suspended</strong> and then run:<br />
<code>$ VBoxManage clonevdi source.vdi target.vdi</code></p>
<p>This may take a few minutes depending on the size of your VM<br />
<code>Oracle VM VirtualBox Command Line Management Interface Version 3.2.8<br />
(C) 2005-2010 Oracle Corporation<br />
All rights reserved.<br />
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%<br />
Clone hard disk created in format 'VDI'. UUID: c18b8549-33ab-41a1-8d66-25f884fef86a<br />
</code></p>
<p>Now that you have cloned your disk image, you need to create another VM. Duplicate the exact setup you had with the previous VM, making sure to create the same network adapters, shared folders, memory limits, etc. </p>
<p>The final step is to attach the cloned vdi to your new VM and start it.</p>
<p><strong>Common Issues:</strong></p>
<p>- VirtualBox will create new random MAC addresses for network adapters. This may or may not cause a problem. If it does you will have to reconfigure the device within the cloned VM if you want to use the old and cloned VM simultaneously, otherwise you can change the MAC address to be the same as the original.</p>
<p>- You may want to change the hostname as well as the IP address if it is statically allocated. Again if you are not running multiple machines simultaneously this may not be a problem for you. </p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/virtualbox/setup-ssh-access-between-virtualbox-host-and-guest-vms' rel='bookmark' title='Permanent Link: Setup SSH access between VirtualBox Host and Guest VMs'>Setup SSH access between VirtualBox Host and Guest VMs</a></li>
<li><a href='http://www.wiredrevolution.com/virtualbox/mount-a-virtualbox-shared-folder-inside-a-guest-vm' rel='bookmark' title='Permanent Link: Mount a VirtualBox shared folder inside a guest VM'>Mount a VirtualBox shared folder inside a guest VM</a></li>
<li><a href='http://www.wiredrevolution.com/virtualbox/setup-usb-support-in-oracle-virtualbox' rel='bookmark' title='Permanent Link: Setup USB support in Oracle VirtualBox'>Setup USB support in Oracle VirtualBox</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/virtualbox/clone-a-virtualbox-guest-vm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to SSH into Ubuntu LiveCD</title>
		<link>http://www.wiredrevolution.com/ubuntu/how-to-ssh-into-ubuntu-livecd?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-ssh-into-ubuntu-livecd</link>
		<comments>http://www.wiredrevolution.com/ubuntu/how-to-ssh-into-ubuntu-livecd#comments</comments>
		<pubDate>Tue, 16 Dec 2008 14:08:44 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[8.10]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[aptitude]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[inet addr]]></category>
		<category><![CDATA[intrepid]]></category>
		<category><![CDATA[IP address]]></category>
		<category><![CDATA[livecd]]></category>
		<category><![CDATA[openssh_server]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=865</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/ubuntu_icon.png" width="80" height="78" alt="" title="ubuntu" /><br/>The ability to remotely SSH into a machine running an Ubuntu LiveCD can come in handy in many situations. The LiveCD supports a large variety of hardware and can be used to troubleshoot system problems on a machine where you have limited or no access. A user with limited skills can easily setup remote access [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/system-administration/share-a-remote-filesystem-over-ssh' rel='bookmark' title='Permanent Link: Share a remote filesystem over SSH'>Share a remote filesystem over SSH</a></li>
<li><a href='http://www.wiredrevolution.com/system-administration/how-to-x-session-forwarding-over-ssh' rel='bookmark' title='Permanent Link: How to X session forwarding over SSH'>How to X session forwarding over SSH</a></li>
<li><a href='http://www.wiredrevolution.com/ubuntu/allow-sudo-access-without-passwords-in-ubuntu' rel='bookmark' title='Permanent Link: Allow sudo access without passwords in Ubuntu'>Allow sudo access without passwords in Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/ubuntu_icon.png" width="80" height="78" alt="" title="ubuntu" /><br/><p>The ability to remotely <strong>SSH</strong> into a machine running an <strong>Ubuntu</strong> <strong>LiveCD</strong> can come in handy in many situations. The LiveCD supports a large variety of hardware and can be used to troubleshoot system problems on a machine where you have limited or no access. A user with limited skills can easily setup remote access and allow a trusted friend to troubleshoot the system from another location.</p>
<p>The first thing to start the process is to open a <strong>terminal</strong>. Follow these menus:</p>
<p><strong>Applications -> Accessories -> Terminal</strong></p>
<p>In the terminal install the <strong>ssh server</strong> on your LiveCD system.</p>
<pre>
$ sudo apt-get install openssh-server
</pre>
<p>The server is started automatically after installing. </p>
<p>To login remotely, you’ll need to set the password for the default ubuntu user.</p>
<pre>
$ sudo passwd ubuntu
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
</pre>
<p>You should now be able to login to the system running the LiveCD. But first you need to <a href="http://www.wiredrevolution.com/system-administration/find-your-ip-address-with-ifconfig">find the IP address</a> of the machine so you can connect to it.</p>
<p>The <strong>ifconfig</strong> command will list your network interfaces and along with it your IP address.</p>
<pre>
$ ifconfig
</pre>
<pre>
eth0      ...
          <strong>inet addr:192.168.1.1</strong>  Bcast:192.168.2.255  Mask:255.255.255.0
          ...
</pre>
<p>The <strong>inet addr</strong> entry is your IP address which you need to log into the LiveCD system. As you an see above the IP address begins with &#8220;<strong>192.168</strong>&#8221; which indicates that the IP address is only valid on the local network. It was an address assigned to the machine by the router.  This is fine if you plan on logging in from another machine on this local network.</p>
<p>If you need to access the machine from outside your local network you have a couple of options.  The first is to remove any router between you and the Internet. This should give you a valid IP address which is accessible from outside your local network. You may also be able to access your router&#8217;s administration panel and tell it to pass SSH traffic to the IP address of the LiveCD system.  You will then use the router&#8217;s IP address instead for the next step.</p>
<p>If your IP address already begins with something other than &#8220;<strong>192.168</strong>&#8221; then you are safe as well. You should be able to access the LiveCD system from any location, local or not.</p>
<p>Using the IP address from the previous step you can now log into the LiveCD system as the ubuntu user. Use the password you created earler.</p>
<pre>
$ ssh ubuntu@&lt;IP Address&gt;
</pre>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/system-administration/share-a-remote-filesystem-over-ssh' rel='bookmark' title='Permanent Link: Share a remote filesystem over SSH'>Share a remote filesystem over SSH</a></li>
<li><a href='http://www.wiredrevolution.com/system-administration/how-to-x-session-forwarding-over-ssh' rel='bookmark' title='Permanent Link: How to X session forwarding over SSH'>How to X session forwarding over SSH</a></li>
<li><a href='http://www.wiredrevolution.com/ubuntu/allow-sudo-access-without-passwords-in-ubuntu' rel='bookmark' title='Permanent Link: Allow sudo access without passwords in Ubuntu'>Allow sudo access without passwords in Ubuntu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/ubuntu/how-to-ssh-into-ubuntu-livecd/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Find IP address from remote end of a TCP socket</title>
		<link>http://www.wiredrevolution.com/c/find-ip-address-from-remote-end-of-a-tcp-socket?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-ip-address-from-remote-end-of-a-tcp-socket</link>
		<comments>http://www.wiredrevolution.com/c/find-ip-address-from-remote-end-of-a-tcp-socket#comments</comments>
		<pubDate>Fri, 31 Oct 2008 12:49:34 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[getpeername]]></category>
		<category><![CDATA[inet_ntoa]]></category>
		<category><![CDATA[IP address]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sockaddr]]></category>
		<category><![CDATA[sockaddr_in]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[TCP]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=560</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/c_icon.png" width="80" height="80" alt="" title="C" /><br/>In C or C++ it is fairly simple to find the IP address of the remote end of a TCP socket. The following example shows how to do this using the getpeername() and inet_ntoa() system calls. int sockfd; int len; char * hostip; struct sockaddr_in sin; len = sizeof(sin); if (0 != getpeername(sockfd, (struct sockaddr [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/c/display-hostname-and-ip-address-in-c' rel='bookmark' title='Permanent Link: Display hostname and IP address in C'>Display hostname and IP address in C</a></li>
<li><a href='http://www.wiredrevolution.com/windows/find-the-mac-address-on-a-windows-machine' rel='bookmark' title='Permanent Link: Find the MAC address on a Windows machine'>Find the MAC address on a Windows machine</a></li>
<li><a href='http://www.wiredrevolution.com/c/format-output-using-printf' rel='bookmark' title='Permanent Link: Format output using printf'>Format output using printf</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/c_icon.png" width="80" height="80" alt="" title="C" /><br/><p>In C or C++ it is fairly simple to find the IP address of the remote end of a TCP socket.</p>
<p>The following example shows how to do this using the <strong>getpeername</strong>() and <strong>inet_ntoa</strong>() system calls.</p>
<pre>
int sockfd;
int len;
char * hostip;
struct sockaddr_in sin;

len = sizeof(sin);

if (0 != getpeername(sockfd, (struct sockaddr *) &#038;sin, &#038;len))
        perror("getpeername");
}

hostip = inet_ntoa(sin.sin_addr);

printf("client IP: %s\n", hostip);
</pre>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/c/display-hostname-and-ip-address-in-c' rel='bookmark' title='Permanent Link: Display hostname and IP address in C'>Display hostname and IP address in C</a></li>
<li><a href='http://www.wiredrevolution.com/windows/find-the-mac-address-on-a-windows-machine' rel='bookmark' title='Permanent Link: Find the MAC address on a Windows machine'>Find the MAC address on a Windows machine</a></li>
<li><a href='http://www.wiredrevolution.com/c/format-output-using-printf' rel='bookmark' title='Permanent Link: Format output using printf'>Format output using printf</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/c/find-ip-address-from-remote-end-of-a-tcp-socket/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find your IP address with ifconfig</title>
		<link>http://www.wiredrevolution.com/system-administration/find-your-ip-address-with-ifconfig?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-your-ip-address-with-ifconfig</link>
		<comments>http://www.wiredrevolution.com/system-administration/find-your-ip-address-with-ifconfig#comments</comments>
		<pubDate>Thu, 30 Oct 2008 10:48:07 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[inet addr]]></category>
		<category><![CDATA[IP address]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=544</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/sysadmin_icon.png" width="80" height="94" alt="" title="system administration" /><br/>You can find the IP address of your system at the command line by using the ifconfig command. The ifconfig command will show you information on all your network interfaces. If no arguments are given ifconfig displays the status of the currently active interfaces. You have to run this command as root or use sudo. [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/system-administration/find-your-mac-address-with-ifconfig' rel='bookmark' title='Permanent Link: Find your MAC address with ifconfig'>Find your MAC address with ifconfig</a></li>
<li><a href='http://www.wiredrevolution.com/virtualbox/setup-ssh-access-between-virtualbox-host-and-guest-vms' rel='bookmark' title='Permanent Link: Setup SSH access between VirtualBox Host and Guest VMs'>Setup SSH access between VirtualBox Host and Guest VMs</a></li>
<li><a href='http://www.wiredrevolution.com/ubuntu/how-to-ssh-into-ubuntu-livecd' rel='bookmark' title='Permanent Link: How to SSH into Ubuntu LiveCD'>How to SSH into Ubuntu LiveCD</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/sysadmin_icon.png" width="80" height="94" alt="" title="system administration" /><br/><p>You can find the IP address of your system at the command line by using the <strong>ifconfig</strong> command.  The ifconfig command will show you information on all your network interfaces.  If no arguments are given ifconfig displays the status of the currently active interfaces.</p>
<p>You have to run this command as root or <a href="http://www.wiredrevolution.com/commands/submit-commands-as-root-with-sudo">use sudo</a>.</p>
<pre>
# ifconfig
</pre>
<pre>
wlan0     Link encap:Ethernet  HWaddr a1:b2:c3:d4:e5:f6
          <strong>inet addr:192.168.2.11</strong>  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
          RX packets:4007 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4246 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3292271 (3.1 MiB)  TX bytes:994922 (971.6 KiB)
</pre>
<p>Your IP address is displayed in the <strong>inet addr</strong> field.</p>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/system-administration/find-your-mac-address-with-ifconfig' rel='bookmark' title='Permanent Link: Find your MAC address with ifconfig'>Find your MAC address with ifconfig</a></li>
<li><a href='http://www.wiredrevolution.com/virtualbox/setup-ssh-access-between-virtualbox-host-and-guest-vms' rel='bookmark' title='Permanent Link: Setup SSH access between VirtualBox Host and Guest VMs'>Setup SSH access between VirtualBox Host and Guest VMs</a></li>
<li><a href='http://www.wiredrevolution.com/ubuntu/how-to-ssh-into-ubuntu-livecd' rel='bookmark' title='Permanent Link: How to SSH into Ubuntu LiveCD'>How to SSH into Ubuntu LiveCD</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/system-administration/find-your-ip-address-with-ifconfig/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display hostname and IP address in C</title>
		<link>http://www.wiredrevolution.com/c/display-hostname-and-ip-address-in-c?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=display-hostname-and-ip-address-in-c</link>
		<comments>http://www.wiredrevolution.com/c/display-hostname-and-ip-address-in-c#comments</comments>
		<pubDate>Sat, 18 Oct 2008 12:54:53 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[gethostbyname]]></category>
		<category><![CDATA[gethostname]]></category>
		<category><![CDATA[hostent]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[inet_ntoa]]></category>
		<category><![CDATA[IP address]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.wiredrevolution.com/?p=394</guid>
		<description><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/c_icon.png" width="80" height="80" alt="" title="C" /><br/>Here is a good way to determine the hostname and IP address of the local machine in C. You first have to grab the hostname with gethostname(). char hostbuf[256]; gethostname(hostbuf,sizeof(hostbuf)); Take the hostname and use it to grab the hostent struct with gethostbyname(). struct hostent *hostentry; hostentry = gethostbyname(hostbuf); Finally you have to take the [...]


Related posts<ol><li><a href='http://www.wiredrevolution.com/c/find-ip-address-from-remote-end-of-a-tcp-socket' rel='bookmark' title='Permanent Link: Find IP address from remote end of a TCP socket'>Find IP address from remote end of a TCP socket</a></li>
<li><a href='http://www.wiredrevolution.com/red-hat/change-hostname-on-redhat' rel='bookmark' title='Permanent Link: Change hostname on RedHat'>Change hostname on RedHat</a></li>
<li><a href='http://www.wiredrevolution.com/c/format-output-using-printf' rel='bookmark' title='Permanent Link: Format output using printf'>Format output using printf</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<img src="http://www.wiredrevolution.com/wp-content/uploads/c_icon.png" width="80" height="80" alt="" title="C" /><br/><p>Here is a good way to determine the hostname and IP address of the local machine in C.</p>
<p>You first have to grab the hostname with <strong>gethostname</strong>().</p>
<pre>
char hostbuf[256];
gethostname(hostbuf,sizeof(hostbuf));
</pre>
<p>Take the hostname and use it to grab the hostent struct with <strong>gethostbyname</strong>().</p>
<pre>
struct hostent *hostentry;
hostentry = gethostbyname(hostbuf);
</pre>
<p>Finally you have to take the hostent that is returned and pull out the IP address.  It is in network byte order, so you have to convert it to a string with <strong>inet_ntoa</strong>().</p>
<pre>
char * ipbuf;
ipbuf = inet_ntoa(*((struct in_addr *)hostentry->h_addr_list[0]));
</pre>
<p>Put all this together into a working programs.</p>
<pre>
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;errno.h&gt;
#include &lt;netdb.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;arpa/inet.h&gt;

int main()
{
        char hostbuf[256];
        char * ipbuf;
        struct hostent *hostentry;
        int ret;

        ret = gethostname(hostbuf,sizeof(hostbuf));

        if(-1 == ret){
                perror("gethostname");
                exit(1);
        }

        hostentry = gethostbyname(hostbuf);

        if(NULL == hostentry){
                perror("gethostbyname");
                exit(1);
        }

        ipbuf = inet_ntoa(*((struct in_addr *)hostentry->h_addr_list[0]));

        if(NULL == ipbuf){
                perror("inet_ntoa");
                exit(1);
        }

        printf("Hostname: %s Host IP: %s\n", hostbuf, ipbuf);

        return 0;
}
</pre>


<p>Related posts<ol><li><a href='http://www.wiredrevolution.com/c/find-ip-address-from-remote-end-of-a-tcp-socket' rel='bookmark' title='Permanent Link: Find IP address from remote end of a TCP socket'>Find IP address from remote end of a TCP socket</a></li>
<li><a href='http://www.wiredrevolution.com/red-hat/change-hostname-on-redhat' rel='bookmark' title='Permanent Link: Change hostname on RedHat'>Change hostname on RedHat</a></li>
<li><a href='http://www.wiredrevolution.com/c/format-output-using-printf' rel='bookmark' title='Permanent Link: Format output using printf'>Format output using printf</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.wiredrevolution.com/c/display-hostname-and-ip-address-in-c/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

