feat(NetworkConfigManager): add GRE interface list support for home routers, enhancing tunnel management and configuration clarity
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m45s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m45s
This commit is contained in:
@@ -1502,6 +1502,17 @@ function NetworkConfigManager() {
|
||||
}
|
||||
code += '\n';
|
||||
|
||||
// Проверяем, является ли это home роутером и есть ли GRE интерфейсы
|
||||
const isHomeRouter = server.type === 'home';
|
||||
const hasGreInterfaces = serverData.interfaces.some(iface => iface.type === 'GRE');
|
||||
|
||||
// Для home роутеров с GRE интерфейсами создаём interface list
|
||||
if (isHomeRouter && hasGreInterfaces) {
|
||||
code += `# Создание interface list для GRE туннелей (если не существует)\n`;
|
||||
code += `:if ([/interface list find name=GREs] = "") do={ /interface list add name=GREs comment="GRE tunnels list" }\n`;
|
||||
code += '\n';
|
||||
}
|
||||
|
||||
serverData.interfaces.forEach((iface, ifaceIndex) => {
|
||||
code += `# Интерфейс ${ifaceIndex + 1}: ${iface.interfaceName} (${iface.type})\n`;
|
||||
code += `# Связь с сервером: ${iface.server2Name}\n`;
|
||||
@@ -1533,6 +1544,11 @@ function NetworkConfigManager() {
|
||||
}
|
||||
const mtuParam = iface.mtu ? ` mtu=${iface.mtu}` : '';
|
||||
code += `/interface gre add name="${iface.interfaceName}" remote-address=${remoteAddress}${localAddressParam} keepalive=10s allow-fast-path=no ipsec-secret="${iface.ipsecPassword}"${mtuParam}\n`;
|
||||
|
||||
// Для home роутеров добавляем интерфейс в interface list GREs
|
||||
if (isHomeRouter) {
|
||||
code += `/interface list member add list=GREs interface="${iface.interfaceName}" comment="GRE tunnel to ${iface.server2Name}"\n`;
|
||||
}
|
||||
code += '\n';
|
||||
} else {
|
||||
// GRE туннель без IPSec (голый GRE)
|
||||
@@ -1542,6 +1558,11 @@ function NetworkConfigManager() {
|
||||
}
|
||||
const mtuParam = iface.mtu ? ` mtu=${iface.mtu}` : '';
|
||||
code += `/interface gre add name="${iface.interfaceName}" remote-address=${remoteAddress}${localAddressParam} keepalive=10s allow-fast-path=no${mtuParam}\n`;
|
||||
|
||||
// Для home роутеров добавляем интерфейс в interface list GREs
|
||||
if (isHomeRouter) {
|
||||
code += `/interface list member add list=GREs interface="${iface.interfaceName}" comment="GRE tunnel to ${iface.server2Name}"\n`;
|
||||
}
|
||||
code += '\n';
|
||||
}
|
||||
}
|
||||
@@ -1554,6 +1575,13 @@ function NetworkConfigManager() {
|
||||
code += '# Проверка настроенных адресов на этом сервере:\n';
|
||||
code += '# /ip address print\n';
|
||||
|
||||
// Для home роутеров добавляем проверку interface list
|
||||
if (isHomeRouter && hasGreInterfaces) {
|
||||
code += '\n# Проверка interface list GREs:\n';
|
||||
code += '# /interface list print\n';
|
||||
code += '# /interface list member print where list=GREs\n';
|
||||
}
|
||||
|
||||
blocks.push({
|
||||
type: 'interface-addresses',
|
||||
serverName,
|
||||
|
||||
Reference in New Issue
Block a user