<?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>Pario TechnoBlob &#187; ifconfig</title>
	<atom:link href="http://pario.no/tag/ifconfig/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 26 Apr 2012 08:18:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>IP address change notifier script</title>
		<link>http://pario.no/2009/01/21/ip-address-change-notifier-script/</link>
		<comments>http://pario.no/2009/01/21/ip-address-change-notifier-script/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 12:57:16 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Photo etc]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sed]]></category>

		<guid isPermaLink="false">http://pario.no/?p=922</guid>
		<description><![CDATA[This is a simple bash script that is run by crontab every 5 minutes on a linux box. It e-mails me the new address when a change of IP address is detected. The script (ipchangemail.sh) #!/bin/bash # Check if IP-address has changed. If a change has occured, mail me the new address # Add the [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple bash script that is run by crontab every 5 minutes on a linux box.<br />
It e-mails me the new address when a change of IP address is detected.</p>
<p>The script (ipchangemail.sh)</p>
<pre>
#!/bin/bash 

# Check if IP-address has changed. If a change has occured, mail me the new address
# Add the following line to crontab if you would like it to be run every 5 minutes:
# */5 * * * * ./ipchangemail.sh

# The network interface I want to monitor
NET_INTERFACE=eth0

# File to keep the latest IP address
IP_FILE=myip.txt

# Mail to this address when a change occur
MAILTO=mail@example.com

# Read the previous IP address from file
source $IP_FILE

CURRENT_IP=`/sbin/ifconfig $NET_INTERFACE | sed -n "/inet addr:.*255.255.25[0-5].[0-9]/{s/.*inet addr://; s/ .*//; p}"`

if [ "$CURRENT_IP" != "$OLD_IP" ]
then
        # Send email about address change
        `echo "New IP address detected: $CURRENT_IP" | mail -s "New IP address" $MAILTO`

        # Write new address to file
        `echo "OLD_IP=$CURRENT_IP" > $IP_FILE`
fi
</pre>
<p>The script can be downloaded <a href="http://pario.no/wp-content/uploads/2009/01/ipchangemail.sh">here</a>.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDEvMjEvaXAtYWRkcmVzcy1jaGFuZ2Utbm90aWZpZXItc2NyaXB0Lzx3cHRiPklQIGFkZHJlc3MgY2hhbmdlIG5vdGlmaWVyIHNjcmlwdDx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/01/21/ip-address-change-notifier-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create virtual / alias IP address</title>
		<link>http://pario.no/2007/11/30/create-virtual-alias-ip-address/</link>
		<comments>http://pario.no/2007/11/30/create-virtual-alias-ip-address/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 10:12:09 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[arprelease]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[ifup]]></category>
		<category><![CDATA[ping]]></category>

		<guid isPermaLink="false">http://pario.no/2007/11/30/create-virtualalias-ip-address/</guid>
		<description><![CDATA[This is the code to make an alias IP address on network interface ethX where X is a number to indicate the device we are attaching the IP. ifconfig eth0:1 192.168.0.30 netmask 255.255.255.0 up Your machine will now answer on ping requests 192.168.0.30. You can see the result by running the command ifconfig eth0:1 Result [...]]]></description>
			<content:encoded><![CDATA[<p>This is the code to make an alias IP address on network interface ethX where X is a number to indicate the device we are attaching the IP.<br />
<code>ifconfig eth0:1 192.168.0.30 netmask 255.255.255.0 up</code><br />
Your machine will now answer on ping requests 192.168.0.30.</p>
<p>You can see the result by running the command<br />
<code><br />
ifconfig eth0:1</code><br />
Result</p>
<pre>
eth0:1    Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:192.168.0.30  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:17 Base address:0x1080</pre>
<p>To take down this alias use<br />
<code><br />
ifup eth0:1 down</code></p>
<p>You might experience that the new device/address won&#8217;t answer network requests to the IP address after moving it. This happens because the arp cache on the router most likely haven&#8217;t discovered that the IP address is on a new MAC address. A solution to this problem is to clear the arp info on the router using the arprelease command<br />
<code><br />
arprelease eth0:1 192.168.0.30</code><br />
This command can be downloaded from <a href="http://sourceforge.net/projects/arprelease/">http://sourceforge.net/projects/arprelease/</a> if it isn&#8217;t available on your linux distribution.</p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/sourceforge.net\/projects\/arprelease\/"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMTEvMzAvY3JlYXRlLXZpcnR1YWwtYWxpYXMtaXAtYWRkcmVzcy88d3B0Yj5DcmVhdGUgdmlydHVhbCAvIGFsaWFzIElQIGFkZHJlc3M8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/11/30/create-virtual-alias-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get your IP address</title>
		<link>http://pario.no/2007/05/20/get-your-ip-address/</link>
		<comments>http://pario.no/2007/05/20/get-your-ip-address/#comments</comments>
		<pubDate>Sun, 20 May 2007 19:10:34 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[ifconfig]]></category>

		<guid isPermaLink="false">http://hhj.no/wordpress/2007/05/20/get-your-ip-address/</guid>
		<description><![CDATA[ifconfig eth0 &#124; awk '/inet addr/{print $2}' &#124; cut -d: -f2]]></description>
			<content:encoded><![CDATA[<pre>
ifconfig eth0 | awk '/inet addr/{print $2}' | cut -d: -f2</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDcvMDUvMjAvZ2V0LXlvdXItaXAtYWRkcmVzcy88d3B0Yj5HZXQgeW91ciBJUCBhZGRyZXNzPHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2007/05/20/get-your-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

