diff --git a/backend/routes/mikrotikConfigRoutes.js b/backend/routes/mikrotikConfigRoutes.js
index ba920f4..def67ed 100644
--- a/backend/routes/mikrotikConfigRoutes.js
+++ b/backend/routes/mikrotikConfigRoutes.js
@@ -705,6 +705,9 @@ async function tracerouteViaGateway(req, res) {
if (!Number.isFinite(countNum) || countNum <= 0) countNum = 1;
body.count = countNum;
+ // Включаем reverse DNS (как use-dns=yes), чтобы видеть имена
+ body['use-dns'] = 'yes';
+
const hopsNum = Number(maxHops);
if (Number.isFinite(hopsNum) && hopsNum > 0) {
body['max-hops'] = hopsNum;
@@ -744,7 +747,13 @@ async function tracerouteViaGateway(req, res) {
const seen = new Set();
for (const r of rows) {
- const host = r.host || r.address || '';
+ const ip = (r.address && String(r.address).trim()) || '';
+ const hostField = (r.host && String(r.host).trim()) || '';
+
+ // Если host есть и отличается от IP, считаем его DNS-именем,
+ // иначе всё, что есть, считаем IP.
+ const dns = hostField && hostField !== ip ? hostField : '';
+ const host = dns || ip;
// Пропускаем полностью пустые строки без адреса и статуса
if (!host && !r.status) continue;
@@ -758,7 +767,9 @@ async function tracerouteViaGateway(req, res) {
hops.push({
hop: null, // заполним ниже последовательной нумерацией
- host,
+ host, // отображаемое значение по умолчанию
+ ip: ip || null,
+ dns: dns || null,
avgMs: parseMs(avgField),
bestMs: parseMs(r.best || r['best-rtt'] || r['min-rtt']),
worstMs: parseMs(r.worst || r['worst-rtt'] || r['max-rtt']),
diff --git a/frontend/src/MikrotikTools.jsx b/frontend/src/MikrotikTools.jsx
index 710f8d0..693445d 100644
--- a/frontend/src/MikrotikTools.jsx
+++ b/frontend/src/MikrotikTools.jsx
@@ -270,15 +270,17 @@ function MikrotikTools() {
- {hops.map((h) => (
-
+ {hops.map((h) => {
+ const ip = h.ip || '';
+ const dns = h.dns || '';
+ const mainLabel = dns
+ ? `${dns}${ip ? ` (${ip})` : ''}`
+ : (ip || h.host || '—');
+
+ return (
+
| {h.hop} |
-
- {h.host || '—'}
- {h._label && (
- {h._label}
- )}
- |
+ {mainLabel} |
{h.avgMs != null ? h.avgMs.toFixed(1) : '—'} |
{h.bestMs != null ? h.bestMs.toFixed(1) : '—'} /{' '}
@@ -287,7 +289,7 @@ function MikrotikTools() {
| {h.loss != null ? `${h.loss}%` : '—'} |
{h.status || '—'} |
- ))}
+ );})}
@@ -344,11 +346,13 @@ function buildTracerouteAnalysis(hops, networkConfig, servers, target) {
let worstLatencyHop = null;
hops.forEach((hop, index) => {
- const host = hop.host || hop.address || '';
+ const ip = hop.ip || hop.host || hop.address || '';
+ const dns = hop.dns || null;
+ const hostDisplay = dns ? `${dns}${ip ? ` (${ip})` : ''}` : (ip || hop.host || '');
const avg = hop.avgMs;
const loss = hop.loss;
- let descr = `Хоп ${hop.hop || index + 1}: ${host || 'неизвестный узел'}`;
+ let descr = `Хоп ${hop.hop || index + 1}: ${hostDisplay || 'неизвестный узел'}`;
const details = [];
if (avg != null) details.push(`среднее время ≈ ${avg.toFixed(1)} мс`);
@@ -357,15 +361,15 @@ function buildTracerouteAnalysis(hops, networkConfig, servers, target) {
}
if (loss != null) details.push(`потеря пакетов ${loss}%`);
- // Привязка к gateway
- const gw = gateways.find((g) => g.ip && g.ip === host);
+ // Привязка к gateway (по IP)
+ const gw = gateways.find((g) => g.ip && g.ip === ip);
if (gw) {
const srvLabel = findServerLabel(gw.serverId);
details.push(`gateway "${gw.description || gw.ip}" на сервере ${srvLabel || gw.serverId}`);
}
- // Привязка к туннельному интерфейсу
- const iface = ifaces.find((i) => i.localIp === host || i.remoteIp === host);
+ // Привязка к туннельному интерфейсу (по IP)
+ const iface = ifaces.find((i) => i.localIp === ip || i.remoteIp === ip);
if (iface) {
const s1 = findServerLabel(iface.serverId);
const s2 = findServerLabel(iface.serverId2);
@@ -407,7 +411,7 @@ function buildTracerouteAnalysis(hops, networkConfig, servers, target) {
if (firstTimeoutHop) {
lines.push(
- `Начиная с хопа ${firstTimeoutHop.hop} (${firstTimeoutHop.host || 'неизвестный узел'}) наблюдаются таймауты — цель может быть недоступна или где-то по пути фильтруется ICMP.`
+ `Начиная с хопа ${firstTimeoutHop.hop} (${firstTimeoutHop.dns ? `${firstTimeoutHop.dns}${firstTimeoutHop.ip ? ` (${firstTimeoutHop.ip})` : ''}` : (firstTimeoutHop.ip || firstTimeoutHop.host || 'неизвестный узел')}) наблюдаются таймауты — цель может быть недоступна или где-то по пути фильтруется ICMP.`
);
} else {
lines.push('Таймаутов или явной потери пакетов по пути не обнаружено (по данным MikroTik).');