Menu="NetworkSettings:100" Title="_(Interface)_ eth0" Tag="icon-ethernet" --- '8', '255.255.0.0' => '16', '255.255.128.0' => '17', '255.255.192.0' => '18', '255.255.224.0' => '19', '255.255.240.0' => '20', '255.255.248.0' => '21', '255.255.252.0' => '22', '255.255.254.0' => '23', '255.255.255.0' => '24', '255.255.255.128' => '25', '255.255.255.192' => '26', '255.255.255.224' => '27', '255.255.255.240' => '28', '255.255.255.248' => '29', '255.255.255.252' => '30' ]; // get available ethernet ports (excluding eth0) exec("ls --indicator-style=none /sys/class/net|grep -P '^eth[1-9][0-9]*$'",$ports); function locked($source,$port) { global $members; foreach ($members as $member => $value) { if ($member == $source) continue; if ($value['BONDING']=='yes' && in_array($port,explode(',',$value['BONDNICS']))) return $value['BONDNAME'].' '.$member; if ($value['BRIDGING']=='yes' && in_array($port,explode(',',$value['BRNICS']))) return $value['BRNAME'].' '.$member; } return false; } function vlanID($cfg) { return array_filter($cfg,function($key){return strpos($key,'VLANID:')===0;},ARRAY_FILTER_USE_KEY); } function index($key) { return filter_var($key,FILTER_SANITIZE_NUMBER_INT); } // remove non-existing ethernet ports foreach (glob("$docroot/webGui/Eth[1-9]*.page",GLOB_NOSORT) as $port) { if (!in_array(strtolower(basename($port,'.page')), $ports)) { @unlink($port); $build = true; } } // add new ethernet ports foreach ($ports as $ethX) { $file = "$docroot/webGui/".ucfirst($ethX).".page"; if (!file_exists($file)) { $X = filter_var($ethX,FILTER_SANITIZE_NUMBER_INT); file_put_contents($file,str_replace(['parentname:nnn','tabX','bondX','brX','ethX'],['NetworkSettings:'.($X+100),'tab'.($X+1),'bond'.$X,'br'.$X,$ethX],file_get_contents($template))); $build = true; } } // enable interface only when VMs and Docker are stopped $service = exec('pgrep --ns $$ libvirt') ? _('VM manager') : ''; $service .= exec('pgrep --ns $$ docker') ? ($service ? ' '._('and').' ' : '')._('Docker service') : ''; // eth0 port status $no_eth0 = exec("ip link show eth0|grep -Pom1 '(NO-CARRIER|state DOWN)'"); // get VLAN interfaces $vlan_eth0 = $sort_eth0 = []; if (isset($eth0)) foreach (vlanID($eth0) as $key => $val) {$vlan_eth0[] = index($key); $sort_eth0[] = (int)$val;} array_multisort($sort_eth0,$vlan_eth0); ?>
 
_(IPv4 DNS server assignment)_: : :eth_ipv4_dns_server_assignment_help:
_(IPv4 DNS server)_ 1: : :eth_ipv4_dns_server_help: _(IPv4 DNS server)_ 2: : :eth_ipv4_dns_server2_help: _(IPv4 DNS server)_ 3: : :eth_ipv4_dns_server3_help:
_(IPv6 DNS server assignment)_: : :eth_ipv6_dns_server_assignment_help:
_(IPv6 DNS server)_ 1: : :eth_ipv6_dns_server_help: _(IPv6 DNS server)_ 2: : :eth_ipv6_dns_server2_help: _(IPv6 DNS server)_ 3: : :eth_ipv6_dns_server3_help:
_(Interface description)_: : "> :eth_interface_description_help: _(MAC address)_: : :eth_mac_address_help: _(Enable bonding)_: : :eth_enable_bonding_help:
_(Bonding mode)_: : **_(Attention)_:** _(this mode requires a network switch with proper setup and support)_... :eth_bonding_mode_help: _(Bonding members of)_ bond0: : :eth_bonding_members_help:
_(Enable bridging)_: : :eth_enable_bridging_help:
_(Bridging members of)_ br0: : :eth_bridging_members_help:
_(Network protocol)_: : :eth_network_protocol_help:
_(IPv4 address assignment)_: : :eth_ipv4_address_assignment_help:
_(IPv4 address)_: : " class="narrow" pattern="" title="_(IPv4 address A.B.C.D)_">/ :eth_ipv4_address_help: _(IPv4 default gateway)_: : " class="narrow" pattern="" title="_(IPv4 address A.B.C.D)_"> " class="slim"> *_(optional metric (lowest is preferred, 0 is no default gateway))_* :eth_ipv4_default_gateway_help:
_(IPv6 address assignment)_: : :eth_ipv6_address_assignment_help:
_(IPv6 address)_: : " pattern="" title="_(IPv6 address nnnn:xxxx::yyyy)_">/" class="slim"> :eth_ipv6_address_help: _(IPv6 default gateway)_: : " pattern="" title="_(IPv6 address nnnn:xxxx::yyyy)_"> " class="slim"> *_(optional metric (lowest is preferred, 0 is no default gateway))_* :eth_ipv6_default_gateway_help:
_(IPv6 privacy extensions)_: : :eth_ipv6_privacy_extensions_help:
_(Desired MTU)_: : :eth_desired_mtu_help: _(Enable VLANs)_: : :eth_enable_vlans_help:
_(Interface description)_: : "> )"> :eth_interface_description_help: _(VLAN number)_: : " class="narrow gap" required> :eth_vlan_number_help: _(Network protocol)_: : :eth_network_protocol_help:
_(IPv4 address assignment)_: : :eth_ipv4_address_assignment_help:
_(IPv4 address)_: : " class="narrow" pattern="" title="_(IPv4 address A.B.C.D)_">/ :eth_ipv4_address_help: _(IPv4 default gateway)_: : " class="narrow" pattern="" title="_(IPv4 address A.B.C.D)_"> " class="slim"> *_(optional metric (lowest is preferred, 0 is no default gateway))_* :eth_ipv4_default_gateway_help:
_(IPv6 address assignment)_: : :eth_ipv6_address_assignment_help:
_(IPv6 address)_: : " pattern="" title="_(IPv6 address nnnn:xxxx::yyyy)_">/" class="slim"> :eth_ipv6_address_help: _(IPv6 default gateway)_: : " pattern="" title="_(IPv6 address nnnn:xxxx::yyyy)_"> " class="slim"> *_(optional metric (lowest is preferred, 0 is no default gateway))_* :eth_ipv6_default_gateway_help:
_(IPv6 privacy extensions)_: : :eth_ipv6_privacy_extensions_help:
  : '._('Settings').')'?>