| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193 |
- <!DOCTYPE html>
- <html lang="el" class="dark">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Proxmox RouterOS | Network Appliance</title>
- <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2310b981'><path d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/></svg>">
- <script src="https://cdn.tailwindcss.com"></script>
- <script>
- tailwind.config = {
- darkMode: 'class',
- theme: {
- extend: {
- colors: {
- brand: {
- 50: '#ecfdf5',
- 100: '#d1fae5',
- 400: '#34d399',
- 500: '#10b981',
- 600: '#059669',
- 700: '#047857',
- 800: '#065f46',
- 900: '#064e3b',
- }
- }
- }
- }
- }
- </script>
- <link rel="stylesheet" href="style.css">
- </head>
- <body class="bg-[#0b101e] text-slate-100 min-h-screen flex flex-col font-sans antialiased selection:bg-brand-500 selection:text-white">
- <!-- Toast Notification Container -->
- <div id="toast-container" class="fixed top-5 right-5 z-50 flex flex-col space-y-2 pointer-events-none"></div>
- <!-- Main Layout -->
- <div class="flex flex-1 overflow-hidden h-screen">
- <!-- Sidebar -->
- <aside id="sidebar" class="w-64 bg-[#0f172a]/95 border-r border-slate-800 flex flex-col flex-shrink-0 transition-all duration-300 z-30">
- <!-- Brand Header -->
- <div class="h-16 flex items-center px-5 border-b border-slate-800 justify-between">
- <div class="flex items-center space-x-3">
- <div class="w-9 h-9 rounded-xl bg-gradient-to-tr from-brand-600 to-cyan-500 flex items-center justify-center shadow-lg shadow-brand-500/20 text-white font-bold">
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
- </svg>
- </div>
- <div>
- <div class="font-bold text-sm tracking-wide text-white flex items-center gap-1.5">
- <span>RouterOS</span>
- <span class="text-[10px] bg-brand-500/20 text-brand-400 font-mono px-1.5 py-0.5 rounded border border-brand-500/30">LXC</span>
- </div>
- <div class="text-[11px] text-slate-400">Proxmox Gateway</div>
- </div>
- </div>
- </div>
- <!-- Live Health Pill -->
- <div class="px-4 py-3 border-b border-slate-800/60 bg-slate-900/40">
- <div class="flex items-center justify-between text-xs mb-1.5">
- <span class="text-slate-400 font-medium">Gateway Status</span>
- <span class="flex items-center text-emerald-400 font-medium text-[11px]">
- <span class="relative flex h-2 w-2 mr-1.5">
- <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
- <span class="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span>
- </span>
- Online
- </span>
- </div>
- <div class="text-[11px] text-slate-400 font-mono truncate" id="side-gateway-ip">GW: Scanning...</div>
- </div>
- <!-- Navigation Menu -->
- <nav class="flex-1 px-3 py-3 space-y-1 overflow-y-auto">
- <!-- CATEGORY: OVERVIEW -->
- <div class="px-3 pt-2 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Overview</div>
- <a href="#dashboard" onclick="navigate('dashboard')" id="nav-dashboard"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group bg-brand-500/10 text-brand-400 border border-brand-500/20">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z" />
- </svg>
- <span>Dashboard</span>
- </div>
- </a>
- <!-- CATEGORY: NETWORKING -->
- <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Networking</div>
- <a href="#interfaces" onclick="navigate('interfaces')" id="nav-interfaces"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
- </svg>
- <span>Interfaces</span>
- </div>
- <span id="badge-ifaces-count" class="text-[10px] bg-slate-800 text-slate-300 px-1.5 py-0.2 rounded-full font-mono">0</span>
- </a>
- <a href="#vlans" onclick="navigate('vlans')" id="nav-vlans"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
- </svg>
- <span>VLANs (802.1Q)</span>
- </div>
- <span id="badge-vlans-count" class="text-[10px] bg-cyan-950 text-cyan-400 border border-cyan-800/50 px-1.5 py-0.2 rounded-full font-mono">0</span>
- </a>
- <a href="#firewall" onclick="navigate('firewall')" id="nav-firewall"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
- </svg>
- <span>Firewall</span>
- </div>
- <span id="badge-firewall-count" class="text-[10px] bg-emerald-950 text-emerald-400 border border-emerald-800/50 px-1.5 py-0.2 rounded-full font-mono">0</span>
- </a>
- <a href="#routes" onclick="navigate('routes')" id="nav-routes"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7" />
- </svg>
- <span>Routes & Policy</span>
- </div>
- <span id="badge-routes-count" class="text-[10px] bg-slate-800 text-slate-300 px-1.5 py-0.2 rounded-full font-mono">0</span>
- </a>
- <!-- CATEGORY: WAN & ACCESS -->
- <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">WAN & Access</div>
- <a href="#pppoe" onclick="navigate('pppoe')" id="nav-pppoe"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
- </svg>
- <span>PPPoE Client</span>
- </div>
- <span id="badge-pppoe-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
- </a>
- <!-- CATEGORY: VPN & TUNNELS -->
- <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">VPN & Tunnels</div>
- <a href="#wireguard" onclick="navigate('wireguard')" id="nav-wireguard"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4 text-rose-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
- </svg>
- <span>WireGuard</span>
- </div>
- <span id="badge-wg-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
- </a>
- <a href="#ipsec" onclick="navigate('ipsec')" id="nav-ipsec"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
- </svg>
- <span>IPSec (IKEv2)</span>
- </div>
- <span id="badge-ipsec-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
- </a>
- <a href="#l2tp" onclick="navigate('l2tp')" id="nav-l2tp"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
- </svg>
- <span>L2TP Client</span>
- </div>
- <span id="badge-l2tp-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
- </a>
- <a href="#pptp" onclick="navigate('pptp')" id="nav-pptp"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z" />
- </svg>
- <span>PPTP Client</span>
- </div>
- <span id="badge-pptp-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
- </a>
- <!-- CATEGORY: SYSTEM -->
- <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">System</div>
- <a href="#persistence" onclick="navigate('persistence')" id="nav-persistence"
- class="nav-link flex items-center justify-between px-3 py-2 rounded-lg text-xs font-medium transition-all group text-slate-300 hover:bg-slate-800/80 hover:text-white">
- <div class="flex items-center space-x-2.5">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" />
- </svg>
- <span>Debian Config</span>
- </div>
- <span class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.2 rounded">.cfg</span>
- </a>
- </nav>
- <!-- Sidebar Footer: Host System Metrics -->
- <div class="p-4 border-t border-slate-800/80 bg-slate-900/60">
- <div class="flex items-center justify-between text-xs text-slate-400 mb-2">
- <span class="truncate font-mono" id="side-hostname">debian-lxc</span>
- <span class="text-[11px] text-slate-500" id="side-uptime">0h 0m</span>
- </div>
- <div class="mb-2">
- <div class="flex justify-between text-[11px] text-slate-400 mb-1">
- <span>CPU Load</span>
- <span id="side-cpu-val" class="font-mono text-slate-300">0.00</span>
- </div>
- <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden">
- <div id="side-cpu-bar" class="bg-brand-500 h-full rounded-full transition-all duration-500" style="width: 15%"></div>
- </div>
- </div>
- <div>
- <div class="flex justify-between text-[11px] text-slate-400 mb-1">
- <span>RAM Usage</span>
- <span id="side-ram-val" class="font-mono text-slate-300">0%</span>
- </div>
- <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden">
- <div id="side-ram-bar" class="bg-cyan-500 h-full rounded-full transition-all duration-500" style="width: 25%"></div>
- </div>
- </div>
- </div>
- </aside>
- <!-- Main Content Area -->
- <div class="flex-1 flex flex-col min-w-0 overflow-hidden">
- <!-- Top Navbar -->
- <header class="h-16 bg-[#0f172a]/80 backdrop-blur border-b border-slate-800 flex items-center justify-between px-6 z-20">
- <div class="flex items-center space-x-4">
- <button onclick="toggleSidebar()" class="lg:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800">
- <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
- </svg>
- </button>
- <div>
- <h1 id="page-title" class="text-lg font-bold text-white tracking-tight">Dashboard Overview</h1>
- <p id="page-subtitle" class="text-xs text-slate-400">Live router performance and interface management</p>
- </div>
- </div>
- <div class="flex items-center space-x-3">
- <!-- Active Tunnels Pill -->
- <div class="flex items-center bg-slate-800/80 border border-slate-700/60 rounded-full px-3 py-1 text-xs text-slate-300 space-x-2">
- <span id="tunnels-dot" class="w-2 h-2 rounded-full bg-slate-500"></span>
- <span id="tunnels-label" class="font-mono text-[11px]">0 Active VPN Tunnels</span>
- </div>
- <!-- Quick Actions -->
- <button onclick="openVlanModal()" class="flex items-center space-x-2 bg-gradient-to-r from-brand-600 to-cyan-600 hover:from-brand-500 hover:to-cyan-500 text-white font-medium text-xs px-3.5 py-2 rounded-lg shadow-lg shadow-brand-500/20 transition-all">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
- </svg>
- <span>+ Create VLAN</span>
- </button>
- <button onclick="fetchData(true)" title="Manual Refresh" class="p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white border border-slate-700 transition">
- <svg id="refresh-spinner" class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
- </svg>
- </button>
- </div>
- </header>
- <!-- Scrollable Main Viewport -->
- <main class="flex-1 overflow-y-auto p-6 space-y-6">
- <!-- ================= SECTION: DASHBOARD ================= -->
- <section id="section-dashboard" class="space-y-6">
- <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
- <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
- <div class="flex items-center justify-between mb-3">
- <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Interfaces</span>
- <div class="p-2 bg-brand-500/10 text-brand-400 rounded-lg">
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
- </svg>
- </div>
- </div>
- <div class="flex items-baseline space-x-2">
- <span id="stat-ifaces-up" class="text-2xl font-bold text-white">0</span>
- <span class="text-xs text-slate-400">UP /</span>
- <span id="stat-ifaces-total" class="text-sm font-semibold text-slate-400">0 Total</span>
- </div>
- <div class="mt-2 text-xs text-slate-400 flex items-center">
- <span id="stat-ifaces-down" class="text-rose-400 font-medium mr-1.5">0 DOWN</span>
- <span class="text-slate-500">•</span>
- <span class="text-slate-400 ml-1.5">Plug & Play</span>
- </div>
- </div>
- <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
- <div class="flex items-center justify-between mb-3">
- <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">802.1Q VLANs</span>
- <div class="p-2 bg-cyan-500/10 text-cyan-400 rounded-lg">
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
- </svg>
- </div>
- </div>
- <div class="flex items-baseline space-x-2">
- <span id="stat-vlans-count" class="text-2xl font-bold text-cyan-400">0</span>
- <span class="text-xs text-slate-400">Virtual Subnets</span>
- </div>
- <div class="mt-2 text-xs text-slate-400">Kernel Tagging Active</div>
- </div>
- <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
- <div class="flex items-center justify-between mb-3">
- <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">WAN & VPN Services</span>
- <div class="p-2 bg-violet-500/10 text-violet-400 rounded-lg">
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
- </svg>
- </div>
- </div>
- <div class="flex items-baseline space-x-2">
- <span id="stat-vpn-active" class="text-2xl font-bold text-violet-400">0</span>
- <span class="text-xs text-slate-400">Connected Tunnels</span>
- </div>
- <div class="mt-2 text-[11px] text-slate-400 flex items-center gap-1.5 font-mono">
- <span>WG • IPSec • PPPoE • L2TP</span>
- </div>
- </div>
- <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
- <div class="flex items-center justify-between mb-3">
- <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Live Traffic</span>
- <div class="p-2 bg-amber-500/10 text-amber-400 rounded-lg">
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
- </svg>
- </div>
- </div>
- <div class="space-y-1">
- <div class="flex items-center justify-between text-xs">
- <span class="text-slate-400 flex items-center gap-1"><span class="text-emerald-400 font-bold">↓</span> RX:</span>
- <span id="stat-traffic-rx" class="font-mono font-semibold text-emerald-400">0 B/s</span>
- </div>
- <div class="flex items-center justify-between text-xs">
- <span class="text-slate-400 flex items-center gap-1"><span class="text-cyan-400 font-bold">↑</span> TX:</span>
- <span id="stat-traffic-tx" class="font-mono font-semibold text-cyan-400">0 B/s</span>
- </div>
- </div>
- </div>
- </div>
- <!-- Port Matrix -->
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
- <div class="flex items-center justify-between mb-4">
- <div>
- <h3 class="text-sm font-bold text-white uppercase tracking-wider flex items-center gap-2">
- <span>Hardware & Virtual Port Matrix</span>
- <span class="text-[10px] bg-slate-800 text-slate-400 font-normal px-2 py-0.5 rounded-full">Live Hardware State</span>
- </h3>
- </div>
- </div>
- <div id="port-matrix" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3"></div>
- </div>
- <!-- Quick Overview Tables -->
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
- <div class="flex items-center justify-between mb-4">
- <h3 class="text-sm font-bold text-white">Interfaces Overview</h3>
- <button onclick="navigate('interfaces')" class="text-xs text-brand-400 hover:text-brand-300 font-medium">View All →</button>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs">
- <thead class="text-slate-400 border-b border-slate-800">
- <tr><th class="pb-2">Interface</th><th class="pb-2">Role</th><th class="pb-2">IP</th><th class="pb-2 text-right">Status</th></tr>
- </thead>
- <tbody id="quick-interfaces-table" class="divide-y divide-slate-800/60 font-mono"></tbody>
- </table>
- </div>
- </div>
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
- <div class="flex items-center justify-between mb-4">
- <h3 class="text-sm font-bold text-white">Active VLANs</h3>
- <button onclick="navigate('vlans')" class="text-xs text-cyan-400 hover:text-cyan-300 font-medium">Manage →</button>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs">
- <thead class="text-slate-400 border-b border-slate-800">
- <tr><th class="pb-2">VLAN</th><th class="pb-2">Device</th><th class="pb-2">Subnet</th><th class="pb-2 text-right">Parent</th></tr>
- </thead>
- <tbody id="quick-vlans-table" class="divide-y divide-slate-800/60 font-mono"></tbody>
- </table>
- </div>
- </div>
- </div>
- </section>
- <!-- ================= SECTION: INTERFACES (HIERARCHICAL TREE) ================= -->
- <section id="section-interfaces" class="hidden space-y-6">
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
- <div class="flex items-center space-x-2">
- <span class="text-xs font-semibold text-slate-400 mr-2">Filter:</span>
- <button onclick="filterIfaces('all')" id="filter-all" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium bg-slate-800 text-white border border-slate-700">All Interfaces</button>
- <button onclick="filterIfaces('has_vlans')" id="filter-has_vlans" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">With VLANs</button>
- <button onclick="filterIfaces('physical')" id="filter-physical" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">Physical Only</button>
- <button onclick="filterIfaces('up')" id="filter-up" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">Only UP</button>
- </div>
- <div class="flex items-center space-x-3">
- <button onclick="expandAllIfaces(true)" class="text-xs text-cyan-400 hover:text-cyan-300 font-medium px-2.5 py-1.5 rounded bg-cyan-950/50 border border-cyan-800/60">Expand All</button>
- <button onclick="expandAllIfaces(false)" class="text-xs text-slate-400 hover:text-slate-300 font-medium px-2.5 py-1.5 rounded bg-slate-800 border border-slate-700">Collapse All</button>
- <input type="text" id="iface-search" oninput="renderInterfacesList()" placeholder="Search interfaces..."
- class="bg-slate-800/80 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-brand-500 w-48">
- </div>
- </div>
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden shadow-2xl">
- <div class="p-4 border-b border-slate-800 bg-slate-950/40 flex items-center justify-between">
- <div>
- <h3 class="text-sm font-bold text-white flex items-center gap-2">
- <span>Interface Hierarchy & VLAN Sub-interfaces</span>
- <span class="text-[10px] bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-2 py-0.5 rounded font-mono">Expandable Tree</span>
- </h3>
- </div>
- <div class="text-xs text-slate-400">
- <span id="ifaces-list-summary" class="font-mono">Loading interfaces...</span>
- </div>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs">
- <thead class="text-slate-400 bg-slate-950/80 border-b border-slate-800 uppercase tracking-wider text-[11px]">
- <tr>
- <th class="py-3 px-3 font-semibold w-8 text-center"></th>
- <th class="py-3 px-4 font-semibold">Interface / Type</th>
- <th class="py-3 px-4 font-semibold">Role & Alias</th>
- <th class="py-3 px-4 font-semibold">IP Address (CIDR)</th>
- <th class="py-3 px-4 font-semibold">MAC & MTU</th>
- <th class="py-3 px-4 font-semibold">Throughput (RX/TX)</th>
- <th class="py-3 px-4 font-semibold">Link State</th>
- <th class="py-3 px-4 font-semibold text-right">Actions</th>
- </tr>
- </thead>
- <tbody id="interfaces-tree-tbody" class="divide-y divide-slate-800 font-mono"></tbody>
- </table>
- </div>
- <div id="interfaces-empty-state" class="hidden p-12 text-center text-slate-500">
- No interfaces found matching your search.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: VLANS (802.1Q) ================= -->
- <section id="section-vlans" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-cyan-950/60 via-slate-900 to-slate-900 border border-cyan-800/40 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div class="max-w-xl">
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[11px] font-mono bg-cyan-500/20 text-cyan-400 border border-cyan-500/30 font-semibold">IEEE 802.1Q</span>
- <h2 class="text-base font-bold text-white">VLAN Virtual Sub-interfaces</h2>
- </div>
- <p class="text-xs text-slate-400 leading-relaxed">
- Tagged sub-interfaces on physical parent interfaces (e.g. <code class="text-cyan-300">eth0.10</code>).
- </p>
- </div>
- <button onclick="openVlanModal()" class="flex items-center space-x-2 bg-gradient-to-r from-brand-600 to-cyan-600 hover:from-brand-500 hover:to-cyan-500 text-white font-semibold text-xs px-4 py-2.5 rounded-lg shadow-lg shadow-cyan-500/20 transition">
- <span>+ Create VLAN Sub-interface</span>
- </button>
- </div>
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">Configured VLANs</h3>
- <input type="text" id="vlan-search" oninput="renderVlansList()" placeholder="Filter VLAN ID..."
- class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1 text-xs text-white focus:outline-none focus:border-cyan-500 w-52">
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[11px] font-sans">
- <tr>
- <th class="py-3 px-4 font-semibold">VLAN ID</th>
- <th class="py-3 px-4 font-semibold">Device</th>
- <th class="py-3 px-4 font-semibold">Parent</th>
- <th class="py-3 px-4 font-semibold">Subnet (CIDR)</th>
- <th class="py-3 px-4 font-semibold">Role</th>
- <th class="py-3 px-4 font-semibold">MTU</th>
- <th class="py-3 px-4 font-semibold">Status</th>
- <th class="py-3 px-4 font-semibold text-right">Actions</th>
- </tr>
- </thead>
- <tbody id="vlans-table-body" class="divide-y divide-slate-800"></tbody>
- </table>
- </div>
- <div id="vlans-empty-state" class="hidden p-12 text-center text-slate-500">
- No VLANs configured. Click "+ Create VLAN" to add one.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: PPPoE CLIENTS (MikroTik style) ================= -->
- <section id="section-pppoe" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-blue-950/40 via-slate-900 to-slate-900 border border-blue-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div>
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-blue-500/20 text-blue-300 border border-blue-500/30 font-semibold">/interface pppoe-client</span>
- <h2 class="text-base font-bold text-white">PPPoE Client Sessions</h2>
- </div>
- <p class="text-xs text-slate-400">Manage multiple Point-to-Point Protocol over Ethernet WAN connections (MikroTik RouterOS style).</p>
- </div>
- <button onclick="openAddPPPoEModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-500 text-white shadow-lg shadow-blue-500/20 transition flex items-center gap-1.5">
- <span>+ Add PPPoE Client</span>
- </button>
- </div>
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">Configured PPPoE Interfaces</h3>
- <span id="pppoe-count-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Interfaces</span>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
- <th class="py-2.5 px-3">Name</th>
- <th class="py-2.5 px-3">Interface</th>
- <th class="py-2.5 px-3">User</th>
- <th class="py-2.5 px-3">Assigned IP</th>
- <th class="py-2.5 px-3">Device</th>
- <th class="py-2.5 px-3 text-center">Def. Route</th>
- <th class="py-2.5 px-3 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="pppoe-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="pppoe-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No PPPoE clients configured. Click "+ Add PPPoE Client" to add a connection.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: WIREGUARD (MikroTik style) ================= -->
- <section id="section-wireguard" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-rose-950/40 via-slate-900 to-slate-900 border border-rose-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div>
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-rose-500/20 text-rose-300 border border-rose-500/30 font-semibold">/interface wireguard</span>
- <h2 class="text-base font-bold text-white">WireGuard VPN Suite</h2>
- </div>
- <p class="text-xs text-slate-400">High-performance multi-interface WireGuard server and peer controller (MikroTik RouterOS v7 style).</p>
- </div>
- <div class="flex items-center space-x-2.5">
- <button onclick="openAddWGInterfaceModal()" class="text-xs font-semibold px-3.5 py-2 rounded-lg bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-500/20 transition">
- + Add Interface
- </button>
- <button onclick="openAddWGPeerModal()" class="text-xs font-semibold px-3.5 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-white border border-slate-700 transition">
- + Add Peer
- </button>
- </div>
- </div>
- <!-- Sub Tabs: Interfaces / Peers -->
- <div class="flex border-b border-slate-800 space-x-2">
- <button id="wg-subtab-btn-ifaces" onclick="switchWGSubTab('ifaces')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-rose-500 text-white transition flex items-center gap-2">
- <span>Interfaces</span>
- <span id="wg-subtab-badge-ifaces" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- <button id="wg-subtab-btn-peers" onclick="switchWGSubTab('peers')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
- <span>Peers</span>
- <span id="wg-subtab-badge-peers" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- </div>
- <!-- Sub-Tab 1: Interfaces -->
- <div id="wg-subtab-ifaces" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">WireGuard Interfaces</h3>
- <span id="wg-ifaces-count" class="text-xs font-mono text-slate-400">0 Interfaces</span>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
- <th class="py-2.5 px-3">Name</th>
- <th class="py-2.5 px-3">Listen Port</th>
- <th class="py-2.5 px-3">Tunnel Address</th>
- <th class="py-2.5 px-3">Public Key</th>
- <th class="py-2.5 px-3">MTU</th>
- <th class="py-2.5 px-3 text-center">Peers</th>
- <th class="py-2.5 px-3 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="wg-ifaces-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="wg-ifaces-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No WireGuard interfaces configured. Click "+ Add Interface" to create wg0.
- </div>
- </div>
- <!-- Sub-Tab 2: Peers -->
- <div id="wg-subtab-peers" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
- <div class="flex items-center gap-3">
- <h3 class="text-sm font-bold text-white">WireGuard Peers</h3>
- <span id="wg-peers-count" class="text-xs font-mono text-slate-400">0 Peers</span>
- </div>
- <div class="flex items-center gap-2">
- <label class="text-xs text-slate-400 font-sans">Filter Interface:</label>
- <select id="wg-peers-filter-iface" onchange="renderWGPeers()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
- <option value="">All Interfaces</option>
- </select>
- </div>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Active, X=Disabled">Flag</th>
- <th class="py-2.5 px-3">Interface</th>
- <th class="py-2.5 px-3">Peer Name</th>
- <th class="py-2.5 px-3">Public Key</th>
- <th class="py-2.5 px-3">Allowed IPs</th>
- <th class="py-2.5 px-3">Endpoint</th>
- <th class="py-2.5 px-3">Latest Handshake</th>
- <th class="py-2.5 px-3">Traffic (RX/TX)</th>
- <th class="py-2.5 px-3 text-right font-sans">Action</th>
- </tr>
- </thead>
- <tbody id="wg-peers-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="wg-peers-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No peers found for the selected interface. Click "+ Add Peer" to add a client or branch.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: IPSEC (MikroTik style) ================= -->
- <section id="section-ipsec" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-amber-950/40 via-slate-900 to-slate-900 border border-amber-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div>
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-amber-500/20 text-amber-300 border border-amber-500/30 font-semibold">/ip ipsec</span>
- <h2 class="text-base font-bold text-white">IPSec (IKEv2) Tunnels</h2>
- </div>
- <p class="text-xs text-slate-400">Enterprise strongSwan 6 Site-to-Site and Remote Gateway connections.</p>
- </div>
- <button onclick="openAddIPSecModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-amber-600 hover:bg-amber-500 text-white shadow-lg shadow-amber-500/20 transition">
- + Add IPSec Tunnel
- </button>
- </div>
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">Configured IPSec Tunnels</h3>
- <span id="ipsec-sas-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Active SAs</span>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Established, X=Disabled">Flag</th>
- <th class="py-2.5 px-4">Connection Name</th>
- <th class="py-2.5 px-4">Local Subnet</th>
- <th class="py-2.5 px-4">Remote Gateway</th>
- <th class="py-2.5 px-4">Remote Subnet</th>
- <th class="py-2.5 px-4">Status</th>
- <th class="py-2.5 px-4 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="ipsec-table-body" class="divide-y divide-slate-800"></tbody>
- </table>
- </div>
- <div id="ipsec-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No IPSec tunnels configured. Click "+ Add IPSec Tunnel" to set up site-to-site networking.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: L2TP CLIENT (MikroTik style) ================= -->
- <section id="section-l2tp" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-cyan-950/40 via-slate-900 to-slate-900 border border-cyan-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div>
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-cyan-500/20 text-cyan-300 border border-cyan-500/30 font-semibold">/interface l2tp-client</span>
- <h2 class="text-base font-bold text-white">L2TP Client Sessions</h2>
- </div>
- <p class="text-xs text-slate-400">Multiple Layer 2 Tunneling Protocol clients with optional IPSec PSK encryption.</p>
- </div>
- <button onclick="openAddL2TPModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20 transition">
- + Add L2TP Client
- </button>
- </div>
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">Configured L2TP Clients</h3>
- <span id="l2tp-count-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Clients</span>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
- <th class="py-2.5 px-3">Name</th>
- <th class="py-2.5 px-3">Server Address</th>
- <th class="py-2.5 px-3">User</th>
- <th class="py-2.5 px-3">Assigned IP</th>
- <th class="py-2.5 px-3">Device</th>
- <th class="py-2.5 px-3 text-center">Def. Route</th>
- <th class="py-2.5 px-3 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="l2tp-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="l2tp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No L2TP clients configured. Click "+ Add L2TP Client" to add a tunnel.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: PPTP CLIENT (MikroTik style) ================= -->
- <section id="section-pptp" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-purple-950/40 via-slate-900 to-slate-900 border border-purple-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div>
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-purple-500/20 text-purple-300 border border-purple-500/30 font-semibold">/interface pptp-client</span>
- <h2 class="text-base font-bold text-white">PPTP Client Sessions</h2>
- </div>
- <p class="text-xs text-slate-400">Multiple Point-to-Point Tunneling Protocol clients with MPPE-128 encryption.</p>
- </div>
- <button onclick="openAddPPTPModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20 transition">
- + Add PPTP Client
- </button>
- </div>
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">Configured PPTP Clients</h3>
- <span id="pptp-count-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Clients</span>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
- <th class="py-2.5 px-3">Name</th>
- <th class="py-2.5 px-3">Server Address</th>
- <th class="py-2.5 px-3">User</th>
- <th class="py-2.5 px-3">Assigned IP</th>
- <th class="py-2.5 px-3">Device</th>
- <th class="py-2.5 px-3 text-center">MPPE</th>
- <th class="py-2.5 px-3 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="pptp-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="pptp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No PPTP clients configured. Click "+ Add PPTP Client" to add a tunnel.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: FIREWALL (/ip firewall) ================= -->
- <section id="section-firewall" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-emerald-950/40 via-slate-900 to-slate-900 border border-emerald-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div>
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-emerald-500/20 text-emerald-300 border border-emerald-500/30 font-semibold">/ip firewall</span>
- <h2 class="text-base font-bold text-white">Firewall & Traffic Controller</h2>
- </div>
- <p class="text-xs text-slate-400">Complete MikroTik-grade stateful filter, NAT, packet/connection marking (Mangle), address lists and live connection tracker.</p>
- </div>
- <div class="flex items-center space-x-2.5">
- <button id="fw-primary-add-btn" onclick="openCurrentFWModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20 transition flex items-center gap-1.5">
- <span>+ Add Rule</span>
- </button>
- <button onclick="resetFirewallCounters()" class="text-xs font-medium px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition" title="Reset all packet & byte counters to zero">
- Reset Counters
- </button>
- </div>
- </div>
- <!-- Sub Tabs: Filter / NAT / Mangle / Address Lists / Connections -->
- <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
- <button id="fw-subtab-btn-filter" onclick="switchFWSubTab('filter')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-emerald-500 text-white transition flex items-center gap-2 whitespace-nowrap">
- <span>Filter Rules</span>
- <span id="fw-badge-filter" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- <button id="fw-subtab-btn-nat" onclick="switchFWSubTab('nat')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
- <span>NAT</span>
- <span id="fw-badge-nat" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- <button id="fw-subtab-btn-mangle" onclick="switchFWSubTab('mangle')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
- <span>Mangle</span>
- <span id="fw-badge-mangle" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- <button id="fw-subtab-btn-addrlist" onclick="switchFWSubTab('addrlist')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
- <span>Address Lists</span>
- <span id="fw-badge-addrlist" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- <button id="fw-subtab-btn-connections" onclick="switchFWSubTab('connections')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2 whitespace-nowrap">
- <span>Connections</span>
- <span id="fw-badge-connections" class="px-1.5 py-0.2 rounded text-[10px] bg-emerald-950 text-emerald-400 border border-emerald-800/40">0</span>
- </button>
- </div>
- <!-- ================= TAB 1: FILTER RULES ================= -->
- <div id="fw-subtab-filter" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
- <div class="flex items-center gap-3">
- <h3 class="text-sm font-bold text-white">Firewall Filter Rules</h3>
- <span id="filter-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
- </div>
- <div class="flex items-center gap-2">
- <label class="text-xs text-slate-400 font-sans">Chain:</label>
- <select id="filter-filter-chain" onchange="renderFilterRules()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
- <option value="">All Chains</option>
- <option value="input">input</option>
- <option value="forward">forward</option>
- <option value="output">output</option>
- </select>
- </div>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-10 text-center">#</th>
- <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled, C=Comment">Flag</th>
- <th class="py-2.5 px-3">Chain</th>
- <th class="py-2.5 px-3">Src. Address</th>
- <th class="py-2.5 px-3">Dst. Address</th>
- <th class="py-2.5 px-3">Protocol</th>
- <th class="py-2.5 px-3">Ports</th>
- <th class="py-2.5 px-3">In / Out</th>
- <th class="py-2.5 px-3">Action</th>
- <th class="py-2.5 px-3">Packets / Bytes</th>
- <th class="py-2.5 px-3">Comment</th>
- <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
- </tr>
- </thead>
- <tbody id="filter-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="filter-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No filter rules found in this chain. Click "+ Add Rule" to create one.
- </div>
- </div>
- <!-- ================= TAB 2: NAT RULES ================= -->
- <div id="fw-subtab-nat" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
- <div class="flex items-center gap-3">
- <h3 class="text-sm font-bold text-white">NAT Rules</h3>
- <span id="nat-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
- </div>
- <div class="flex items-center gap-2">
- <label class="text-xs text-slate-400 font-sans">Chain:</label>
- <select id="nat-filter-chain" onchange="renderNATRules()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
- <option value="">All Chains</option>
- <option value="srcnat">srcnat (SNAT / Masquerade)</option>
- <option value="dstnat">dstnat (Port Forwarding)</option>
- </select>
- </div>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-10 text-center">#</th>
- <th class="py-2.5 px-3 w-12 text-center">Flag</th>
- <th class="py-2.5 px-3">Chain</th>
- <th class="py-2.5 px-3">Src. Address</th>
- <th class="py-2.5 px-3">Dst. Address</th>
- <th class="py-2.5 px-3">Proto/Port</th>
- <th class="py-2.5 px-3">Out / In</th>
- <th class="py-2.5 px-3">Action</th>
- <th class="py-2.5 px-3">To Address:Port</th>
- <th class="py-2.5 px-3">Packets / Bytes</th>
- <th class="py-2.5 px-3">Comment</th>
- <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
- </tr>
- </thead>
- <tbody id="nat-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="nat-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No NAT rules configured. Click "+ Add Rule" to add masquerade or port forwarding.
- </div>
- </div>
- <!-- ================= TAB 3: MANGLE RULES ================= -->
- <div id="fw-subtab-mangle" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
- <div class="flex items-center gap-3">
- <h3 class="text-sm font-bold text-white">Mangle Packet & Connection Marking</h3>
- <span id="mangle-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
- </div>
- <div class="flex items-center gap-2">
- <label class="text-xs text-slate-400 font-sans">Chain:</label>
- <select id="mangle-filter-chain" onchange="renderMangleRules()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
- <option value="">All Chains</option>
- <option value="prerouting">prerouting</option>
- <option value="forward">forward</option>
- <option value="postrouting">postrouting</option>
- <option value="input">input</option>
- <option value="output">output</option>
- </select>
- </div>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-10 text-center">#</th>
- <th class="py-2.5 px-3 w-12 text-center">Flag</th>
- <th class="py-2.5 px-3">Chain</th>
- <th class="py-2.5 px-3">Src. Address</th>
- <th class="py-2.5 px-3">Dst. Address</th>
- <th class="py-2.5 px-3">Action</th>
- <th class="py-2.5 px-3">New Mark / Value</th>
- <th class="py-2.5 px-3 text-center">Pass</th>
- <th class="py-2.5 px-3">Packets / Bytes</th>
- <th class="py-2.5 px-3">Comment</th>
- <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
- </tr>
- </thead>
- <tbody id="mangle-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="mangle-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No mangle rules configured. Click "+ Add Rule" to mark connections or routing for Multi-WAN.
- </div>
- </div>
- <!-- ================= TAB 4: ADDRESS LISTS ================= -->
- <div id="fw-subtab-addrlist" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
- <div class="flex items-center gap-3">
- <h3 class="text-sm font-bold text-white">Address Lists (ipset)</h3>
- <span id="addrlist-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
- </div>
- <div class="flex items-center gap-2">
- <label class="text-xs text-slate-400 font-sans">List:</label>
- <select id="addrlist-filter-name" onchange="renderAddressLists()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
- <option value="">All Lists</option>
- </select>
- </div>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-10 text-center">#</th>
- <th class="py-2.5 px-3 w-12 text-center">Flag</th>
- <th class="py-2.5 px-3">List Name</th>
- <th class="py-2.5 px-3">IP Address / CIDR</th>
- <th class="py-2.5 px-3">Comment</th>
- <th class="py-2.5 px-3 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="addrlist-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="addrlist-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No address list entries configured. Click "+ Add Item" to define a group of IPs/subnets.
- </div>
- </div>
- <!-- ================= TAB 5: ACTIVE CONNECTIONS ================= -->
- <div id="fw-subtab-connections" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
- <div class="flex items-center gap-3">
- <h3 class="text-sm font-bold text-white">Active Conntrack Connections</h3>
- <span id="conns-count-badge" class="text-xs font-mono bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 px-2 py-0.5 rounded-full">0 Flows</span>
- </div>
- <div class="flex items-center gap-2 flex-wrap">
- <input type="text" id="conns-search-input" oninput="renderConnections()" placeholder="Filter IP, port..." class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1 text-xs text-white font-mono focus:outline-none focus:border-emerald-500">
- <select id="conns-filter-proto" onchange="renderConnections()" class="bg-slate-800 border border-slate-700 rounded-lg px-2 py-1 text-xs text-white font-mono">
- <option value="">All Proto</option>
- <option value="TCP">TCP</option>
- <option value="UDP">UDP</option>
- <option value="ICMP">ICMP</option>
- </select>
- <button onclick="loadConnections()" class="text-xs text-emerald-400 hover:text-emerald-300 font-semibold px-2 py-1 bg-slate-800 rounded border border-slate-700">Refresh</button>
- </div>
- </div>
- <div class="overflow-x-auto max-h-[550px] overflow-y-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/80 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans sticky top-0 z-10 backdrop-blur-sm">
- <tr>
- <th class="py-2.5 px-3">Proto</th>
- <th class="py-2.5 px-3">Source Address</th>
- <th class="py-2.5 px-3">Destination Address</th>
- <th class="py-2.5 px-3">Reply Source</th>
- <th class="py-2.5 px-3">Reply Dest</th>
- <th class="py-2.5 px-3">TCP State</th>
- <th class="py-2.5 px-3">Mark</th>
- <th class="py-2.5 px-3">Timeout</th>
- <th class="py-2.5 px-3 text-right font-sans">Action</th>
- </tr>
- </thead>
- <tbody id="conns-table-body" class="divide-y divide-slate-800/60"></tbody>
- </table>
- </div>
- <div id="conns-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No active connections found matching your search.
- </div>
- </div>
- </section>
- <!-- ================= SECTION: ROUTES & POLICY (/ip route & rules) ================= -->
- <section id="section-routes" class="hidden space-y-6">
- <div class="bg-gradient-to-r from-cyan-950/40 via-slate-900 to-slate-900 border border-cyan-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
- <div>
- <div class="flex items-center gap-2 mb-1">
- <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-cyan-500/20 text-cyan-300 border border-cyan-500/30 font-semibold">/ip route</span>
- <h2 class="text-base font-bold text-white">IP Routes & Policy Rules</h2>
- </div>
- <p class="text-xs text-slate-400">Kernel FIB/RIB routing tables, static gateways, multipath uplinks, and policy routing (ip rule / fwmark lookup).</p>
- </div>
- <div class="flex items-center space-x-2.5">
- <button onclick="openAddRouteModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20 transition">
- + Add Route
- </button>
- <button onclick="openAddPolicyRuleModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-white border border-slate-700 transition">
- + Add Rule
- </button>
- <button onclick="openAddTableModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition">
- + New Table
- </button>
- </div>
- </div>
- <!-- Sub Tabs: Routes / Policy Rules / Tables -->
- <div class="flex border-b border-slate-800 space-x-1">
- <button id="routes-subtab-btn-routes" onclick="switchRoutesSubTab('routes')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-cyan-500 text-white transition flex items-center gap-2">
- <span>Routes</span>
- <span id="routes-badge-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- <button id="routes-subtab-btn-rules" onclick="switchRoutesSubTab('rules')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
- <span>Policy Rules (/ip route rule)</span>
- <span id="routes-badge-rules" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- <button id="routes-subtab-btn-tables" onclick="switchRoutesSubTab('tables')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-transparent text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
- <span>Routing Tables</span>
- <span id="routes-badge-tables" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
- </button>
- </div>
- <!-- Sub-Tab 1: Routes Table -->
- <div id="routes-subtab-routes" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
- <div class="flex items-center gap-3">
- <h3 class="text-sm font-bold text-white">Active Routing Table (RIB)</h3>
- <span id="routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
- </div>
- <div class="flex items-center gap-2">
- <label class="text-xs text-slate-400 font-sans">Table Filter:</label>
- <select id="routes-filter-table" onchange="renderRoutesList()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white font-mono">
- <option value="">All Tables</option>
- <option value="main">main</option>
- </select>
- <button onclick="loadRoutes()" class="text-xs text-cyan-400 hover:text-cyan-300 font-semibold px-2 py-1 bg-slate-800 rounded border border-slate-700">Refresh</button>
- </div>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-16 text-center" title="Flags: D=Dynamic, A=Active, C=Connect, S=Static, X=Disabled">Flags</th>
- <th class="py-2.5 px-3">Dst. Address</th>
- <th class="py-2.5 px-3">Gateway</th>
- <th class="py-2.5 px-3">Distance</th>
- <th class="py-2.5 px-3">Table / Mark</th>
- <th class="py-2.5 px-3">Interface</th>
- <th class="py-2.5 px-3">Comment</th>
- <th class="py-2.5 px-3 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="routes-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No routes found.
- </div>
- </div>
- <!-- Sub-Tab 2: Policy Rules (/ip route rule) -->
- <div id="routes-subtab-rules" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">Policy Routing Rules (ip rule)</h3>
- <span id="rules-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-16">Pref</th>
- <th class="py-2.5 px-3">Src. Address</th>
- <th class="py-2.5 px-3">Dst. Address</th>
- <th class="py-2.5 px-3">Routing Mark (fwmark)</th>
- <th class="py-2.5 px-3">Lookup Table</th>
- <th class="py-2.5 px-3">Action</th>
- <th class="py-2.5 px-3 text-right font-sans">Actions</th>
- </tr>
- </thead>
- <tbody id="rules-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- <div id="rules-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
- No policy rules configured. Click "+ Add Rule" to route traffic based on routing-mark or source IP.
- </div>
- </div>
- <!-- Sub-Tab 3: Routing Tables -->
- <div id="routes-subtab-tables" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
- <div class="p-4 border-b border-slate-800 flex items-center justify-between">
- <h3 class="text-sm font-bold text-white">Defined Routing Tables (/etc/iproute2/rt_tables)</h3>
- <span id="tables-count-badge" class="text-xs font-mono text-slate-400">0 Tables</span>
- </div>
- <div class="overflow-x-auto">
- <table class="w-full text-left text-xs font-mono">
- <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
- <tr>
- <th class="py-2.5 px-3 w-20">FIB ID</th>
- <th class="py-2.5 px-3">Table Name</th>
- <th class="py-2.5 px-3">Comment / Purpose</th>
- </tr>
- </thead>
- <tbody id="tables-table-body" class="divide-y divide-slate-800/80"></tbody>
- </table>
- </div>
- </div>
- </section>
- <!-- ================= SECTION: DEBIAN CONFIG PERSISTENCE ================= -->
- <section id="section-persistence" class="hidden space-y-6">
- <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
- <div class="flex flex-wrap items-center justify-between gap-4 mb-4">
- <div>
- <h3 class="text-sm font-bold text-white flex items-center gap-2">
- <span>Debian /etc/network/interfaces.d/ Persistence</span>
- <span class="text-[10px] bg-brand-500/20 text-brand-400 px-2 py-0.5 rounded border border-brand-500/30">Debian Native</span>
- </h3>
- <p class="text-xs text-slate-400 mt-1">Changes saved to <code class="text-brand-400">/etc/network/interfaces.d/vlans.cfg</code> survive container reboots.</p>
- </div>
- <div class="flex items-center space-x-3">
- <button onclick="loadDebianConfig()" class="text-xs bg-slate-800 hover:bg-slate-700 text-slate-300 px-3 py-2 rounded-lg border border-slate-700 transition">Re-generate Preview</button>
- <button onclick="saveDebianConfig()" class="flex items-center space-x-2 bg-brand-600 hover:bg-brand-500 text-white font-medium text-xs px-4 py-2 rounded-lg shadow-lg shadow-brand-500/20 transition">
- <span>Save to Debian Config</span>
- </button>
- </div>
- </div>
- <div class="relative">
- <pre id="debian-config-view" class="bg-slate-950 p-4 rounded-lg font-mono text-xs text-slate-300 overflow-x-auto border border-slate-800 max-h-96 leading-relaxed">Loading config preview...</pre>
- </div>
- </div>
- </section>
- </main>
- </div>
- </div>
- <!-- ================= MODAL: CREATE VLAN ================= -->
- <div id="vlan-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 class="text-sm font-bold text-white">Create New VLAN Interface</h3>
- <button onclick="closeVlanModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form id="vlan-form" onsubmit="submitCreateVlan(event)" class="p-6 space-y-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Parent Interface *</label>
- <select id="vlan-parent" onchange="autoSuggestVlanName()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white focus:outline-none focus:border-cyan-500 font-mono"></select>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">VLAN ID (1-4094) *</label>
- <input type="number" id="vlan-id" min="1" max="4094" placeholder="10" required oninput="autoSuggestVlanName()" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface Name</label>
- <input type="text" id="vlan-name" placeholder="eth0.10" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- </div>
- <div>
- <div class="flex items-center justify-between mb-1.5">
- <label class="text-xs font-semibold text-slate-300">Router IP Address & CIDR</label>
- <div class="flex space-x-1">
- <button type="button" onclick="setSubnetPreset('/24')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/24</button>
- <button type="button" onclick="setSubnetPreset('/23')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/23</button>
- <button type="button" onclick="setSubnetPreset('/16')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/16</button>
- </div>
- </div>
- <input type="text" id="vlan-ip" placeholder="192.168.10.1/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
- <select id="vlan-role" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
- <option value="LAN">LAN</option>
- <option value="GUEST">Guest Network</option>
- <option value="IOT">IoT / Smart Home</option>
- <option value="DMZ">DMZ / Isolated</option>
- <option value="MGMT">Management</option>
- <option value="WAN">WAN / Uplink</option>
- </select>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description / Alias</label>
- <input type="text" id="vlan-desc" placeholder="Guest WiFi Subnet" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
- </div>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeVlanModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" id="vlan-submit-btn" class="px-5 py-2 rounded-lg text-xs font-semibold bg-gradient-to-r from-brand-600 to-cyan-600 text-white">Create VLAN</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: EDIT INTERFACE ================= -->
- <div id="iface-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <div>
- <h3 class="text-sm font-bold text-white flex items-center gap-2">
- <span id="modal-iface-name">eth0</span>
- <span id="modal-iface-badge" class="text-[10px] font-mono px-2 py-0.5 rounded bg-slate-800 text-slate-300">Ethernet</span>
- </h3>
- </div>
- <button onclick="closeIfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <div class="p-6 space-y-5">
- <div class="grid grid-cols-2 gap-4 p-3 bg-slate-950/60 rounded-xl border border-slate-800/80">
- <div>
- <span class="block text-[11px] text-slate-400 mb-1">Administrative Link</span>
- <div class="flex items-center space-x-2">
- <button id="modal-btn-up" onclick="setIfaceState(currentModalIface, 'up')" class="px-3 py-1 rounded text-xs font-semibold bg-emerald-600/30 text-emerald-400 border border-emerald-500/40">UP</button>
- <button id="modal-btn-down" onclick="setIfaceState(currentModalIface, 'down')" class="px-3 py-1 rounded text-xs font-semibold bg-slate-800 text-slate-400 hover:bg-rose-600/30 hover:text-rose-400">DOWN</button>
- </div>
- </div>
- <div>
- <span class="block text-[11px] text-slate-400 mb-1">MTU Size</span>
- <div class="flex items-center space-x-2">
- <input type="number" id="modal-iface-mtu" min="68" max="9000" class="w-24 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-white font-mono">
- <button onclick="applyMTU()" class="text-xs bg-slate-800 hover:bg-slate-700 text-white px-2.5 py-1 rounded border border-slate-700">Set</button>
- </div>
- </div>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Assigned IP Addresses</label>
- <div id="modal-ip-list" class="space-y-1.5 mb-3 font-mono text-xs"></div>
- <div class="flex space-x-2">
- <input type="text" id="modal-new-ip" placeholder="192.168.100.1/24" class="flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- <button onclick="addInterfaceIP()" class="bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded-lg text-xs font-semibold">+ Add IP</button>
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
- <select id="modal-iface-role" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
- <option value="WAN">WAN / Uplink</option>
- <option value="LAN">LAN</option>
- <option value="DMZ">DMZ</option>
- <option value="GUEST">Guest</option>
- <option value="IOT">IoT</option>
- <option value="MGMT">Management</option>
- </select>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description</label>
- <input type="text" id="modal-iface-desc" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
- </div>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-between items-center">
- <button id="modal-delete-vlan-btn" onclick="confirmDeleteVlan(currentModalIface)" class="hidden text-xs text-rose-400 hover:text-rose-300">Delete VLAN</button>
- <div class="flex space-x-3">
- <button onclick="closeIfaceModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Close</button>
- <button onclick="saveInterfaceMetadata()" class="px-5 py-2 rounded-lg text-xs font-semibold bg-brand-600 hover:bg-brand-500 text-white">Save Changes</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- ================= MODAL: PPPoE CLIENT ================= -->
- <div id="pppoe-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="pppoe-modal-title" class="text-sm font-bold text-white">Add PPPoE Client Interface</h3>
- <button onclick="closePPPoEModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSavePPPoE(event)" class="p-6 space-y-4">
- <input type="hidden" id="pppoe-modal-edit-orig">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Name *</label>
- <input type="text" id="pppoe-modal-name" placeholder="pppoe-out1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface *</label>
- <select id="pppoe-modal-iface" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500"></select>
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
- <input type="text" id="pppoe-modal-user" placeholder="user@isp" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
- <input type="password" id="pppoe-modal-pass" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-blue-500">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Service Name (Optional)</label>
- <input type="text" id="pppoe-modal-service" placeholder="ISP Service" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">MTU</label>
- <input type="number" id="pppoe-modal-mtu" value="1492" min="576" max="1500" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="pppoe-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
- <span class="text-xs text-slate-300 font-medium">Default Route</span>
- </label>
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="pppoe-modal-reconnect" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
- <span class="text-xs text-slate-300 font-medium">Auto-Reconnect</span>
- </label>
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="pppoe-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closePPPoEModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-blue-600 hover:bg-blue-500 text-white shadow-lg shadow-blue-500/20">Save PPPoE</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: WIREGUARD INTERFACE ================= -->
- <div id="wg-iface-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="wg-iface-modal-title" class="text-sm font-bold text-white">Add WireGuard Interface</h3>
- <button onclick="closeAddWGInterfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveWGInterface(event)" class="p-6 space-y-4">
- <input type="hidden" id="wg-iface-modal-edit-orig">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface Name *</label>
- <input type="text" id="wg-iface-modal-name" placeholder="wg0" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Listen Port *</label>
- <input type="number" id="wg-iface-modal-port" value="51820" min="1" max="65535" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Tunnel IP (CIDR) *</label>
- <input type="text" id="wg-iface-modal-addr" placeholder="10.10.0.1/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">MTU</label>
- <input type="number" id="wg-iface-modal-mtu" value="1420" min="1280" max="1500" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- </div>
- <div>
- <div class="flex items-center justify-between mb-1.5">
- <label class="text-xs font-semibold text-slate-300">Public Key</label>
- <button type="button" onclick="generateWGInterfaceKeys()" class="text-[10px] text-cyan-400 hover:text-cyan-300 font-semibold">Generate New Keypair</button>
- </div>
- <input type="text" id="wg-iface-modal-pubkey" readonly class="w-full bg-slate-950 border border-slate-800 rounded-lg px-3 py-2 text-xs text-slate-300 font-mono">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Private Key (Secret) *</label>
- <input type="password" id="wg-iface-modal-privkey" required class="w-full bg-slate-950 border border-slate-800 rounded-lg px-3 py-2 text-xs text-slate-300 font-mono focus:outline-none focus:border-rose-500">
- </div>
- <div class="pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="wg-iface-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeAddWGInterfaceModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-500/20">Save Interface</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: ADD WIREGUARD PEER ================= -->
- <div id="wg-peer-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="wg-peer-modal-title" class="text-sm font-bold text-white">Add WireGuard Peer</h3>
- <button onclick="closeAddWGPeerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveWGPeer(event)" class="p-6 space-y-4">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">WireGuard Interface *</label>
- <select id="wg-peer-modal-iface" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-rose-500"></select>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Peer Name / Alias *</label>
- <input type="text" id="wg-peer-modal-name" placeholder="Laptop, iPhone, Branch" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
- </div>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Peer Public Key *</label>
- <input type="text" id="wg-peer-modal-pubkey" placeholder="Base64 44-character public key" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Allowed IPs (CIDR) *</label>
- <input type="text" id="wg-peer-modal-allowedips" placeholder="e.g. 10.10.0.2/32, 192.168.20.0/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Endpoint (Optional)</label>
- <input type="text" id="wg-peer-modal-endpoint" placeholder="host:port" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Keepalive (sec)</label>
- <input type="number" id="wg-peer-modal-keepalive" value="25" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Preshared Key (Optional)</label>
- <input type="password" id="wg-peer-modal-preshared" placeholder="Optional PSK for extra post-quantum security" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div class="pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="wg-peer-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeAddWGPeerModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-rose-600 hover:bg-rose-500 text-white">Save Peer</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: IPSEC TUNNEL ================= -->
- <div id="ipsec-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="ipsec-modal-title" class="text-sm font-bold text-white">Configure IPSec IKEv2 Tunnel</h3>
- <button onclick="closeAddIPSecModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveIPSec(event)" class="p-6 space-y-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connection Name *</label>
- <input type="text" id="ipsec-modal-name" placeholder="e.g. site-to-site-office" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Local Subnet *</label>
- <input type="text" id="ipsec-modal-localts" placeholder="192.168.10.0/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Subnet *</label>
- <input type="text" id="ipsec-modal-remotets" placeholder="192.168.20.0/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Gateway IP / FQDN *</label>
- <input type="text" id="ipsec-modal-remotegw" placeholder="203.0.113.50 or vpn.remote.com" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Pre-Shared Key (PSK) *</label>
- <input type="password" id="ipsec-modal-psk" placeholder="Secret Pre-Shared Key" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">IKE Proposals</label>
- <input type="text" id="ipsec-modal-ikeprop" value="aes256-sha256-modp2048,default" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-[11px] text-white font-mono">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">ESP Proposals</label>
- <input type="text" id="ipsec-modal-espprop" value="aes256-sha256-modp2048,default" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-[11px] text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4 pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="ipsec-modal-autostart" checked class="rounded bg-slate-800 border-slate-700 text-amber-500">
- <span class="text-xs text-slate-300 font-medium">Auto-start on boot</span>
- </label>
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="ipsec-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeAddIPSecModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-amber-600 hover:bg-amber-500 text-white">Save Tunnel</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: L2TP CLIENT ================= -->
- <div id="l2tp-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="l2tp-modal-title" class="text-sm font-bold text-white">Add L2TP Client Interface</h3>
- <button onclick="closeL2TPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveL2TP(event)" class="p-6 space-y-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
- <input type="text" id="l2tp-modal-name" placeholder="l2tp-out1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
- <input type="text" id="l2tp-modal-server" placeholder="vpn.example.com or 203.0.113.1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
- <input type="text" id="l2tp-modal-user" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
- <input type="password" id="l2tp-modal-pass" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-cyan-500">
- </div>
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">IPSec Secret / PSK (Optional for L2TP/IPsec)</label>
- <input type="password" id="l2tp-modal-ipsec" placeholder="Optional Pre-Shared Key" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
- </div>
- <div class="grid grid-cols-2 gap-4 pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="l2tp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-cyan-500">
- <span class="text-xs text-slate-300 font-medium">Default Route</span>
- </label>
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="l2tp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeL2TPModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Save L2TP</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: PPTP CLIENT ================= -->
- <div id="pptp-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="pptp-modal-title" class="text-sm font-bold text-white">Add PPTP Client Interface</h3>
- <button onclick="closePPTPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSavePPTP(event)" class="p-6 space-y-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
- <input type="text" id="pptp-modal-name" placeholder="pptp-out1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
- <input type="text" id="pptp-modal-server" placeholder="vpn.example.com or 203.0.113.1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
- <input type="text" id="pptp-modal-user" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
- </div>
- <div>
- <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
- <input type="password" id="pptp-modal-pass" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono focus:outline-none focus:border-purple-500">
- </div>
- </div>
- <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="pptp-modal-mppe" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
- <span class="text-xs text-slate-300 font-medium">MPPE-128</span>
- </label>
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="pptp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
- <span class="text-xs text-slate-300 font-medium">Default Route</span>
- </label>
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="pptp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closePPTPModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg text-xs font-semibold bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20">Save PPTP</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: FIREWALL FILTER RULE ================= -->
- <div id="filter-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in max-h-[90vh] flex flex-col">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="filter-modal-title" class="text-sm font-bold text-white">Add Firewall Filter Rule</h3>
- <button onclick="closeFilterModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveFilterRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
- <input type="hidden" id="filter-modal-id">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
- <select id="filter-modal-chain" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- <option value="input">input (traffic to router)</option>
- <option value="forward" selected>forward (routed traffic)</option>
- <option value="output">output (traffic from router)</option>
- </select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Action *</label>
- <select id="filter-modal-action" onchange="toggleFilterActionFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- <option value="accept" selected>accept</option>
- <option value="drop">drop</option>
- <option value="reject">reject</option>
- <option value="log">log</option>
- <option value="jump">jump</option>
- <option value="return">return</option>
- </select>
- </div>
- </div>
- <div id="filter-action-reject-box" class="hidden p-3 bg-rose-950/20 border border-rose-900/30 rounded-lg">
- <label class="block font-semibold text-rose-300 mb-1">Reject With</label>
- <select id="filter-modal-rejectwith" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- <option value="icmp-network-unreachable">icmp-network-unreachable</option>
- <option value="icmp-host-unreachable">icmp-host-unreachable</option>
- <option value="icmp-port-unreachable">icmp-port-unreachable</option>
- <option value="tcp-reset">tcp-reset (TCP RST)</option>
- </select>
- </div>
- <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
- <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
- <select id="filter-modal-proto" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- <option value="all">all</option>
- <option value="tcp">tcp (6)</option>
- <option value="udp">udp (17)</option>
- <option value="icmp">icmp (1)</option>
- <option value="gre">gre (47)</option>
- <option value="esp">esp (50)</option>
- </select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
- <input type="text" id="filter-modal-connmark" placeholder="e.g. wan2_conn" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
- <input type="text" id="filter-modal-src" placeholder="192.168.1.0/24 or !10.0.0.1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
- <input type="text" id="filter-modal-dst" placeholder="0.0.0.0/0 or !192.168.10.1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Src. Port(s)</label>
- <input type="text" id="filter-modal-sport" placeholder="80,443 or 1000-2000" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
- <input type="text" id="filter-modal-dport" placeholder="80,443,8080" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
- <select id="filter-modal-iniface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
- <select id="filter-modal-outiface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
- </div>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Connection State</label>
- <div class="flex flex-wrap gap-3">
- <label class="flex items-center space-x-1.5 cursor-pointer">
- <input type="checkbox" id="filter-modal-cs-established" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
- <span class="text-slate-300">established</span>
- </label>
- <label class="flex items-center space-x-1.5 cursor-pointer">
- <input type="checkbox" id="filter-modal-cs-related" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
- <span class="text-slate-300">related</span>
- </label>
- <label class="flex items-center space-x-1.5 cursor-pointer">
- <input type="checkbox" id="filter-modal-cs-new" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
- <span class="text-slate-300">new</span>
- </label>
- <label class="flex items-center space-x-1.5 cursor-pointer">
- <input type="checkbox" id="filter-modal-cs-invalid" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="text-slate-300">invalid</span>
- </label>
- </div>
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Src. Address List</label>
- <select id="filter-modal-srclist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- <option value="">(None)</option>
- </select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Dst. Address List</label>
- <select id="filter-modal-dstlist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- <option value="">(None)</option>
- </select>
- </div>
- </div>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Comment</label>
- <input type="text" id="filter-modal-comment" placeholder="e.g. Drop invalid packets" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white">
- </div>
- <div class="pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="filter-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="font-medium text-slate-300">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeFilterModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Save Filter Rule</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: FIREWALL NAT RULE ================= -->
- <div id="nat-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in max-h-[90vh] flex flex-col">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="nat-modal-title" class="text-sm font-bold text-white">Add NAT Rule</h3>
- <button onclick="closeNATModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveNATRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
- <input type="hidden" id="nat-modal-id">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
- <select id="nat-modal-chain" onchange="toggleNATChainFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- <option value="srcnat" selected>srcnat (Outgoing / Masquerade)</option>
- <option value="dstnat">dstnat (Incoming / Port Forwarding)</option>
- </select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Action *</label>
- <select id="nat-modal-action" onchange="toggleNATActionFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- <option value="masquerade" selected>masquerade</option>
- <option value="src-nat">src-nat</option>
- <option value="dst-nat">dst-nat</option>
- <option value="redirect">redirect</option>
- <option value="accept">accept</option>
- </select>
- </div>
- </div>
- <div id="nat-action-to-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
- <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">NAT Target (To Addresses / Ports)</span>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">To Addresses</label>
- <input type="text" id="nat-modal-toaddr" placeholder="192.168.10.50" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">To Ports</label>
- <input type="text" id="nat-modal-toport" placeholder="80 or 8080" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- </div>
- </div>
- <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
- <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
- <select id="nat-modal-proto" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- <option value="all">all</option>
- <option value="tcp">tcp</option>
- <option value="udp">udp</option>
- <option value="icmp">icmp</option>
- </select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
- <input type="text" id="nat-modal-dport" placeholder="80,443" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
- <input type="text" id="nat-modal-src" placeholder="192.168.10.0/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
- <input type="text" id="nat-modal-dst" placeholder="e.g. WAN Public IP" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
- <select id="nat-modal-iniface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
- <select id="nat-modal-outiface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
- </div>
- </div>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Comment</label>
- <input type="text" id="nat-modal-comment" placeholder="e.g. Masquerade to WAN" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white">
- </div>
- <div class="pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="nat-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="font-medium text-slate-300">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeNATModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Save NAT Rule</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: FIREWALL MANGLE RULE ================= -->
- <div id="mangle-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in max-h-[90vh] flex flex-col">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="mangle-modal-title" class="text-sm font-bold text-white">Add Mangle Rule</h3>
- <button onclick="closeMangleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveMangleRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
- <input type="hidden" id="mangle-modal-id">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
- <select id="mangle-modal-chain" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- <option value="prerouting" selected>prerouting (Policy Routing / Marks)</option>
- <option value="forward">forward</option>
- <option value="postrouting">postrouting</option>
- <option value="input">input</option>
- <option value="output">output</option>
- </select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Action *</label>
- <select id="mangle-modal-action" onchange="toggleMangleActionFields()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- <option value="mark-connection" selected>mark-connection</option>
- <option value="mark-routing">mark-routing (Policy Routing)</option>
- <option value="mark-packet">mark-packet (QoS / Queues)</option>
- <option value="change-mss">change-mss (TCP MSS Clamp)</option>
- <option value="set-dscp">set-dscp</option>
- <option value="accept">accept</option>
- </select>
- </div>
- </div>
- <div id="mangle-target-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
- <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Mark Target & Passthrough</span>
- <div class="grid grid-cols-2 gap-3">
- <div id="mangle-field-newmark">
- <label class="block font-semibold text-slate-300 mb-1">New Mark Name</label>
- <input type="text" id="mangle-modal-newmark" placeholder="e.g. wan2_conn or to_WAN2" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- <div class="flex items-center pt-5">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="mangle-modal-passthrough" checked class="rounded bg-slate-800 border-slate-700 text-emerald-500">
- <span class="font-medium text-slate-300">Passthrough</span>
- </label>
- </div>
- </div>
- </div>
- <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
- <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Criteria</span>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
- <input type="text" id="mangle-modal-src" placeholder="192.168.10.0/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
- <input type="text" id="mangle-modal-dst" placeholder="!192.168.0.0/16" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-3">
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
- <input type="text" id="mangle-modal-connmark" placeholder="e.g. wan2_conn" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
- <select id="mangle-modal-iniface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
- </div>
- </div>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1">Comment</label>
- <input type="text" id="mangle-modal-comment" placeholder="e.g. Mark routing for Office traffic" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white">
- </div>
- <div class="pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="mangle-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="font-medium text-slate-300">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeMangleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Save Mangle Rule</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: ADDRESS LIST ENTRY ================= -->
- <div id="addrlist-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="addrlist-modal-title" class="text-sm font-bold text-white">Add Address List Entry</h3>
- <button onclick="closeAddrListModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveAddrList(event)" class="p-6 space-y-4 text-xs">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">List Name *</label>
- <input type="text" id="addrlist-modal-name" placeholder="e.g. LAN_Subnets, Blocked_IPs" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">IP Address / Subnet (CIDR) *</label>
- <input type="text" id="addrlist-modal-addr" placeholder="192.168.10.0/24 or 203.0.113.5" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-emerald-500">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
- <input type="text" id="addrlist-modal-comment" placeholder="Optional description" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeAddrListModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20">Add to List</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: ADD / EDIT ROUTE ================= -->
- <div id="route-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="route-modal-title" class="text-sm font-bold text-white">Add Static Route</h3>
- <button onclick="closeRouteModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveRoute(event)" class="p-6 space-y-4 text-xs">
- <input type="hidden" id="route-modal-id">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR) *</label>
- <input type="text" id="route-modal-dst" value="0.0.0.0/0" placeholder="0.0.0.0/0 or 10.0.0.0/8" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Gateway (IP or Interface) *</label>
- <input type="text" id="route-modal-gw" placeholder="192.168.1.1 or wg0" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Routing Table / Mark</label>
- <select id="route-modal-table" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
- <option value="main" selected>main</option>
- </select>
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Distance (Metric)</label>
- <input type="number" id="route-modal-distance" value="1" min="1" max="255" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Interface (Optional)</label>
- <select id="route-modal-iface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
- </div>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
- <input type="text" id="route-modal-comment" placeholder="e.g. Primary WAN Default Gateway" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
- </div>
- <div class="pt-2">
- <label class="flex items-center space-x-2 cursor-pointer">
- <input type="checkbox" id="route-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
- <span class="font-medium text-slate-300">Disabled (X)</span>
- </label>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeRouteModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Save Route</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: ADD POLICY ROUTING RULE ================= -->
- <div id="prule-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 id="prule-modal-title" class="text-sm font-bold text-white">Add Policy Routing Rule (/ip route rule)</h3>
- <button onclick="closePolicyRuleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSavePolicyRule(event)" class="p-6 space-y-4 text-xs">
- <input type="hidden" id="prule-modal-id">
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Priority / Preference</label>
- <input type="number" id="prule-modal-pref" placeholder="1000" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Routing Mark (fwmark)</label>
- <input type="text" id="prule-modal-mark" placeholder="e.g. to_WAN2 or 100" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Src. Address (CIDR)</label>
- <input type="text" id="prule-modal-src" placeholder="192.168.10.0/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR)</label>
- <input type="text" id="prule-modal-dst" placeholder="0.0.0.0/0" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
- </div>
- </div>
- <div class="grid grid-cols-2 gap-4">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Lookup Table *</label>
- <select id="prule-modal-table" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Action</label>
- <select id="prule-modal-action" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
- <option value="lookup" selected>lookup (standard)</option>
- <option value="unreachable">unreachable</option>
- <option value="blackhole">blackhole</option>
- </select>
- </div>
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closePolicyRuleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Save Policy Rule</button>
- </div>
- </form>
- </div>
- </div>
- <!-- ================= MODAL: CREATE ROUTING TABLE ================= -->
- <div id="table-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
- <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
- <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
- <h3 class="text-sm font-bold text-white">Create New Routing Table</h3>
- <button onclick="closeTableModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
- </div>
- <form onsubmit="submitSaveTable(event)" class="p-6 space-y-4 text-xs">
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Table Name *</label>
- <input type="text" id="table-modal-name" placeholder="e.g. wan2_traffic, vpn_table" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono focus:outline-none focus:border-cyan-500">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">FIB Table ID (Optional)</label>
- <input type="number" id="table-modal-id" min="1" max="252" placeholder="Auto (100+)" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
- </div>
- <div>
- <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
- <input type="text" id="table-modal-comment" placeholder="Purpose of this routing table" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
- </div>
- <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
- <button type="button" onclick="closeTableModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
- <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20">Create Table</button>
- </div>
- </form>
- </div>
- </div>
- <script src="app.js?v=2.2"></script>
- </body>
- </html>
|