Основной ip добавляется так:
$s .= "config_eth0=( \"$ip netmask $mask\" )\n";
$s .= "routes_eth0=( \n";
$s .= " \"$gw via $ip\"\n";
$s .= " \"default via $gw\"\n";
$s .= " )\n";
т.е. например :
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
routes_eth0=( "default gw 192.168.0.1" )