BEGIN {FS = " ";print "# This file is generated by RLM upon request from Ontap." > tmp_if_file; \
	print "# Do NOT modify this file manually." >> tmp_if_file; \
	print "auto lo" >> tmp_if_file; \
	print "iface lo inet loopback" >> tmp_if_file; }

###### dhcp information ######
/^dhcp/ { if ($2 == 1) 		
		print "auto eth0\niface eth0 inet dhcp" >> tmp_if_file 
	}

###### ipv4 information ######
/^ip / {if ((dhcp_enabled == 0) && (ipv4_enabled == 1))
	{
		print "auto eth0" >> tmp_if_file; 
		print "iface eth0 inet static" >> tmp_if_file; 
		print "   address " $2 >> tmp_if_file
	}
      }
/^netmask/ {if ((dhcp_enabled == 0) && (ipv4_enabled == 1))
	print "   netmask " $2 >> tmp_if_file;}
/^gateway/ {if ((dhcp_enabled == 0) && (ipv4_enabled == 1))
	print "   gateway " $2 >> tmp_if_file;}

###### ipv6 information ######
/^ip6_addr/ {if (($2 != "") && (ipv6_enabled == 1))
	{print "iface eth0 inet6 static" >> tmp_if_file; 
	print "   address " $2 >> tmp_if_file; }}
/^ip6_prefix/ {if (($2 != "") && (ipv6_enabled == 1) && (ipv6_global_present == 1))
	print "   netmask " $2 >> tmp_if_file;}
/^ip6_gate/ {if (($2 != "") && (ipv6_enabled == 1) && (ipv6_global_present == 1))
	print "   gateway " $2 >> tmp_if_file;}

