Revert "Network settings enhancements"

This reverts commit d2bc60215f.
This commit is contained in:
bergware
2019-05-18 22:49:54 +02:00
parent d2bc60215f
commit 71d23a03c4
2 changed files with 307 additions and 307 deletions
+127 -134
View File
@@ -20,9 +20,8 @@ $members = parse_ini_file('state/network.ini',true);
$build = false;
$template = "$docroot/webGui/EthX.page";
$ini = '/var/local/emhttp/network.ini';
$validIP4 = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}";
$validIP6 = "(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(:|([0-9a-fA-F]{1,4}:)+):(([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?)";
$validIP4 = '((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]?)';
$validIP6 = '((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*::((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4}))*|((?:[0-9A-Fa-f]{1,4}))((?::[0-9A-Fa-f]{1,4})){7}';
$width = [166,300];
// get available ethernet ports (excluding eth0)
@@ -67,22 +66,21 @@ $no_eth0 = exec("ip link show eth0|grep -Pom1 '(NO-CARRIER|state DOWN)'");
// get VLAN interfaces
$vlan_id = 'VLANID:';
$vlan_eth0 = [];
$vlan_eth0 = [0];
if (isset($eth0)) foreach ($eth0 as $key => $val) if (strpos($key,$vlan_id)===0) $vlan_eth0[] = substr($key,strlen($vlan_id));
?>
<style>
span.pin i{font-size:2rem;cursor:pointer}
span.red{color:#E68A00}
span.blue{color:#00529B}
span.green{color:#4F8A10}
span.vshift{margin-top:0!important}
input.gap{margin-right:6px}
input.form{font-size:1rem;padding:5px 10px;margin-left:10px}
div.shade-white{background-color:#ededed;margin-top:10px;padding:8px 0 3px 0}
div.shade-black{background-color:#212121;margin-top:10px;padding:8px 0 3px 0}
div.shade-azure{background-color:#edeaef;margin-top:10px;padding:8px 0 3px 0}
div.shade-gray{background-color:#121510;margin-top:10px;padding:8px 0 3px 0}
select.slim{min-width:47px;margin-left:4px}
input.slim{width:32px;margin-left:8px}
div.shade-white{background-color:#ededed}
div.shade-black{background-color:#212121}
div.shade-azure{background-color:#edeaef}
div.shade-gray{background-color:#121510}
select.slim{min-width:45px}
input.slim{width:32px}
</style>
<script>
<?if ($build):?>
@@ -334,13 +332,14 @@ function addVLAN(port) {
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).find('input').first().trigger('change');
$(element).after(template);
selectProtocol($('form[name="'+$(element).parent().attr('name')+'"]'),port,index);
$(element).find('input').first().trigger('change');
}
function removeVLAN(element) {
var id = $(element).attr('id').split('-');
$(element).remove();
$('#view-'+id[1]).find('select').first().trigger('change');
$('#index-'+id[1]+'-0').find('select').first().trigger('change');
}
function disableForm(form) {
$(form).find('input,select').not('input[value="Done"]').prop('disabled',true);
@@ -367,18 +366,6 @@ function portcheck_eth0() {
function portToggle(port,cmd) {
$.post('/webGui/include/PortToggle.php',{port:port,cmd:cmd},function(){refresh();});
}
function viewToggle(eth,vlan) {
var tag = vlan ? '#tag-'+eth+'-'+vlan : '#tag-'+eth;
var view = vlan ? '#view-'+eth+'-'+vlan : '#view-'+eth;
if ($(view).is(':visible')) {
$(tag).removeClass('fa-chevron-up').addClass('fa-chevron-down');
$.cookie(view,'hide',{expires:3650});
} else {
$(tag).removeClass('fa-chevron-down').addClass('fa-chevron-up');
$.removeCookie(view);
}
$(view).toggle();
}
var watchDHCP = new NchanSubscriber('/sub/dhcp', /^((?!chrome|android).)*safari/i.test(navigator.userAgent) ? {subscriber:'longpoll'} : {});
watchDHCP.on('message', function(data) {
data = data.split(' ');
@@ -401,10 +388,6 @@ $(function() {
$('#bridge-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
}});
<?endif;?>
if (!$.cookie('#view-eth0')) $('#view-eth0').show(); else $('#tag-eth0').removeClass('fa-chevron-up').addClass('fa-chevron-down');
<?foreach ($vlan_eth0 as $i):?>
if (!$.cookie('#view-eth0-<?=$i?>')) $('#view-eth0-<?=$i?>').show(); else $('#tag-eth0-<?=$i?>').removeClass('fa-chevron-up').addClass('fa-chevron-down');
<?endforeach;?>
$('#bond-eth0').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bridge-eth0').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
checkBondingSettings(form,0,'eth0');
@@ -444,15 +427,11 @@ $(function() {
<input type="hidden" name="BRNAME" value="br0">
<input type="hidden" name="BRSTP" value="no">
<input type="hidden" name="BRFD" value="0">
Interface description:
: <span class="status vshift"><i id="tag-eth0" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('eth0')"></i></span>
<input type="text" name="DESCRIPTION:0" maxlength="80" value="<?=htmlspecialchars($eth0["DESCRIPTION:0"])?>" onchange="exitCode(this.form,true)">
> Use this optional field to provide addditional information about the purpose of the connection.
<div markdown="1" id="view-eth0" style="display:none">
<?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+'"))?>
: <span class='big'><?=strtoupper(exec("ip link show eth0|grep -Pom1 'ether \K\S+'"))?></span>
> This is the hardware address of the interface.
> When tagging is enabled all VLANs on this interface will share the same hardware address.
@@ -467,7 +446,7 @@ Enable bonding:
> 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 markdown="1" id="bond-members-eth0" style="display:none">
<div id="bond-members-eth0" style="display:none" markdown="1">
Bonding mode:
: <select name="BONDING_MODE" size="1" onchange="checkBondingSettings(this.form,-1,'eth0')">
<?=mk_option($eth0['BONDING_MODE'], "0", "balance-rr (0)");?>
@@ -537,7 +516,7 @@ Enable bridging:
> 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 markdown="1" id="bridge-members-eth0" style="display:none">
<div id="bridge-members-eth0" style="display:none" markdown="1">
Bridging members of br0:
: <select id="bridge-eth0" name="BRNICS" size="1" multiple="multiple" style="display:none">
<?=mk_option($eth0['BRNICS'],'eth0','eth0','selected disabled')?>
@@ -549,21 +528,23 @@ Bridging members of br0:
> 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="80" value="<?=htmlspecialchars($eth0["DESCRIPTION:$i"])?>" onchange="exitCode(this.form,true)">
> Use this optional field to provide addditional information about the purpose of the connection.
Network protocol:
: <select name="PROTOCOL:0" size="1" onchange="selectProtocol(this.form,'eth0',0)">
<?=mk_option($eth0["PROTOCOL:0"], 'ipv4', 'IPv4 only');?>
<?=mk_option($eth0["PROTOCOL:0"], 'ipv6', 'IPv6 only');?>
<?=mk_option($eth0["PROTOCOL:0"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
: <select name="PROTOCOL:<?=$i?>" size="1" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
<?=mk_option($eth0["PROTOCOL:$i"], 'ipv4', 'IPv4 only');?>
<?=mk_option($eth0["PROTOCOL:$i"], 'ipv6', 'IPv6 only');?>
<?=mk_option($eth0["PROTOCOL:$i"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
</select>
> Select which protocol(s) are used. By default IPv4 only is used.<br>
> When both IPv4 and IPv6 is selected, each protocol can be configured independently.
<div markdown="1" class="ipv4-eth0-0" style="display:none">
<div class="ipv4-eth0-<?=$i?>" style="display:none" markdown="1">
IPv4 address assignment:
: <select name="USE_DHCP:0" size="1" onchange="selectProtocol(this.form,'eth0',0)">
<?=mk_option($eth0["USE_DHCP:0"], 'yes', 'Automatic');?>
<?=mk_option($eth0["USE_DHCP:0"], 'no', 'Static');?>
: <select name="USE_DHCP:<?=$i?>" size="1" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
<?=mk_option($eth0["USE_DHCP:$i"], 'yes', 'Automatic');?>
<?=mk_option($eth0["USE_DHCP:$i"], 'no', 'Static');?>
</select>
> The following settings are possible:
@@ -572,32 +553,32 @@ IPv4 address assignment:
> *Static* - the IPv4 address is manually set for this interface<br>
> *None* - no IPv4 address is assigned to the interface (only available for VLANs)
<div markdown="1" class="more-ipv4-eth0-0" style="display:none">
<div class="more-ipv4-eth0-<?=$i?>" style="display:none" markdown="1">
IPv4 address:
: <input type="text" name="IPADDR:0" maxlength="15" value="<?=$eth0["IPADDR:0"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/<select name="NETMASK:0" size="1" class="slim">
<?=mk_option($eth0["NETMASK:0"], "255.0.0.0", "8");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.0.0", "16");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.128.0", "17");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.192.0", "18");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.224.0", "19");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.240.0", "20");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.248.0", "21");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.252.0", "22");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.254.0", "23");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.255.0", "24", $eth0["IPADDR:0"]?"":"selected");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.255.128", "25");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.255.192", "26");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.255.224", "27");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.255.240", "28");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.255.248", "29");?>
<?=mk_option($eth0["NETMASK:0"], "255.255.255.252", "30");?>
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=$eth0["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/ <select name="NETMASK:<?=$i?>" size="1" class="slim">
<?=mk_option($eth0["NETMASK:$i"], "255.0.0.0", "8");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.0.0", "16");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.128.0", "17");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.192.0", "18");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.224.0", "19");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.240.0", "20");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.248.0", "21");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.252.0", "22");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.254.0", "23");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.0", "24", $eth0["IPADDR:$i"]?"":"selected");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.128", "25");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.192", "26");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.224", "27");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.240", "28");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.248", "29");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.255.252", "30");?>
</select>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address and mask of the system.
IPv4 default gateway:
: <input type="text" name="GATEWAY:0" maxlength="15" value="<?=$eth0["GATEWAY:0"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
<input type="text" name="METRIC:0" min="1" max="9999" value="<?=$eth0["METRIC:0"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
: <input type="text" name="GATEWAY:<?=$i?>" maxlength="15" value="<?=$eth0["GATEWAY:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
<input type="text" name="METRIC:<?=$i?>" min="1" max="9999" value="<?=$eth0["METRIC:$i"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address of your router.
@@ -620,14 +601,14 @@ IPv4 DNS server:
>
> Note: for *Active Directory* you **must** ensure this is set to the IP address of your AD Domain server.
<div markdown="1" id="dnsserver2" style="display:none">
<div id="dnsserver2" style="display:none" markdown="1">
IPv4 DNS server 2:
: <input type="text" name="DNS_SERVER2" maxlength="15" value="<?=$eth0['DNS_SERVER2'];?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
> This is the IPv4 DNS server to use when IPv4 DNS server 1 is down.
</div>
<div markdown="1" id="dnsserver3" style="display:none">
<div id="dnsserver3" style="display:none" markdown="1">
IPv4 DNS server 3:
: <input type="text" name="DNS_SERVER3" maxlength="15" value="<?=$eth0['DNS_SERVER3'];?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
@@ -635,11 +616,11 @@ IPv4 DNS server 3:
</div>
</div>
<div markdown="1" class="ipv6-eth0-0" style="display:none">
<div class="ipv6-eth0-<?=$i?>" style="display:none" markdown="1">
IPv6 address assignment:
: <select name="USE_DHCP6:0" size="1" onchange="selectProtocol(this.form,'eth0',0)">
<?=mk_option($eth0["USE_DHCP6:0"], 'yes', 'Automatic');?>
<?=mk_option($eth0["USE_DHCP6:0"], 'no', 'Static');?>
: <select name="USE_DHCP6:<?=$i?>" size="1" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
<?=mk_option($eth0["USE_DHCP6:$i"], 'yes', 'Automatic');?>
<?=mk_option($eth0["USE_DHCP6:$i"], 'no', 'Static');?>
</select>
> The following settings are possible:
@@ -648,28 +629,28 @@ IPv6 address assignment:
> *Static* - the IPv6 address is manually set for this interface<br>
> *None* - no IPv6 address is assigned to the interface (only available for VLANs)
<div markdown="1" class="more-ipv6-eth0-0" style="display:none">
<div class="more-ipv6-eth0-<?=$i?>" style="display:none" markdown="1">
IPv6 address:
: <input type="text" name="IPADDR6:0" maxlength="39" value="<?=$eth0["IPADDR6:0"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/<input type="number" name="NETMASK6:0" min="1" max="128" value="<?=$eth0["NETMASK6:0"]?>" class="slim">
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=$eth0["IPADDR6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/ <input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=$eth0["NETMASK6:$i"]?>" class="slim">
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address of the system.
IPv6 default gateway:
: <input type="text" name="GATEWAY6:0" maxlength="39" value="<?=$eth0["GATEWAY6:0"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
<input type="text" name="METRIC6:0" min="1" max="9999" value="<?=$eth0["METRIC6:0"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
: <input type="text" name="GATEWAY6:<?=$i?>" maxlength="39" value="<?=$eth0["GATEWAY6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
<input type="text" name="METRIC6:<?=$i?>" min="1" max="9999" value="<?=$eth0["METRIC6:$i"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address of your router.
IPv6 privacy extensions:
: <select name="PRIVACY6:0" size="1">
<?=mk_option($eth0["PRIVACY6:0"], "0", "Disabled");?>
<?=mk_option($eth0["PRIVACY6:0"], "2", "Enabled");?>
: <select name="PRIVACY6:<?=$i?>" size="1">
<?=mk_option($eth0["PRIVACY6:$i"], "0", "Disabled");?>
<?=mk_option($eth0["PRIVACY6:$i"], "2", "Enabled");?>
</select>
> Enable or disable the generation of a random IPv6 interface identifier according to RFC4941. This is similar to the temporary IPv6 address generation on Windows machines.
</div>
<div markdown="1" id="dns6server1" style="display:none">
<div id="dns6server1" style="display:none" markdown="1">
IPv6 DNS server assignment:
: <select name="DHCP6_KEEPRESOLV" size="1" onchange="checkDNSSettings6(this.form)">
<?=mk_option($eth0['DHCP6_KEEPRESOLV'], "no", "Automatic");?>
@@ -685,14 +666,14 @@ IPv6 DNS server:
> This is the primary IPv6 DNS server to use. Enter a IPv6 address.
</div>
<div markdown="1" id="dns6server2" style="display:none">
<div id="dns6server2" style="display:none" markdown="1">
IPv6 DNS server 2:
: <input type="text" name="DNS6_SERVER2" maxlength="39" value="<?=$eth0['DNS6_SERVER2'];?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
> This is the IPv6 DNS server to use when IPv6 DNS server 1 is down.
</div>
<div markdown="1" id="dns6server3" style="display:none">
<div id="dns6server3" style="display:none" markdown="1">
IPv6 DNS server 3:
: <input type="text" name="DNS6_SERVER3" maxlength="39" value="<?=$eth0['DNS6_SERVER3'];?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
@@ -701,7 +682,7 @@ IPv6 DNS server 3:
</div>
</div>
Desired MTU:
: <input type="number" name="MTU" min="68" max="9198" value="<?=$eth0['MTU']?>" class="narrow" placeholder="1500">
: <input type="number" name="MTU" min="68" max="9198" value="<?=$eth0['MTU']?>" class="narrow" placeholder="<?=exec("ip link show dev eth0|grep -Pom1 'mtu \K\d+'")?>">
> 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).
@@ -710,29 +691,20 @@ 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><?if (!$service):?><input type="button" class="form access-eth0" value="Add VLAN" onclick="addVLAN('eth0')" style="display:none"><?endif;?>
> By default no VLANs are configured.<br>
> Enabling VLANs extends the number of logical connections over the same physical connection.
>
> Note: your router and switch must support VLANs too when this feature is used.
</div>
<?foreach ($vlan_eth0 as $i):?>
<div markdown="1" id="index-eth0-<?=$i?>" class="access-eth0 shade-<?=$display['theme']?>" style="display:none">
Interface description:
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars($eth0["DESCRIPTION:$i"])?>" onchange="exitCode(this.form,true)">
<span class="status vshift"><i id="tag-eth0-<?=$i?>" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('eth0','<?=$i?>')"></i></span>
> Use this optional field to provide addditional information about the purpose of the connection.
<div markdown="1" id="view-eth0-<?=$i?>" style="display:none">
</select><?if (!$service):?><span class="access-eth0 pin" style="display:none" onclick="addVLAN('eth0')"><i class="fa fa-plus-circle green"></i><em>add VLAN</em></span><?endif;?>
<?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 gap" required>
<?if (!$service):?><input type="button" class="form" value="Delete VLAN" onclick="removeVLAN($('#index-eth0-<?=$i?>'))"><?endif;?>
<?if (!$service):?><span class="pin" onclick="removeVLAN($('#index-eth0-<?=$i?>'))"><i class="fa fa-minus-circle red"></i><em>remove VLAN</em></span><?endif;?>
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
Interface description:
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars($eth0["DESCRIPTION:$i"])?>" onchange="exitCode(this.form,true)">
> Use this optional field to provide addditional information about the purpose of the connection.
Network protocol:
: <select name="PROTOCOL:<?=$i?>" size="1" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
<?=mk_option($eth0["PROTOCOL:$i"], 'ipv4', 'IPv4 only');?>
@@ -740,10 +712,7 @@ Network protocol:
<?=mk_option($eth0["PROTOCOL:$i"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
</select>
> Select which protocol(s) are used. By default IPv4 only is used.<br>
> When both IPv4 and IPv6 is selected, each protocol can be configured independently.
<div markdown="1" class="ipv4-eth0-<?=$i?>" style="display:none">
<div class="ipv4-eth0-<?=$i?>" style="display:none" markdown="1">
IPv4 address assignment:
: <select name="USE_DHCP:<?=$i?>" size="1" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
<?=mk_option($eth0["USE_DHCP:$i"], 'yes', 'Automatic');?>
@@ -759,9 +728,9 @@ IPv4 address assignment:
> *Static* - the IPv4 address is manually set for this interface<br>
> *None* - no IPv4 address is assigned to the interface (only available for VLANs)
<div markdown="1" class="more-ipv4-eth0-<?=$i?>" style="display:none">
<div class="more-ipv4-eth0-<?=$i?>" style="display:none" markdown="1">
IPv4 address:
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=$eth0["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/<select name="NETMASK:<?=$i?>" size="1" class="slim">
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=$eth0["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/ <select name="NETMASK:<?=$i?>" size="1" class="slim">
<?=mk_option($eth0["NETMASK:$i"], "255.0.0.0", "8");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.0.0", "16");?>
<?=mk_option($eth0["NETMASK:$i"], "255.255.128.0", "17");?>
@@ -790,7 +759,7 @@ IPv4 default gateway:
</div>
</div>
<div markdown="1" class="ipv6-eth0-<?=$i?>" style="display:none">
<div class="ipv6-eth0-<?=$i?>" style="display:none" markdown="1">
IPv6 address assignment:
: <select name="USE_DHCP6:<?=$i?>" size="1" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
<?=mk_option($eth0["USE_DHCP6:$i"], 'yes', 'Automatic');?>
@@ -806,9 +775,9 @@ IPv6 address assignment:
> *Static* - the IPv6 address is manually set for this interface<br>
> *None* - no IPv6 address is assigned to the interface (only available for VLANs)
<div markdown="1" class="more-ipv6-eth0-<?=$i?>" style="display:none">
<div class="more-ipv6-eth0-<?=$i?>" style="display:none" markdown="1">
IPv6 address:
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=$eth0["IPADDR6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/<input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=$eth0["NETMASK6:$i"]?>" class="slim">
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=$eth0["IPADDR6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/ <input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=$eth0["NETMASK6:$i"]?>" class="slim">
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address and prefix of the system.
@@ -829,23 +798,22 @@ IPv6 privacy extensions:
</div>
</div>
</div>
<?endif;?>
</div>
<?endforeach;?>
&nbsp;
: <input type="submit" value="Apply" onclick="$('#wait_eth0').show()" disabled><input type="button" value="Done" onclick="done()"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change (see Settings)" : ""?>
</form>
<script markdown="1" type="text/html" id="network-template-eth0">
<div markdown="1" id="index-eth0-INDEX" class="access-eth0 shade-<?=$display['theme']?>">
Interface description:
: <input type="text" name="DESCRIPTION:INDEX" maxlength="80" value="<?=htmlspecialchars($eth0["DESCRIPTION:INDEX"])?>" onchange="exitCode(this.form,true)">
<span class="status vshift"><i id="tag-eth0-INDEX" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('eth0','INDEX')"></i></span>
<div markdown="1" id="view-eth0-INDEX">
<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 gap" required>
<input type="button" class="form" value="Delete VLAN" onclick="removeVLAN($('#index-eth0-INDEX'))">
<span class="pin" onclick="removeVLAN($('#index-eth0-INDEX'),false)"><i class="fa fa-minus-circle red"></i><em>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="80" value="<?=htmlspecialchars($eth0["DESCRIPTION:INDEX"])?>" onchange="exitCode(this.form,true)">
> Use this optional field to provide addditional information about the purpose of the connection.
Network protocol:
: <select name="PROTOCOL:INDEX" size="1" onchange="selectProtocol(this.form,'eth0',INDEX)">
@@ -854,7 +822,7 @@ Network protocol:
<?=mk_option($eth0["PROTOCOL:INDEX"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
</select>
<div markdown="1" class="ipv4-eth0-INDEX" style="display:none">
<div class="ipv4-eth0-INDEX" style="display:none" markdown="1">
IPv4 address assignment:
: <select name="USE_DHCP:INDEX" size="1" onchange="selectProtocol(this.form,'eth0',INDEX)">
<?=mk_option($eth0["USE_DHCP:INDEX"], 'yes', 'Automatic');?>
@@ -862,9 +830,15 @@ IPv4 address assignment:
<?=mk_option($eth0["USE_DHCP:INDEX"], '', 'None');?>
</select>
<div markdown="1" class="more-ipv4-eth0-INDEX" style="display:none">
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv4 address from the local DHCP server<br>
> *Static* - the IPv4 address is manually set for this interface<br>
> *None* - no IPv4 address is assigned to the interface (only available for VLANs)
<div class="more-ipv4-eth0-INDEX" style="display:none" markdown="1">
IPv4 address:
: <input type="text" name="IPADDR:INDEX" maxlength="15" value="<?=$eth0["IPADDR:INDEX"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/<select name="NETMASK:INDEX" size="1" class="slim">
: <input type="text" name="IPADDR:INDEX" maxlength="15" value="<?=$eth0["IPADDR:INDEX"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/ <select name="NETMASK:INDEX" size="1" class="slim">
<?=mk_option($eth0["NETMASK:INDEX"], "255.0.0.0", "8");?>
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.0.0", "16");?>
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.128.0", "17");?>
@@ -883,13 +857,17 @@ IPv4 address:
<?=mk_option($eth0["NETMASK:INDEX"], "255.255.255.252", "30");?>
</select>
> Greyed out when using automatic IP assignment or NONE assignment. Otherwise specify here the IPv4 address and mask of the system.
IPv4 default gateway:
: <input type="text" name="GATEWAY:INDEX" maxlength="15" value="<?=$eth0["GATEWAY:INDEX"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
<input type="text" name="METRIC:INDEX" min="1" max="9999" value="<?=$eth0["METRIC:INDEX"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address of your router.
</div>
</div>
<div markdown="1" class="ipv6-eth0-INDEX" style="display:none">
<div class="ipv6-eth0-INDEX" style="display:none" markdown="1">
IPv6 address assignment:
: <select name="USE_DHCP6:INDEX" size="1" onchange="selectProtocol(this.form,'eth0',INDEX)">
<?=mk_option($eth0["USE_DHCP6:INDEX"], 'yes', 'Automatic');?>
@@ -897,22 +875,37 @@ IPv6 address assignment:
<?=mk_option($eth0["USE_DHCP6:INDEX"], '', 'None');?>
</select>
<div markdown="1" class="more-ipv6-eth0-INDEX" style="display:none">
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv6 address from the local DHCP server or Router Advertisement (RA)<br>
> *Static* - the IPv6 address is manually set for this interface<br>
> *None* - no IPv6 address is assigned to the interface (only available for VLANs)
<div class="more-ipv6-eth0-INDEX" style="display:none" markdown="1">
IPv6 address:
: <input type="text" name="IPADDR6:INDEX" maxlength="39" value="<?=$eth0["IPADDR6:INDEX"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/<input type="number" name="NETMASK6:INDEX" min="1" max="128" value="<?=$eth0["NETMASK6:INDEX"]?>" class="slim">
: <input type="text" name="IPADDR6:INDEX" maxlength="39" value="<?=$eth0["IPADDR6:INDEX"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/ <input type="number" name="NETMASK6:INDEX" min="1" max="128" value="<?=$eth0["NETMASK6:INDEX"]?>" class="slim">
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address and prefix of the system.
IPv6 default gateway:
: <input type="text" name="GATEWAY6:INDEX" maxlength="39" value="<?=$eth0["GATEWAY6:INDEX"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
<input type="text" name="METRIC6:INDEX" min="1" max="9999" value="<?=$eth0["METRIC6:INDEX"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address of your router.
IPv6 privacy extensions:
: <select name="PRIVACY6:INDEX" size="1">
<?=mk_option($eth0['PRIVACY6:INDEX'], "0", "Disabled");?>
<?=mk_option($eth0['PRIVACY6:INDEX'], "2", "Enabled");?>
</select>
</div>
> Enable or disable the generation of a random IPv6 interface identifier according to RFC4941. This is similar to the temporary IPv6 address generation on Windows machines.
</div>
</div>
</div>
</script>
&nbsp;
: <input type="submit" value="Apply" onclick="$('#wait_eth0').show()" disabled><input type="button" value="Done" onclick="done()"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change (see Settings)" : ""?>
</form>
+180 -173
View File
@@ -18,25 +18,25 @@ Tag="icon-ethernet"
$locked = locked('ethX','ethX');
// get VLAN interfaces
$vlan_ethX = [];
$vlan_ethX = [0];
if (!$locked && isset($ethX)) foreach ($ethX as $key => $val) if (strpos($key,$vlan_id)===0) $vlan_ethX[] = substr($key,strlen($vlan_id));
$cmd = 'Down';
$more = true;
if (strpos($locked,'bond')===0 || strpos($locked,'br')===0) {
list($master_ethX,$root) = explode(' ',$locked);
$reason = "member of $master_ethX (see interface $root)";
$class = 'green-text';
$reason = "Interface is member of ".$master_ethX." (see interface ".$root.")";
$class = 'big green';
} elseif (!exec("ip link show ethX|grep -om1 'UP>'")) {
$reason = "shutdown (inactive)";
$class = 'blue-text';
$reason = "Interface is shutdown (inactive)";
$class = 'big blue';
$cmd = 'Up';
} elseif (empty($ethX)) {
$reason = "not configured";
$class = 'red-text';
$reason = "Interface is not configured";
$class = 'big red';
} else {
$more = false;
$class = '';
$class = 'big';
}
?>
<script>
@@ -60,10 +60,6 @@ $(function() {
$('#bridge-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
}});
<?endif;?>
if (!$.cookie('#view-ethX')) $('#view-ethX').show(); else $('#tag-ethX').removeClass('fa-chevron-up').addClass('fa-chevron-down');
<?foreach ($vlan_ethX as $i):?>
if (!$.cookie('#view-ethX-<?=$i?>')) $('#view-ethX-<?=$i?>').show(); else $('#tag-ethX-<?=$i?>').removeClass('fa-chevron-up').addClass('fa-chevron-down');
<?endforeach;?>
$('#bond-ethX').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bridge-ethX').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
checkBondingSettings(form,0,'ethX');
@@ -98,25 +94,16 @@ $(function() {
<input type="hidden" name="BRNAME" value="brX">
<input type="hidden" name="BRSTP" value="no">
<input type="hidden" name="BRFD" value="0">
Interface description:
: <span class="status vshift"><i id="tag-ethX" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('ethX')"></i></span>
<?if (!$more):?>
<input type="text" name="DESCRIPTION:0" maxlength="80" value="<?=htmlspecialchars($ethX["DESCRIPTION:0"])?>" onchange="exitCode(this.form,true)">
<?else:?>
<span class="<?=$class?>"><?=$reason?></span>
<?endif;?>
> Use this field to give addditional information about the purpose of the connection.
<div markdown="1" id="view-ethX" style="display:none">
<?foreach ($vlan_ethX as $i):?>
<?if ($i==0):?>
<div id="index-ethX-<?=$i?>" markdown="1">
MAC address:
: <?=strtoupper(exec("ip link show ethX|grep -Pom1 'ether \K\S+'"))?>
: <span class="<?=$class?>"><?=strtoupper(exec("ip link show ethX|grep -Pom1 'ether \K\S+'"))?><?if ($more):?> - <?=$reason?><?endif;?></span>
> This is the hardware address of the interface.
> When tagging is enabled all VLANs on this interface will share the same hardware address.
<div markdown="1" class="slave-ethX">
<div class="slave-ethX" markdown="1">
Enable bonding:
: <select name="BONDING" size="1" onchange="checkBondingSettings(this.form,1,'ethX')">
<?=mk_option($ethX['BONDING'], "no", "No");?>
@@ -127,7 +114,7 @@ Enable bonding:
> 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 markdown="1" id="bond-members-ethX" style="display:none">
<div id="bond-members-ethX" style="display:none" markdown="1">
Bonding mode:
: <select name="BONDING_MODE" size="1" onchange="checkBondingSettings(this.form,-1,'ethX')">
<?=mk_option($ethX['BONDING_MODE'], "0", "balance-rr (0)");?>
@@ -197,7 +184,7 @@ Enable bridging:
> Bridging is a feature which creates a virtual bridge and allows VMs to communicate directly with the physical Ethernet port.
<div markdown="1" id="bridge-members-ethX" style="display:none">
<div id="bridge-members-ethX" style="display:none" markdown="1">
Bridging members of brX:
: <select id="bridge-ethX" name="BRNICS" size="1" multiple="multiple" style="display:none">
<?=mk_option($ethX['BRNICS'],'ethX','ethX','selected disabled')?>
@@ -210,131 +197,12 @@ Bridging members of brX:
</div>
</div>
<div markdown="1" class="slave-ethX">
Network protocol:
: <select name="PROTOCOL:0" size="1" onchange="selectProtocol(this.form,'ethX',0)">
<?=mk_option($ethX["PROTOCOL:0"], 'ipv4', 'IPv4 only');?>
<?=mk_option($ethX["PROTOCOL:0"], 'ipv6', 'IPv6 only');?>
<?=mk_option($ethX["PROTOCOL:0"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
</select>
> Select which protocol(s) are used. By default IPv4 only is used.<br>
> When both IPv4 and IPv6 is selected, each protocol can be configured independently.
<div markdown="1" class="ipv4-ethX-0" style="display:none">
IPv4 address assignment:
: <select name="USE_DHCP:0" size="1" onchange="selectProtocol(this.form,'ethX',0)">
<?=mk_option($ethX["USE_DHCP:0"], 'yes', 'Automatic');?>
<?=mk_option($ethX["USE_DHCP:0"], 'no', 'Static');?>
<?=mk_option($ethX["USE_DHCP:0"], '', 'None');?>
</select>
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv4 address from the local DHCP server<br>
> *Static* - the IPv4 address is manually set for this interface<br>
> *None* - no IPv4 address is assigned to the interface
<div markdown="1" class="more-ipv4-ethX-0" style="display:none">
IPv4 address:
: <input type="text" name="IPADDR:0" maxlength="15" value="<?=$ethX["IPADDR:0"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/<select name="NETMASK:0" size="1" class="slim">
<?=mk_option($ethX["NETMASK:0"], "255.0.0.0", "8");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.0.0", "16");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.128.0", "17");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.192.0", "18");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.224.0", "19");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.240.0", "20");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.248.0", "21");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.252.0", "22");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.254.0", "23");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.255.0", "24", $ethX["IPADDR:0"]?"":"selected");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.255.128", "25");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.255.192", "26");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.255.224", "27");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.255.240", "28");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.255.248", "29");?>
<?=mk_option($ethX["NETMASK:0"], "255.255.255.252", "30");?>
</select>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address and mask of the interface.
IPv4 default gateway:
: <input type="text" name="GATEWAY:0" maxlength="15" value="<?=$ethX["GATEWAY:0"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
<input type="text" name="METRIC:0" min="1" max="9999" value="<?=$ethX["METRIC:0"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address of your router.
</div>
</div>
<div markdown="1" class="ipv6-ethX-0" style="display:none">
IPv6 address assignment:
: <select name="USE_DHCP6:0" size="1" onchange="selectProtocol(this.form,'ethX',0)">
<?=mk_option($ethX["USE_DHCP6:0"], 'yes', 'Automatic');?>
<?=mk_option($ethX["USE_DHCP6:0"], 'no', 'Static');?>
<?=mk_option($ethX["USE_DHCP6:0"], '', 'None');?>
</select>
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv6 address from the local DHCP server or Router Advertisement (RA)<br>
> *Static* - the IPv6 address is manually set for this interface<br>
> *None* - no IPv6 address is assigned to the interface
<div markdown="1" class="more-ipv6-ethX-0" style="display:none">
IPv6 address:
: <input type="text" name="IPADDR6:0" maxlength="39" value="<?=$ethX["IPADDR6:0"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/<input type="number" name="NETMASK6:0" min="1" max="128" value="<?=$ethX["NETMASK6:0"]?>" class="slim">
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address and prefix of the interface.
IPv6 default gateway:
: <input type="text" name="GATEWAY6:0" maxlength="39" value="<?=$ethX["GATEWAY6:0"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
<input type="text" name="METRIC6:0" min="1" max="9999" value="<?=$ethX["METRIC6:0"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address of your router.
IPv6 privacy extensions:
: <select name="PRIVACY6:0" size="1">
<?=mk_option($ethX["PRIVACY6:0"], "0", "Disabled");?>
<?=mk_option($ethX["PRIVACY6:0"], "2", "Enabled");?>
</select>
> Enable or disable the generation of a random IPv6 interface identifier according to RFC4941. This is similar to the temporary IPv6 address generation on Windows machines.
</div>
</div>
Desired MTU:
: <input type="number" name="MTU" min="68" max="9198" value="<?=$locked?$ethX['MTU']:$ethX['MTU']?>" class="narrow" placeholder="1500">
> 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,'ethX')">
<?=mk_option($ethX['TYPE'], 'access', 'No');?>
<?=mk_option($ethX['TYPE'], 'trunk', 'Yes');?>
</select><?if (!$service):?><input type="button" class="form access-ethX" value="Add VLAN" onclick="addVLAN('ethX')" style="display:none"><?endif;?>
> By default no VLANs are configured.<br>
> Enabling VLANs extends the number of logical connections over the same physical connection.
>
> Note: your router and switch must support VLANs too when this feature is used.
</div>
</div>
<?foreach ($vlan_ethX as $i):?>
<div markdown="1" id="index-ethX-<?=$i?>" class="access-ethX shade-<?=$display['theme']?>" style="display:none">
VLAN number:
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=$ethX["VLANID:$i"]?>" class="narrow gap" required>
<?if (!$service):?><input type="button" class="form" value="Delete VLAN" onclick="removeVLAN($('#index-ethX-<?=$i?>'))"><?endif;?>
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
<div markdown="1" id="view-ethX-<?=$i?>" style="display:none">
Interface description:
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars($ethX["DESCRIPTION:$i"])?>" onchange="exitCode(this.form,true)">
> Use this field to give addditional information about the purpose of the connection.
<div class="slave-ethX" markdown="1">
Network protocol:
: <select name="PROTOCOL:<?=$i?>" size="1" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
<?=mk_option($ethX["PROTOCOL:$i"], 'ipv4', 'IPv4 only');?>
@@ -342,7 +210,7 @@ Network protocol:
<?=mk_option($ethX["PROTOCOL:$i"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
</select>
<div markdown="1" class="ipv4-ethX-<?=$i?>" style="display:none">
<div class="ipv4-ethX-<?=$i?>" style="display:none" markdown="1">
IPv4 address assignment:
: <select name="USE_DHCP:<?=$i?>" size="1" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
<?=mk_option($ethX["USE_DHCP:$i"], 'yes', 'Automatic');?>
@@ -356,9 +224,124 @@ IPv4 address assignment:
> *Static* - the IPv4 address is manually set for this interface<br>
> *None* - no IPv4 address is assigned to the interface
<div markdown="1" class="more-ipv4-ethX-<?=$i?>" style="display:none">
<div class="more-ipv4-ethX-<?=$i?>" style="display:none" markdown="1">
IPv4 address:
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=$ethX["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/<select name="NETMASK:<?=$i?>" size="1" class="slim">
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=$ethX["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/ <select name="NETMASK:<?=$i?>" size="1" class="slim">
<?=mk_option($ethX["NETMASK:$i"], "255.0.0.0", "8");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.0.0", "16");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.128.0", "17");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.192.0", "18");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.224.0", "19");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.240.0", "20");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.248.0", "21");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.252.0", "22");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.254.0", "23");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.255.0", "24", $ethX["IPADDR:$i"]?"":"selected");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.255.128", "25");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.255.192", "26");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.255.224", "27");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.255.240", "28");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.255.248", "29");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.255.252", "30");?>
</select>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address and mask of the interface.
IPv4 default gateway:
: <input type="text" name="GATEWAY:<?=$i?>" maxlength="15" value="<?=$ethX["GATEWAY:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
<input type="text" name="METRIC:<?=$i?>" min="1" max="9999" value="<?=$ethX["METRIC:$i"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address of your router.
</div>
</div>
<div class="ipv6-ethX-<?=$i?>" style="display:none" markdown="1">
IPv6 address assignment:
: <select name="USE_DHCP6:<?=$i?>" size="1" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
<?=mk_option($ethX["USE_DHCP6:$i"], 'yes', 'Automatic');?>
<?=mk_option($ethX["USE_DHCP6:$i"], 'no', 'Static');?>
<?=mk_option($ethX["USE_DHCP6:$i"], '', 'None');?>
</select>
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv6 address from the local DHCP server or Router Advertisement (RA)<br>
> *Static* - the IPv6 address is manually set for this interface<br>
> *None* - no IPv6 address is assigned to the interface
<div class="more-ipv6-ethX-<?=$i?>" style="display:none" markdown="1">
IPv6 address:
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=$ethX["IPADDR6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/ <input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=$ethX["NETMASK6:$i"]?>" class="slim">
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address and prefix of the interface.
IPv6 default gateway:
: <input type="text" name="GATEWAY6:<?=$i?>" maxlength="39" value="<?=$ethX["GATEWAY6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
<input type="text" name="METRIC6:<?=$i?>" min="1" max="9999" value="<?=$ethX["METRIC6:$i"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address of your router.
IPv6 privacy extensions:
: <select name="PRIVACY6:<?=$i?>" size="1">
<?=mk_option($ethX["PRIVACY6:$i"], "0", "Disabled");?>
<?=mk_option($ethX["PRIVACY6:$i"], "2", "Enabled");?>
</select>
> Enable or disable the generation of a random IPv6 interface identifier according to RFC4941. This is similar to the temporary IPv6 address generation on Windows machines.
</div>
</div>
Desired MTU:
: <input type="number" name="MTU" min="68" max="9198" value="<?=$locked?$ethX['MTU']:$ethX['MTU']?>" class="narrow" placeholder="<?=exec("ip link show dev ethX|grep -Pom1 'mtu \K\d+'")?>">
> 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,'ethX')">
<?=mk_option($ethX['TYPE'], 'access', 'No');?>
<?=mk_option($ethX['TYPE'], 'trunk', 'Yes');?>
</select><?if (!$service):?><span class="pin access-ethX" style="display:none" onclick="addVLAN('ethX')"><i class="fa fa-plus-circle green"></i><em>add VLAN</em></span><?endif;?>
</div>
</div>
<?else:?>
<div id="index-ethX-<?=$i?>" markdown="1">
<div class="access-ethX shade-<?=$display['theme']?>" style="display:none" markdown="1">
VLAN number:
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=$ethX["VLANID:$i"]?>" class="narrow gap" required>
<?if (!$service):?><span class="pin" onclick="removeVLAN($('#index-ethX-<?=$i?>'))"><i class="fa fa-minus-circle red"></i><em>remove VLAN</em></span><?endif;?>
> Give each VLAN a unique identifier. Numbers range from 1 to 4095.
Interface description:
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars($ethX["DESCRIPTION:$i"])?>" onchange="exitCode(this.form,true)">
> Use this field to give addditional information about the purpose of the connection.
Network protocol:
: <select name="PROTOCOL:<?=$i?>" size="1" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
<?=mk_option($ethX["PROTOCOL:$i"], 'ipv4', 'IPv4 only');?>
<?=mk_option($ethX["PROTOCOL:$i"], 'ipv6', 'IPv6 only');?>
<?=mk_option($ethX["PROTOCOL:$i"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
</select>
<div class="ipv4-ethX-<?=$i?>" style="display:none" markdown="1">
IPv4 address assignment:
: <select name="USE_DHCP:<?=$i?>" size="1" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
<?=mk_option($ethX["USE_DHCP:$i"], 'yes', 'Automatic');?>
<?=mk_option($ethX["USE_DHCP:$i"], 'no', 'Static');?>
<?=mk_option($ethX["USE_DHCP:$i"], '', 'None');?>
</select>
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv4 address from the local DHCP server<br>
> *Static* - the IPv4 address is manually set for this interface<br>
> *None* - no IPv4 address is assigned to the interface
<div class="more-ipv4-ethX-<?=$i?>" style="display:none" markdown="1">
IPv4 address:
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=$ethX["IPADDR:$i"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/ <select name="NETMASK:<?=$i?>" size="1" class="slim">
<?=mk_option($ethX["NETMASK:$i"], "255.0.0.0", "8");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.0.0", "16");?>
<?=mk_option($ethX["NETMASK:$i"], "255.255.128.0", "17");?>
@@ -387,7 +370,7 @@ IPv4 default gateway:
</div>
</div>
<div markdown="1" class="ipv6-ethX-<?=$i?>" style="display:none">
<div class="ipv6-ethX-<?=$i?>" style="display:none" markdown="1">
IPv6 address assignment:
: <select name="USE_DHCP6:<?=$i?>" size="1" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
<?=mk_option($ethX["USE_DHCP6:$i"], 'yes', 'Automatic');?>
@@ -401,9 +384,9 @@ IPv6 address assignment:
> *Static* - the IPv6 address is manually set for this interface<br>
> *None* - no IPv6 address is assigned to the interface
<div markdown="1" class="more-ipv6-ethX-<?=$i?>" style="display:none">
<div class="more-ipv6-ethX-<?=$i?>" style="display:none" markdown="1">
IPv6 address:
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=$ethX["IPADDR6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/<input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=$ethX["NETMASK6:$i"]?>" class="slim">
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=$ethX["IPADDR6:$i"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/ <input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=$ethX["NETMASK6:$i"]?>" class="slim">
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address and prefix of the interface.
@@ -425,22 +408,21 @@ IPv6 privacy extensions:
</div>
</div>
</div>
<?endif;?>
<?endforeach;?>
&nbsp;
: <input type="submit" value="Apply" onclick="$(waitid).show()" disabled><input type="button" value="Done" onclick="done()"><input type="button" name="#shut_ethX" value="Port <?=$cmd?>" onclick="portToggle('ethX','<?=$cmd?>')"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change (see Settings)" : ""?>
</form>
<script markdown="1" type="text/html" id="network-template-ethX">
<div markdown="1" id="index-ethX-INDEX" class="access-ethX shade-<?=$display['theme']?>">
Interface description:
: <input type="text" name="DESCRIPTION:INDEX" maxlength="80" value="<?=htmlspecialchars($ethX["DESCRIPTION:INDEX"])?>" onchange="exitCode(this.form,true)">
<span class="status vshift"><i id="tag-ethX-INDEX" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('ethX','INDEX')"></i></span>
<div markdown="1" id="view-ethX-INDEX">
<script type="text/html" id="network-template-ethX" markdown="1">
<div id="index-ethX-INDEX" class="access-ethX shade-<?=$display['theme']?>" markdown="1">
VLAN number:
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=$ethX["VLANID:INDEX"]?>" class="narrow gap" required>
<input type="button" class="form" value="Delete VLAN" onclick="removeVLAN($('#index-ethX-INDEX'))">
<span class="pin" onclick="removeVLAN($('#index-ethX-INDEX'),false)"><i class="fa fa-minus-circle red"></i><em>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="80" value="<?=htmlspecialchars($ethX["DESCRIPTION:INDEX"])?>" onchange="exitCode(this.form,true)">
> Use this field to give addditional information about the purpose of the connection.
Network protocol:
: <select name="PROTOCOL:INDEX" size="1" onchange="selectProtocol(this.form,'ethX',INDEX)">
@@ -449,7 +431,7 @@ Network protocol:
<?=mk_option($ethX["PROTOCOL:INDEX"], 'ipv4+ipv6', 'IPv4 + IPv6');?>
</select>
<div markdown="1" class="ipv4-ethX-INDEX" style="display:none">
<div class="ipv4-ethX-INDEX" style="display:none" markdown="1">
IPv4 address assignment:
: <select name="USE_DHCP:INDEX" size="1" onchange="selectProtocol(this.form,'ethX',INDEX)">
<?=mk_option($ethX["USE_DHCP:INDEX"], 'yes', 'Automatic');?>
@@ -457,9 +439,15 @@ IPv4 address assignment:
<?=mk_option($ethX["USE_DHCP:INDEX"], '', 'None');?>
</select>
<div markdown="1" class="more-ipv4-ethX-INDEX" style="display:none">
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv4 address from the local DHCP server<br>
> *Static* - the IPv4 address is manually set for this interface<br>
> *None* - no IPv4 address is assigned to the interface
<div class="more-ipv4-ethX-INDEX" style="display:none" markdown="1">
IPv4 address:
: <input type="text" name="IPADDR:INDEX" maxlength="15" value="<?=$ethX["IPADDR:INDEX"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/<select name="NETMASK:INDEX" size="1" class="slim">
: <input type="text" name="IPADDR:INDEX" maxlength="15" value="<?=$ethX["IPADDR:INDEX"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">/ <select name="NETMASK:INDEX" size="1" class="slim">
<?=mk_option($ethX["NETMASK:INDEX"], "255.0.0.0", "8");?>
<?=mk_option($ethX["NETMASK:INDEX"], "255.255.0.0", "16");?>
<?=mk_option($ethX["NETMASK:INDEX"], "255.255.128.0", "17");?>
@@ -478,13 +466,17 @@ IPv4 address:
<?=mk_option($ethX["NETMASK:INDEX"], "255.255.255.252", "30");?>
</select>
> Greyed out when using automatic IP assignment or NONE assignment. Otherwise specify here the IPv4 address and mask of the interface.
IPv4 default gateway:
: <input type="text" name="GATEWAY:INDEX" maxlength="15" value="<?=$ethX["GATEWAY:INDEX"]?>" class="narrow" pattern="<?=$validIP4?>" title="IPv4 address A.B.C.D">
<input type="text" name="METRIC:INDEX" min="1" max="9999" value="<?=$ethX["METRIC:INDEX"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv4 address of your router.
</div>
</div>
<div markdown="1" class="ipv6-ethX-INDEX" style="display:none">
<div class="ipv6-ethX-INDEX" style="display:none" markdown="1">
IPv6 address assignment:
: <select name="USE_DHCP6:INDEX" size="1" onchange="selectProtocol(this.form,'ethX',INDEX)">
<?=mk_option($ethX["USE_DHCP6:INDEX"], 'yes', 'Automatic');?>
@@ -492,22 +484,37 @@ IPv6 address assignment:
<?=mk_option($ethX["USE_DHCP6:INDEX"], '', 'None');?>
</select>
<div markdown="1" class="more-ipv6-ethX-INDEX" style="display:none">
> The following settings are possible:
>
> *Automatic* - the server will attempt to obtain a IPv6 address from the local DHCP server or Router Advertisement (RA)<br>
> *Static* - the IPv6 address is manually set for this interface<br>
> *None* - no IPv6 address is assigned to the interface
<div class="more-ipv6-ethX-INDEX" style="display:none" markdown="1">
IPv6 address:
: <input type="text" name="IPADDR6:INDEX" maxlength="39" value="<?=$ethX["IPADDR6:INDEX"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/<input type="number" name="NETMASK6:INDEX" min="1" max="128" value="<?=$ethX["NETMASK6:INDEX"]?>" class="slim">
: <input type="text" name="IPADDR6:INDEX" maxlength="39" value="<?=$ethX["IPADDR6:INDEX"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">/ <input type="number" name="NETMASK6:INDEX" min="1" max="128" value="<?=$ethX["NETMASK6:INDEX"]?>" class="slim">
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address and prefix of the interface.
IPv6 default gateway:
: <input type="text" name="GATEWAY6:INDEX" maxlength="39" value="<?=$ethX["GATEWAY6:INDEX"]?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
<input type="text" name="METRIC6:INDEX" min="1" max="9999" value="<?=$ethX["METRIC6:INDEX"]?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> <em>optional metric (lowest is preferred)</em>
> Greyed out when using automatic IP assignment. Otherwise specify here the IPv6 address of your router.
IPv6 privacy extensions:
: <select name="PRIVACY6:INDEX" size="1">
<?=mk_option($ethX['PRIVACY6:INDEX'], "0", "Disabled");?>
<?=mk_option($ethX['PRIVACY6:INDEX'], "2", "Enabled");?>
</select>
</div>
> Enable or disable the generation of a random IPv6 interface identifier according to RFC4941. This is similar to the temporary IPv6 address generation on Windows machines.
</div>
</div>
</div>
</script>
&nbsp;
: <input type="submit" value="Apply" onclick="$(waitid).show()" disabled><input type="button" value="Done" onclick="done()"><input type="button" name="#shut_ethX" value="Port <?=$cmd?>" onclick="portToggle('ethX','<?=$cmd?>')"><?=$service ? "$service must be <span class='strong big'>Stopped</span> to change (see Settings)" : ""?>
</form>