[clug] /etc/network/interfaces

Tony Breeds tony at bakeyournoodle.com
Tue Nov 27 04:35:56 GMT 2007

On Tue, Nov 27, 2007 at 03:06:16PM +1100, Andrew Janke wrote:

> Hrm..  I suspect I will have to write something.  I essentially want
> to turn this:


> and of course make the required changes in /etc/resolv/conf.

Well if you use the resolvconf package, then is can be done from the
interfaces file.

Hmm actually assuming you have resolvconf installed the something like:


/bin/echo -ne "auto ${INTERFACE}\n"
/bin/echo -ne "iface ${INTERFACE} inet static\n"
/sbin/ifconfig ${INTERFACE} | /bin/egrep 'inet addr' |	\
	/bin/sed -e 's,^ *inet addr:,\taddress ,'	\
	         -e 's,Bcast:,\n\tbroadcast ,'		\
		 -e 's,Mask:,\n\tnetmask ,'
/sbin/route -n | /usr/bin/awk '/^ {print "\tgateway",$2}'
/bin/egrep -v '^#' /etc/resolv.conf | /bin/sed -e 's,^,\tdns-,'

Will do most of what you want.

Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

More information about the linux mailing list