@xhivo97 said in Option to Hot Plug (some) Interfaces:
Hi,
Thank you for the reply.
I opened a feature request here.
I managed to make it work good enough so that I can use it. Have been reading the source code and managed to make some php scripts that do what I want.
This creates the interface:
Runs on boot-up and when the USB modem is plugged in (using devd).
<?php
require_once("config.inc");
require_once("interfaces.inc");
if (does_interface_exist(ue0)) {
if (!is_array($config['interfaces']['opt100'])) {
$config['interfaces']['opt100'] = array();
}
$config['interfaces']['opt100']['if'] = 'ue0';
$config['interfaces']['opt100']['enable'] = 'true';
$config['interfaces']['opt100']['descr'] = 'WAN2';
$config['interfaces']['opt100']['blockpriv'] = 'on';
$config['interfaces']['opt100']['blockbogons'] = 'on';
$config['interfaces']['opt100']['ipaddr'] = 'dhcp';
$config['interfaces']['opt100']['ipaddrv6'] = 'dhcp6';
$config['interfaces']['opt100']['dhcp6-ia-pd-len'] = '0';
print_r($config['interfaces']);
write_config($config);
}
sleep(2);
interface_dhcp_configure(ue0);
?>
This deletes the interface:
I included it in /etc/rc.bootup so that the interface gets deleted on boot.
<?php
require_once("config.inc");
if (isset($config['interfaces']['opt100'])) {
unset($config['interfaces']['opt100']);
print_r($config['interfaces']);
write_config($config);
}
?>
This script runs when the USB modem is plugged in and on boot:
#!/bin/sh
sleep 10
logger usb_modeswitch Changing Modem Mode
usb_modeswitch -v 0x12d1 -p 0x1f01 -c /usr/local/share/usb_modeswitch/12d1:1f01
sleep 5
php /path/to/create.php
I tested this and seems to work really good.
Do you mind to share what 4g mdem your using ??