mirror of
https://github.com/unraid/webgui.git
synced 2026-01-24 10:28:39 -06:00
539 lines
23 KiB
Plaintext
539 lines
23 KiB
Plaintext
Menu="NetworkSettings"
|
|
Title="Interface eth0"
|
|
Png="ethernet.png"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2005-2016, Lime Technology
|
|
* Copyright 2012-2016, Bergware International.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<?
|
|
$build = false;
|
|
$template = '/usr/local/emhttp/webGui/EthX.page';
|
|
$ini = '/var/local/emhttp/network.ini';
|
|
$validIP = '((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
|
|
|
|
// get available ethernet ports (excluding eth0)
|
|
exec("ip -br addr|grep -Po '^eth[1-9]+\s'",$ports);
|
|
$ports = array_map('trim', $ports);
|
|
|
|
// remove non-existing ethernet ports
|
|
foreach (glob('/usr/local/emhttp/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 $port) {
|
|
$file = "/usr/local/emhttp/webGui/".ucfirst($port).".page";
|
|
if (!file_exists($file)) {
|
|
copy($template, $file);
|
|
exec("sed -i 's/x-settings/NetworkSettings/;s/ethX/$port/g' $file");
|
|
$build = true;
|
|
}
|
|
}
|
|
// enable interface only when VMs and Docker are stopped
|
|
$service = exec("pgrep libvirt") ? 'VMs' : '';
|
|
$service .= exec("pgrep docker") ? ($service ? ' and ' : '').'Docker' : '';
|
|
|
|
// eth0 port status
|
|
$no_eth0 = exec("ip link show eth0|grep -Pom1 '(NO-CARRIER|state DOWN)'");
|
|
|
|
// get VLAN interfaces
|
|
$vlan_eth0 = [0];
|
|
if (isset($eth0)) foreach ($eth0 as $key => $val) if (substr($key,0,6)=='VLANID') $vlan_eth0[] = substr($key,7);
|
|
?>
|
|
<style>
|
|
span.pin i{font-size:16px;cursor:pointer;}
|
|
span.red{color:#E68A00;}
|
|
span.blue{color:#00529B;}
|
|
span.green{color:#4F8A10;}
|
|
div.shade-white{background-color:#F8F8F8;}
|
|
div.shade-black{background-color:#0C0C0C;}
|
|
</style>
|
|
<script>
|
|
<?if ($build):?>
|
|
refresh(); // automatically include new ethernet ports
|
|
<?endif;?>
|
|
Array.prototype.dups = function(){return this.sort().filter(function(v,i,o){return i&&v===o[i-1]?v:0;}).length;}
|
|
|
|
function prepareSettings(form) {
|
|
if (form.BONDING !== undefined) {
|
|
var member = '';
|
|
for (var i=0,item; item=form.BONDNICS.options[i]; i++) {
|
|
if (item.selected) {
|
|
if (member.length) member += ',';
|
|
member += item.value;
|
|
item.selected = false;
|
|
}
|
|
}
|
|
item = form.BONDNICS.options[0];
|
|
item.value = member;
|
|
item.selected = true;
|
|
item.disabled = false;
|
|
var member = '';
|
|
for (var i=0,item; item=form.BRNICS.options[i]; i++) {
|
|
if (item.selected) {
|
|
if (member.length) member += ',';
|
|
member += item.value;
|
|
item.selected = false;
|
|
}
|
|
}
|
|
item = form.BRNICS.options[0];
|
|
item.value = form.BONDING.value=='yes' ? form.BONDNAME.value : member;
|
|
item.selected = true;
|
|
item.disabled = false;
|
|
if (member.indexOf(',')>0) form.BRSTP.value = 'yes';
|
|
}
|
|
if (form.DHCP_KEEPRESOLV !== undefined) form.DHCP_KEEPRESOLV.disabled = false;
|
|
if (form.TYPE.value == 'access') {
|
|
$(form).find('input[name^="VLANID:"]').prop('disabled',true);
|
|
$(form).find('input[name^="DESCRIPTION:"]').not('input[name$=":0"]').prop('disabled',true);
|
|
$(form).find('select[name^="USE_DHCP:"]').not('select[name$=":0"]').prop('disabled',true);
|
|
$(form).find('input[name^="IPADDR:"]').not('input[name$=":0"]').prop('disabled',true);
|
|
$(form).find('select[name^="NETMASK:"]').not('select[name$=":0"]').prop('disabled',true);
|
|
} else {
|
|
var vlans = [];
|
|
$(form).find('input[name^="VLANID:"]').each(function(){vlans.push($(this).val());});
|
|
if (vlans.dups()) {
|
|
swal('VLAN mismatch','List contains duplicate VLAN numbers','error');
|
|
return false;
|
|
}
|
|
}
|
|
$(form).find('select[name^="USE_DHCP:"]').each(function() {
|
|
if ($(this).prop('disabled')==false && $(this).val()=='yes') {
|
|
var ipaddr = $(this).prop('name').replace('USE_DHCP','IPADDR');
|
|
$(form).find('input[name="'+ipaddr+'"]').val('Obtaining IP address...');
|
|
}
|
|
});
|
|
if ($(form).find('select[name="DHCP_KEEPRESOLV"]').val()=='no') {
|
|
$(form).find('input[name^="DNS_SERVER"]').val('Obtaining DNS server...');
|
|
}
|
|
form.BRNAME.value = 'br'+$(form).find('input[name="#section"]').val().substr(3);
|
|
return true;
|
|
}
|
|
function checkNetworkSettings(form,index) {
|
|
var dns = form.DHCP_KEEPRESOLV !== undefined;
|
|
if (index == null) {
|
|
$(form).find('select[name^="USE_DHCP:"]').each(function() {
|
|
var i = $(this).attr('name').substr(9);
|
|
var disabled = $(this).val()!='no';
|
|
var ipaddr = $(form).find('input[name="IPADDR:'+i+'"]');
|
|
var netmask = $(form).find('select[name="NETMASK:'+i+'"]');
|
|
ipaddr.prop('disabled',disabled).prop('required',!disabled);
|
|
netmask.prop('disabled',disabled);
|
|
if (ipaddr.val()=='') netmask.append('<option value="none" selected="selected"></option>');
|
|
if (i==0 && form.GATEWAY !== undefined) {form.GATEWAY.disabled = disabled; form.GATEWAY.required = !disabled;}
|
|
if (dns) form.DHCP_KEEPRESOLV.disabled = !disabled;
|
|
});
|
|
} else {
|
|
var disabled = $(form).find('select[name="USE_DHCP:'+index+'"]').val()!='no';
|
|
$(form).find('input[name="IPADDR:'+index+'"]').prop('disabled',disabled).prop('required',!disabled);
|
|
var netmask = $(form).find('select[name="NETMASK:'+index+'"]');
|
|
netmask.prop('disabled',disabled);
|
|
if (!disabled) {
|
|
var none = netmask.find('option[value="none"]');
|
|
if (none.length) {netmask.val('255.255.255.0'); none.remove();}
|
|
}
|
|
if (form.GATEWAY !== undefined) {form.GATEWAY.disabled = disabled; form.GATEWAY.required = !disabled;}
|
|
if (dns) {
|
|
form.DHCP_KEEPRESOLV.value = 'yes';
|
|
form.DHCP_KEEPRESOLV.disabled = !disabled;
|
|
checkDNSSettings(form);
|
|
}
|
|
}
|
|
}
|
|
function checkDNSSettings(form) {
|
|
var disabled = form.DHCP_KEEPRESOLV.value=='no';
|
|
form.DNS_SERVER1.disabled = disabled;
|
|
form.DNS_SERVER1.required = !disabled;
|
|
form.DNS_SERVER2.disabled = disabled;
|
|
form.DNS_SERVER3.disabled = disabled;
|
|
if (!form.DNS_SERVER2.value && disabled) $('#dnsserver2').hide(); else $('#dnsserver2').show();
|
|
if (!form.DNS_SERVER3.value && disabled) $('#dnsserver3').hide(); else $('#dnsserver3').show();
|
|
}
|
|
function checkBondingSettings(form,ctrl) {
|
|
var disabled = form.BONDING.value=='no';
|
|
var mode = form.BONDING_MODE.value;
|
|
if (ctrl>=0) {
|
|
var me = ctrl==0 ? null : 'slow';
|
|
if (disabled) {
|
|
$('#bond-members').hide(me);
|
|
} else {
|
|
$('#bond-members').show(me);
|
|
$('#bond0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
|
|
}
|
|
if (ctrl==1) checkBridgingSettings(form,1);
|
|
}
|
|
if (mode==1 || mode>4 || disabled) {$('#attention0').hide();} else {$('#attention0').show();}
|
|
}
|
|
function checkBridgingSettings(form,ctrl) {
|
|
var me = ctrl==0 ? null : 'slow';
|
|
if (form.BRIDGING.value=='yes' && form.BONDING.value=='no') {
|
|
$('#bridge-members').show(me);
|
|
$('#bridge0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
|
|
} else {
|
|
$('#bridge-members').hide(me);
|
|
}
|
|
}
|
|
function checkNetworkAccess(form,port) {
|
|
if (form.TYPE.value=='access') {
|
|
$('.access-'+port).hide();
|
|
$(form).find('input[name^="VLANID:"]').prop('required',false);
|
|
} else {
|
|
$('.access-'+port).show();
|
|
$(form).find('input[name^="VLANID:"]').prop('required',true);
|
|
}
|
|
}
|
|
function addVLAN(port,disabled) {
|
|
if (disabled) return;
|
|
var index = 1;
|
|
while ($('#index-'+port+'-'+index).length) index++;
|
|
var template = $($('<div/>').loadTemplate($('#network-template-'+port)).html().replace(/INDEX/g,index));
|
|
var element = $('[id^="index-'+port+'-"]').last();
|
|
$(element).after(template);
|
|
checkNetworkSettings($('form[name="'+$(element).parent().attr('name')+'"]'));
|
|
$(element).find('input').first().trigger('change');
|
|
}
|
|
function removeVLAN(element,disabled) {
|
|
if (disabled) return;
|
|
var id = $(element).attr('id').split('-');
|
|
$(element).remove();
|
|
$('#index-'+id[1]+'-0').find('select').first().trigger('change');
|
|
}
|
|
function disableForm(form,member) {
|
|
$(form).find('input,select').not('input[value="Done"]').prop('disabled',true);
|
|
if (member) $(form).find('input[name^="DESCRIPTION"],input[name^="#"]').prop('disabled',false);
|
|
}
|
|
var stopEvent = false;
|
|
function exitCode(form,key) {
|
|
if (stopEvent) {stopEvent = false; return;}
|
|
var arg1 = $(form).find('input[name="#arg[1]"]');
|
|
if (!key) {
|
|
arg1.val($(form).find('input[name="#section"]').val());
|
|
} else {
|
|
if (arg1.val()=='') arg1.val('none');
|
|
stopEvent = true;
|
|
}
|
|
}
|
|
function portcheck_eth0() {
|
|
$.post('/webGui/include/CheckPort.php',{port:'eth0'},function(text) {
|
|
var html = $('#user-notice').html();
|
|
if (!html || html.indexOf('eth0')>0) showNotice(text);
|
|
setTimeout(portcheck_eth0,10000);
|
|
});
|
|
}
|
|
function portToggle(port,cmd) {
|
|
$.post('/webGui/include/PortToggle.php',{port:port,cmd:cmd},function(){refresh();});
|
|
}
|
|
$(function() {
|
|
var ctrl = "<span id='wait_eth0' class='status red' style='display:none;font-size:small;font-style:italic'>Please wait... configuring interfaces</span>";
|
|
var form = document.eth0_settings;
|
|
<?if ($tabbed && !$service):?>
|
|
$('#tab1').bind({click:function(){
|
|
$('#bond0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
|
|
$('#bridge0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:131});
|
|
}});
|
|
<?endif;?>
|
|
$('#bond0').dropdownchecklist({emptyText:'None', width:131});
|
|
$('#bridge0').dropdownchecklist({emptyText:'None', width:131});
|
|
checkBondingSettings(form,0);
|
|
checkBridgingSettings(form,0);
|
|
checkNetworkAccess(form,'eth0');
|
|
checkNetworkSettings(form);
|
|
<?if ($service):?>
|
|
disableForm(form);
|
|
$('#bond0').dropdownchecklist('disable');
|
|
$('#bridge0').dropdownchecklist('disable');
|
|
<?else:?>
|
|
checkDNSSettings(form);
|
|
<?endif;?>
|
|
<?if ($tabbed):?>
|
|
$('.tabs').append(ctrl);
|
|
<?else:?>
|
|
$('div[id=title]').append(ctrl);
|
|
<?endif;?>
|
|
portcheck_eth0();
|
|
});
|
|
</script>
|
|
<form markdown="1" name="eth0_settings" method="POST" action="/update.php" target="progressFrame" onchange="exitCode(this,false)" onsubmit="return prepareSettings(this)">
|
|
<input type="hidden" name="#file" value="<?=$ini?>">
|
|
<input type="hidden" name="#include" value="/webGui/include/update.ethernet.php">
|
|
<input type="hidden" name="#section" value="eth0">
|
|
<input type="hidden" name="#command" value="/webGui/scripts/netconfig">
|
|
<input type="hidden" name="#arg[1]" value="">
|
|
<input type="hidden" name="BONDNAME" value="bond0">
|
|
<input type="hidden" name="BONDING_MIIMON" value="100">
|
|
<input type="hidden" name="BRNAME" value="">
|
|
<input type="hidden" name="BRSTP" value="no">
|
|
<input type="hidden" name="BRFD" value="0">
|
|
<?foreach ($vlan_eth0 as $i):?>
|
|
<div id="index-eth0-<?=$i?>" markdown="1">
|
|
<?if ($i==0):?>
|
|
MAC address:
|
|
: <?=strtoupper(exec("ip link show eth0|grep -Pom1 'ether \K\S+'"))?>
|
|
|
|
> This is the hardware address of the interface.
|
|
> When tagging is enabled all VLANs on this interface will share the same hardware address.
|
|
|
|
Enable bonding:
|
|
: <select name="BONDING" size="1" onchange="checkBondingSettings(this.form,1)">
|
|
<?=mk_option($eth0['BONDING'], "no", "No");?>
|
|
<?=mk_option($eth0['BONDING'], "yes", "Yes");?>
|
|
</select>
|
|
|
|
> Bonding is a feature that combines multiple physical Ethernet interfaces into a single *bonded* interface named **bond0**.
|
|
> This can be used to improve the connection redundancy and/or throughput of the system.
|
|
> Different bonding modes are supported (see below), but some modes require proper switch support.
|
|
|
|
<div id="bond-members" style="display:none" markdown="1">
|
|
Bonding mode:
|
|
: <select name="BONDING_MODE" size="1" onchange="checkBondingSettings(this.form,-1)">
|
|
<?=mk_option($eth0['BONDING_MODE'], "0", "balance-rr (0)");?>
|
|
<?=mk_option($eth0['BONDING_MODE'], "1", "active-backup (1)",isset($eth0['BONDING_MODE'])?'':'selected');?>
|
|
<?=mk_option($eth0['BONDING_MODE'], "2", "balance-xor (2)");?>
|
|
<?=mk_option($eth0['BONDING_MODE'], "3", "broadcast (3)");?>
|
|
<?=mk_option($eth0['BONDING_MODE'], "4", "802.3ad (4)");?>
|
|
<?=mk_option($eth0['BONDING_MODE'], "5", "balance-tlb (5)");?>
|
|
<?=mk_option($eth0['BONDING_MODE'], "6", "balance-alb (6)");?>
|
|
</select>
|
|
<span id="attention0" style="display:none"><b>Attention:</b> this mode requires a network switch with proper setup and support...</span>
|
|
|
|
> Mode 1 (active-backup) is the recommended default. Other modes allow you to set up a specific environment, but may require proper switch support.
|
|
> Choosing a unsupported mode can result in a disrupted communication. Use with caution.
|
|
|
|
Bonding members:
|
|
: <select id="bond0" name="BONDNICS" size="1" multiple="multiple" style="display:none">
|
|
<?=mk_option($eth0['BONDNICS'],'eth0','eth0','selected disabled')?>
|
|
<?foreach ($ports as $port):?>
|
|
<?=mk_option_check($eth0['BONDNICS'],$port,$port)?>
|
|
<?endforeach;?>
|
|
</select>
|
|
|
|
> Select which interfaces are member of the *bonded* interface. By default eth0 is a member, while other interfaces are optional.
|
|
|
|
</div>
|
|
Enable bridging:
|
|
: <select name="BRIDGING" size="1" onchange="checkBridgingSettings(this.form,1)">
|
|
<?=mk_option($eth0['BRIDGING'], "no", "No");?>
|
|
<?=mk_option($eth0['BRIDGING'], "yes", "Yes");?>
|
|
</select>
|
|
|
|
> Bridging is a feature which creates a virtual bridge and allows VMs to communicate directly with the physical Ethernet port.
|
|
> Both bonding and bridging can be combined to let VMs communicate over a *bonded* interface.
|
|
|
|
<div id="bridge-members" style="display:none" markdown="1">
|
|
Bridging members:
|
|
: <select id="bridge0" name="BRNICS" size="1" multiple="multiple" style="display:none">
|
|
<?=mk_option($eth0['BRNICS'],'eth0','eth0','selected disabled')?>
|
|
<?foreach ($ports as $port):?>
|
|
<?=mk_option_check($eth0['BRNICS'],$port,$port)?>
|
|
<?endforeach;?>
|
|
</select>
|
|
|
|
> Select which interfaces are member of the *bridged* interface. By default eth0 is a member, while other interfaces are optional.
|
|
|
|
</div>
|
|
Interface description:
|
|
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="40" value="<?=$eth0["DESCRIPTION:$i"]?>" onchange="exitCode(this.form,true)">
|
|
|
|
> Use this optional field to provide addditional information about the purpose of the connection.
|
|
|
|
IP address assignment:
|
|
: <select name="USE_DHCP:<?=$i?>" size="1" onchange="checkNetworkSettings(this.form,<?=$i?>)">
|
|
<?=mk_option($eth0["USE_DHCP:$i"], 'yes', 'Automatic');?>
|
|
<?=mk_option($eth0["USE_DHCP:$i"], 'no', 'Static');?>
|
|
</select>
|
|
|
|
> The following settings are possible:
|
|
>
|
|
> *Automatic* - the server will attempt to obtain its IP address from the local DHCP server<br>
|
|
> *Static* - the IP address is manually set for this interface<br>
|
|
> *None* - no IP address is assigned to the interface (only available for VLANs)
|
|
|
|
IP address:
|
|
: <input type="text" name="IPADDR:<?=$i?>" maxlength="40" value="<?=$eth0["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP?>" title="IP address A.B.C.D">
|
|
|
|
> Greyed out when using DHCP server. Otherwise specify here the IP address of the system.
|
|
|
|
Network mask:
|
|
: <select name="NETMASK:<?=$i?>" size="1">
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.0.0", "255.255.0.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.252.0", "255.255.252.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.254.0", "255.255.254.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.0", "255.255.255.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.128", "255.255.255.128");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.192", "255.255.255.192");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.224", "255.255.255.224");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.240", "255.255.255.240");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.248", "255.255.255.248");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.252", "255.255.255.252");?>
|
|
</select>
|
|
|
|
> Greyed out when using DHCP server. Otherwise specify here the associated network mask, by default 255.255.255.0 is selected.
|
|
|
|
Default gateway:
|
|
: <input type="text" name="GATEWAY" maxlength="40" value="<?=$eth0['GATEWAY']?>" class="narrow" pattern="<?=$validIP?>" title="IP address A.B.C.D">
|
|
|
|
> Greyed out when using DHCP server. Otherwise specify here the IP address of your router.
|
|
|
|
DNS server assignment:
|
|
: <select name="DHCP_KEEPRESOLV" size="1" onchange="checkDNSSettings(this.form)">
|
|
<?=mk_option($eth0['DHCP_KEEPRESOLV'], "no", "Automatic");?>
|
|
<?=mk_option($eth0['DHCP_KEEPRESOLV'], "yes", "Static");?>
|
|
</select>
|
|
|
|
> If set to *Automatic* the server will use DNS server IP address returned by the local DHCP server.<br>
|
|
> If set to *Static* you may enter your own list.
|
|
>
|
|
> This is useful in Active Directory configurations where you need to set the first DNS Server entry to the IP address of your AD Domain server.
|
|
|
|
DNS server:
|
|
: <input type="text" name="DNS_SERVER1" maxlength="80" value="<?=$eth0['DNS_SERVER1'];?>" class="narrow" pattern="<?=$validIP?>" title="IP address A.B.C.D">
|
|
|
|
> This is the primary DNS server to use. Enter a FQDN or an IP address.
|
|
>
|
|
> Note: for *Active Directory* you **must** ensure this is set to the IP address of your AD Domain server.
|
|
|
|
<div id="dnsserver2" style="display:none" markdown="1">
|
|
DNS server 2:
|
|
: <input type="text" name="DNS_SERVER2" maxlength="80" value="<?=$eth0['DNS_SERVER2'];?>" class="narrow" pattern="<?=$validIP?>" title="IP address A.B.C.D">
|
|
|
|
> This is the DNS server to use when DNS Server 1 is down.
|
|
|
|
</div>
|
|
<div id="dnsserver3" style="display:none" markdown="1">
|
|
DNS server 3:
|
|
: <input type="text" name="DNS_SERVER3" maxlength="80" value="<?=$eth0['DNS_SERVER3'];?>" class="narrow" pattern="<?=$validIP?>" title="IP address A.B.C.D">
|
|
|
|
> This is the DNS server to use when DNS Servers 1 and 2 are both down.
|
|
|
|
</div>
|
|
Desired MTU:
|
|
: <input type="number" name="MTU" min="68" max="9198" value="<?=$eth0['MTU']?>" class="narrow">
|
|
|
|
> This is the MTU size to use on the physical Ethernet interface.
|
|
> If left blank, the MTU will automatically be determined (by default 1500 bytes).
|
|
|
|
Enable VLANs:
|
|
: <select name="TYPE" size="1" onchange="checkNetworkAccess(this.form,'eth0')">
|
|
<?=mk_option($eth0['TYPE'], 'access', 'No');?>
|
|
<?=mk_option($eth0['TYPE'], 'trunk', 'Yes');?>
|
|
</select>
|
|
<span class="access-eth0 pin" title="Add VLAN" style="display:none" onclick="addVLAN('eth0',<?=$service?'true':'false'?>)"><i class="fa fa-plus-circle green"></i><em>press to add VLAN</em></span>
|
|
<?else:?>
|
|
<div class="access-eth0 shade-<?=$display['theme']?>" style="display:none" markdown="1">
|
|
VLAN number:
|
|
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=$eth0["VLANID:$i"]?>" class="narrow" required>
|
|
<span class="pin" title="Remove VLAN" onclick="removeVLAN($('#index-eth0-<?=$i?>'),<?=$service?'true':'false'?>)"><i class="fa fa-minus-circle red"></i><em>press to remove VLAN</em></span>
|
|
|
|
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
|
|
|
|
Interface description:
|
|
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="40" value="<?=$eth0["DESCRIPTION:$i"]?>" onchange="exitCode(this.form,true)">
|
|
|
|
> Use this optional field to provide addditional information about the purpose of the connection.
|
|
|
|
IP address assignment:
|
|
: <select name="USE_DHCP:<?=$i?>" size="1" onchange="checkNetworkSettings(this.form,<?=$i?>)">
|
|
<?=mk_option($eth0["USE_DHCP:$i"], 'yes', 'Automatic');?>
|
|
<?=mk_option($eth0["USE_DHCP:$i"], 'no', 'Static');?>
|
|
<?if ($i>0):?>
|
|
<?=mk_option($eth0["USE_DHCP:$i"], '', 'None');?>
|
|
<?endif;?>
|
|
</select>
|
|
|
|
> The following settings are possible:
|
|
>
|
|
> *Automatic* - the server will attempt to obtain its IP address from the local DHCP server<br>
|
|
> *Static* - the IP address is manually set for this interface<br>
|
|
> *None* - no IP address is assigned to the interface (only available for VLANs)
|
|
|
|
IP address:
|
|
: <input type="text" name="IPADDR:<?=$i?>" maxlength="40" value="<?=$eth0["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP?>" title="IP address A.B.C.D">
|
|
|
|
> Greyed out when using DHCP server. Otherwise specify here the IP address of the system.
|
|
|
|
Network mask:
|
|
: <select name="NETMASK:<?=$i?>" size="1">
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.0.0", "255.255.0.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.252.0", "255.255.252.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.254.0", "255.255.254.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.0", "255.255.255.0");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.128", "255.255.255.128");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.192", "255.255.255.192");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.224", "255.255.255.224");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.240", "255.255.255.240");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.248", "255.255.255.248");?>
|
|
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.252", "255.255.255.252");?>
|
|
</select>
|
|
|
|
> Greyed out when using DHCP server. Otherwise specify here the associated network mask, by default 255.255.255.0 is selected.
|
|
|
|
</div>
|
|
<?endif;?>
|
|
</div>
|
|
<?endforeach;?>
|
|
|
|
<script type="text/html" id="network-template-eth0" markdown="1">
|
|
<div id="index-eth0-INDEX" class="access-eth0 shade-<?=$display['theme']?>" markdown="1">
|
|
VLAN number:
|
|
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=$eth0["VLANID:INDEX"]?>" class="narrow" required>
|
|
<span class="pin" title="Remove VLAN" onclick="removeVLAN($('#index-eth0-INDEX'),false)"><i class="fa fa-minus-circle red"></i><em>press to remove VLAN</em></span>
|
|
|
|
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
|
|
|
|
Interface description:
|
|
: <input type="text" name="DESCRIPTION:INDEX" maxlength="40" value="<?=$eth0["DESCRIPTION:INDEX"]?>" onchange="exitCode(this.form,true)">
|
|
|
|
> Use this optional field to provide addditional information about the purpose of the connection.
|
|
|
|
IP address assignment:
|
|
: <select name="USE_DHCP:INDEX" size="1" onchange="checkNetworkSettings(this.form,INDEX)">
|
|
<?=mk_option($eth0["USE_DHCP:INDEX"], 'yes', 'Automatic');?>
|
|
<?=mk_option($eth0["USE_DHCP:INDEX"], 'no', 'Static');?>
|
|
<?=mk_option($eth0["USE_DHCP:INDEX"], '', 'None');?>
|
|
</select>
|
|
|
|
> The following settings are possible:
|
|
>
|
|
> *Automatic* - the server will attempt to obtain its IP address from the local DHCP server<br>
|
|
> *Static* - the IP address is manually set for this interface<br>
|
|
> *None* - no IP address is assigned to the interface (only available for VLANs)
|
|
|
|
IP address:
|
|
: <input type="text" name="IPADDR:INDEX" maxlength="40" value="<?=$eth0["IPADDR:INDEX"]?>" class="narrow" pattern="<?=$validIP?>" title="IP address A.B.C.D">
|
|
|
|
> Greyed out when using DHCP server or NONE assignment. Otherwise specify here the IP address of the system.
|
|
|
|
Network mask:
|
|
: <select name="NETMASK:INDEX" size="1">
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.0.0", "255.255.0.0");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.252.0", "255.255.252.0");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.254.0", "255.255.254.0");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.0", "255.255.255.0");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.128", "255.255.255.128");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.192", "255.255.255.192");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.224", "255.255.255.224");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.240", "255.255.255.240");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.248", "255.255.255.248");?>
|
|
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.252", "255.255.255.252");?>
|
|
</select>
|
|
|
|
> Greyed out when using DHCP server or NONE assignment. Otherwise specify here the associated network mask, by default 255.255.255.0 is selected.
|
|
|
|
</div>
|
|
</script>
|
|
|
|
|
|
: <input type="submit" value="Apply" onclick="$('#wait_eth0').show()"><input type="button" value="Done" onclick="done()"><?=$service ? "$service must be <b>STOPPED</b> to change" : ""?>
|
|
</form>
|