index.html 339 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204
  1. <!DOCTYPE html>
  2. <html lang="el" class="dark">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Proxmox RouterOS | Network Appliance</title>
  7. <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>">
  8. <script src="https://cdn.tailwindcss.com"></script>
  9. <script>
  10. tailwind.config = {
  11. darkMode: 'class',
  12. theme: {
  13. extend: {
  14. colors: {
  15. brand: {
  16. 50: '#ecfdf5',
  17. 100: '#d1fae5',
  18. 400: '#34d399',
  19. 500: '#10b981',
  20. 600: '#059669',
  21. 700: '#047857',
  22. 800: '#065f46',
  23. 900: '#064e3b',
  24. }
  25. }
  26. }
  27. }
  28. }
  29. </script>
  30. <link rel="stylesheet" href="style.css">
  31. </head>
  32. <body class="bg-[#0b101e] text-slate-100 min-h-screen flex flex-col font-sans antialiased selection:bg-brand-500 selection:text-white">
  33. <!-- Toast Notification Container -->
  34. <div id="toast-container" class="fixed top-5 right-5 z-50 flex flex-col space-y-2 pointer-events-none"></div>
  35. <!-- Main Layout -->
  36. <div class="flex flex-1 overflow-hidden h-screen">
  37. <!-- Sidebar -->
  38. <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">
  39. <!-- Brand Header -->
  40. <div class="h-16 flex items-center px-5 border-b border-slate-800 justify-between">
  41. <div class="flex items-center space-x-3">
  42. <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">
  43. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  44. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
  45. </svg>
  46. </div>
  47. <div>
  48. <div class="font-bold text-sm tracking-wide text-white flex items-center gap-1.5">
  49. <span>RouterOS</span>
  50. <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>
  51. </div>
  52. <div class="text-[11px] text-slate-400">Proxmox Gateway</div>
  53. </div>
  54. </div>
  55. </div>
  56. <!-- Live Health Pill -->
  57. <div class="px-4 py-3 border-b border-slate-800/60 bg-slate-900/40">
  58. <div class="flex items-center justify-between text-xs mb-1.5">
  59. <span class="text-slate-400 font-medium">Gateway Status</span>
  60. <span class="flex items-center text-emerald-400 font-medium text-[11px]">
  61. <span class="relative flex h-2 w-2 mr-1.5">
  62. <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
  63. <span class="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span>
  64. </span>
  65. Online
  66. </span>
  67. </div>
  68. <div class="text-[11px] text-slate-400 font-mono truncate" id="side-gateway-ip">GW: Scanning...</div>
  69. </div>
  70. <!-- Navigation Menu -->
  71. <nav class="flex-1 px-3 py-3 space-y-1 overflow-y-auto">
  72. <!-- CATEGORY: OVERVIEW -->
  73. <div class="px-3 pt-2 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Overview</div>
  74. <a href="#dashboard" onclick="navigate('dashboard')" id="nav-dashboard"
  75. 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">
  76. <div class="flex items-center space-x-2.5">
  77. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  78. <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" />
  79. </svg>
  80. <span>Dashboard</span>
  81. </div>
  82. </a>
  83. <!-- CATEGORY: NETWORKING -->
  84. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Networking</div>
  85. <a href="#interfaces" onclick="navigate('interfaces')" id="nav-interfaces"
  86. 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">
  87. <div class="flex items-center space-x-2.5">
  88. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  89. <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" />
  90. </svg>
  91. <span>Interfaces</span>
  92. </div>
  93. <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>
  94. </a>
  95. <a href="#dhcp-client" onclick="navigate('dhcp-client')" id="nav-dhcp-client"
  96. 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">
  97. <div class="flex items-center space-x-2.5">
  98. <svg class="w-4 h-4 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  99. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
  100. </svg>
  101. <span>DHCP Client</span>
  102. </div>
  103. <span id="badge-dhcp-client-count" class="text-[10px] bg-slate-800 text-slate-300 px-1.5 py-0.2 rounded-full font-mono">0</span>
  104. </a>
  105. <a href="#bridge" onclick="navigate('bridge')" id="nav-bridge"
  106. 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">
  107. <div class="flex items-center space-x-2.5">
  108. <svg class="w-4 h-4 text-sky-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  109. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M3 14h18M5 14v4a2 2 0 002 2h2a2 2 0 002-2v-4m6 0v4a2 2 0 002 2h2a2 2 0 002-2v-4M4 10V6a2 2 0 012-2h12a2 2 0 012 2v4" />
  110. </svg>
  111. <span>Bridge</span>
  112. </div>
  113. <span id="badge-bridge-count" class="text-[10px] bg-sky-950 text-sky-300 border border-sky-800/40 px-1.5 py-0.2 rounded-full font-mono">0</span>
  114. </a>
  115. <a href="#firewall" onclick="navigate('firewall')" id="nav-firewall"
  116. 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">
  117. <div class="flex items-center space-x-2.5">
  118. <svg class="w-4 h-4 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  119. <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" />
  120. </svg>
  121. <span>Firewall</span>
  122. </div>
  123. <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>
  124. </a>
  125. <!-- CATEGORY: ROUTING -->
  126. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Routing</div>
  127. <a href="#routes" onclick="navigate('routes')" id="nav-routes"
  128. 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">
  129. <div class="flex items-center space-x-2.5">
  130. <svg class="w-4 h-4 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  131. <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" />
  132. </svg>
  133. <span>Routes & Policy</span>
  134. </div>
  135. <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>
  136. </a>
  137. <a href="#bgp" onclick="navigate('bgp')" id="nav-bgp"
  138. 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">
  139. <div class="flex items-center space-x-2.5">
  140. <svg class="w-4 h-4 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  141. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  142. </svg>
  143. <span>BGP (/routing bgp)</span>
  144. </div>
  145. <div class="flex items-center gap-1.5">
  146. <span id="badge-bgp-dot" class="w-2 h-2 rounded-full bg-slate-600" title="BGP Status"></span>
  147. <span id="badge-bgp-count" class="text-[10px] bg-purple-950 text-purple-300 border border-purple-800/40 px-1.5 py-0.2 rounded-full font-mono">0</span>
  148. </div>
  149. </a>
  150. <a href="#ospf" onclick="navigate('ospf')" id="nav-ospf"
  151. 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">
  152. <div class="flex items-center space-x-2.5">
  153. <svg class="w-4 h-4 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  154. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
  155. </svg>
  156. <span>OSPF (/routing ospf)</span>
  157. </div>
  158. <div class="flex items-center gap-1.5">
  159. <span id="badge-ospf-dot" class="w-2 h-2 rounded-full bg-slate-600" title="OSPF Status"></span>
  160. <span id="badge-ospf-count" class="text-[10px] bg-indigo-950 text-indigo-300 border border-indigo-800/40 px-1.5 py-0.2 rounded-full font-mono">0</span>
  161. </div>
  162. </a>
  163. <a href="#routing-filters" onclick="navigate('routing-filters')" id="nav-routing-filters"
  164. 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">
  165. <div class="flex items-center space-x-2.5">
  166. <svg class="w-4 h-4 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  167. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
  168. </svg>
  169. <span>Routing Filters</span>
  170. </div>
  171. <span id="badge-filters-count" class="text-[10px] bg-slate-800 text-slate-300 px-1.5 py-0.2 rounded-full font-mono">0</span>
  172. </a>
  173. <!-- CATEGORY: WAN & ACCESS -->
  174. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">WAN & Access</div>
  175. <a href="#pppoe" onclick="navigate('pppoe')" id="nav-pppoe"
  176. 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">
  177. <div class="flex items-center space-x-2.5">
  178. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  179. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
  180. </svg>
  181. <span>PPPoE Client</span>
  182. </div>
  183. <span id="badge-pppoe-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  184. </a>
  185. <!-- CATEGORY: VPN & TUNNELS -->
  186. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">VPN & Tunnels</div>
  187. <a href="#wireguard" onclick="navigate('wireguard')" id="nav-wireguard"
  188. 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">
  189. <div class="flex items-center space-x-2.5">
  190. <svg class="w-4 h-4 text-rose-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  191. <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" />
  192. </svg>
  193. <span>WireGuard</span>
  194. </div>
  195. <span id="badge-wg-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  196. </a>
  197. <a href="#ipsec" onclick="navigate('ipsec')" id="nav-ipsec"
  198. 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">
  199. <div class="flex items-center space-x-2.5">
  200. <svg class="w-4 h-4 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  201. <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" />
  202. </svg>
  203. <span>IPSec (IKEv2)</span>
  204. </div>
  205. <span id="badge-ipsec-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  206. </a>
  207. <a href="#l2tp" onclick="navigate('l2tp')" id="nav-l2tp"
  208. 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">
  209. <div class="flex items-center space-x-2.5">
  210. <svg class="w-4 h-4 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  211. <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" />
  212. </svg>
  213. <span>L2TP Client</span>
  214. </div>
  215. <span id="badge-l2tp-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  216. </a>
  217. <a href="#pptp" onclick="navigate('pptp')" id="nav-pptp"
  218. 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">
  219. <div class="flex items-center space-x-2.5">
  220. <svg class="w-4 h-4 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  221. <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" />
  222. </svg>
  223. <span>PPTP Client</span>
  224. </div>
  225. <span id="badge-pptp-status" class="w-2 h-2 rounded-full bg-slate-600"></span>
  226. </a>
  227. <a href="#ppp" onclick="navigate('ppp')" id="nav-ppp"
  228. 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">
  229. <div class="flex items-center space-x-2.5">
  230. <svg class="w-4 h-4 text-violet-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  231. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
  232. </svg>
  233. <span>PPP (Servers & Users)</span>
  234. </div>
  235. <span id="badge-ppp-sessions" class="text-[10px] bg-violet-950 text-violet-300 border border-violet-800/40 px-1.5 py-0.2 rounded-full font-mono">0</span>
  236. </a>
  237. <a href="#eoip" onclick="navigate('eoip')" id="nav-eoip"
  238. 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">
  239. <div class="flex items-center space-x-2.5">
  240. <svg class="w-4 h-4 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  241. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" />
  242. </svg>
  243. <span>EoIP Tunnels</span>
  244. </div>
  245. <span id="badge-eoip-count" class="text-[10px] bg-slate-800 text-slate-300 px-1.5 py-0.2 rounded-full font-mono">0</span>
  246. </a>
  247. <!-- CATEGORY: DIAGNOSTICS & TOOLS -->
  248. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">Diagnostics</div>
  249. <a href="#tools" onclick="navigate('tools')" id="nav-tools"
  250. 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">
  251. <div class="flex items-center space-x-2.5">
  252. <svg class="w-4 h-4 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  253. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
  254. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
  255. </svg>
  256. <span>Troubleshoot (/tool)</span>
  257. </div>
  258. <span class="text-[10px] bg-amber-950 text-amber-300 border border-amber-800/40 px-1.5 py-0.2 rounded-full font-mono">Tools</span>
  259. </a>
  260. <!-- CATEGORY: SYSTEM -->
  261. <div class="px-3 pt-3 pb-1 text-[10px] font-bold text-slate-500 uppercase tracking-wider">System</div>
  262. <a href="#persistence" onclick="navigate('persistence')" id="nav-persistence"
  263. 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">
  264. <div class="flex items-center space-x-2.5">
  265. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  266. <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" />
  267. </svg>
  268. <span>Debian Config</span>
  269. </div>
  270. <span class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.2 rounded">.cfg</span>
  271. </a>
  272. </nav>
  273. <!-- Sidebar Footer: Host System Metrics -->
  274. <div class="p-4 border-t border-slate-800/80 bg-slate-900/60">
  275. <div class="flex items-center justify-between text-xs text-slate-400 mb-2">
  276. <span class="truncate font-mono" id="side-hostname">debian-lxc</span>
  277. <span class="text-[11px] text-slate-500" id="side-uptime">0h 0m</span>
  278. </div>
  279. <div class="mb-2">
  280. <div class="flex justify-between text-[11px] text-slate-400 mb-1">
  281. <span>CPU Usage</span>
  282. <span id="side-cpu-val" class="font-mono text-slate-300">0.0%</span>
  283. </div>
  284. <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden">
  285. <div id="side-cpu-bar" class="bg-brand-500 h-full rounded-full transition-all duration-500" style="width: 5%"></div>
  286. </div>
  287. </div>
  288. <div>
  289. <div class="flex justify-between text-[11px] text-slate-400 mb-1">
  290. <span>RAM Usage</span>
  291. <span id="side-ram-val" class="font-mono text-slate-300">0%</span>
  292. </div>
  293. <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden">
  294. <div id="side-ram-bar" class="bg-cyan-500 h-full rounded-full transition-all duration-500" style="width: 25%"></div>
  295. </div>
  296. </div>
  297. </div>
  298. </aside>
  299. <!-- Main Content Area -->
  300. <div class="flex-1 flex flex-col min-w-0 overflow-hidden">
  301. <!-- Top Navbar -->
  302. <header class="h-16 bg-[#0f172a]/80 backdrop-blur border-b border-slate-800 flex items-center justify-between px-6 z-20">
  303. <div class="flex items-center space-x-4">
  304. <button onclick="toggleSidebar()" class="lg:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800">
  305. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  306. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
  307. </svg>
  308. </button>
  309. <div>
  310. <h1 id="page-title" class="text-lg font-bold text-white tracking-tight">Dashboard Overview</h1>
  311. <p id="page-subtitle" class="text-xs text-slate-400">Live router performance and interface management</p>
  312. </div>
  313. </div>
  314. </header>
  315. <!-- Scrollable Main Viewport -->
  316. <main class="flex-1 overflow-y-auto p-6 space-y-6">
  317. <!-- ================= SECTION: DASHBOARD ================= -->
  318. <section id="section-dashboard" class="space-y-6">
  319. <div class="grid grid-cols-1 md:grid-cols-3 gap-5">
  320. <!-- CPU Usage -->
  321. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  322. <div class="flex items-center justify-between mb-3">
  323. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">CPU Usage</span>
  324. <div class="p-2 bg-emerald-500/10 text-emerald-400 rounded-lg">
  325. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  326. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M3 9h2m-2 6h2m14-6h2m-2 6h2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z" />
  327. </svg>
  328. </div>
  329. </div>
  330. <div class="flex items-baseline justify-between">
  331. <div class="flex items-baseline space-x-2">
  332. <span id="dash-cpu-val" class="text-2xl font-bold text-white">0.0%</span>
  333. <span id="dash-cpu-cores" class="text-xs text-slate-400 font-mono">0 Cores</span>
  334. </div>
  335. <span id="dash-cpu-status" class="text-[11px] font-semibold text-emerald-400 uppercase px-2 py-0.5 rounded bg-emerald-500/10">Normal</span>
  336. </div>
  337. <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden my-2.5">
  338. <div id="dash-cpu-bar" class="h-full rounded-full bg-emerald-500 transition-all duration-500" style="width: 0%"></div>
  339. </div>
  340. <div class="text-xs text-slate-400 flex items-center justify-between">
  341. <span>Load: <span id="dash-cpu-load" class="font-mono text-slate-300">0.00, 0.00, 0.00</span></span>
  342. <span class="text-[11px] text-slate-500 font-mono">Container vCPU</span>
  343. </div>
  344. </div>
  345. <!-- RAM Usage -->
  346. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  347. <div class="flex items-center justify-between mb-3">
  348. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">RAM Usage</span>
  349. <div class="p-2 bg-indigo-500/10 text-indigo-400 rounded-lg">
  350. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  351. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
  352. </svg>
  353. </div>
  354. </div>
  355. <div class="flex items-baseline justify-between">
  356. <div class="flex items-baseline space-x-2">
  357. <span id="dash-ram-val" class="text-2xl font-bold text-white">0%</span>
  358. <span id="dash-ram-used-total" class="text-xs text-slate-400 font-mono">0 / 0 MB</span>
  359. </div>
  360. <span id="dash-ram-status" class="text-[11px] font-semibold text-indigo-400 uppercase px-2 py-0.5 rounded bg-indigo-500/10">Active</span>
  361. </div>
  362. <div class="w-full bg-slate-800 h-1.5 rounded-full overflow-hidden my-2.5">
  363. <div id="dash-ram-bar" class="h-full rounded-full bg-indigo-500 transition-all duration-500" style="width: 0%"></div>
  364. </div>
  365. <div class="text-xs text-slate-400 flex items-center justify-between">
  366. <span>Free: <span id="dash-ram-free" class="font-mono text-slate-300">0 MB</span></span>
  367. <span class="text-[11px] text-slate-500 font-mono">Dynamic Alloc</span>
  368. </div>
  369. </div>
  370. <!-- Live Traffic -->
  371. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  372. <div class="flex items-center justify-between mb-3">
  373. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Live Traffic</span>
  374. <div class="p-2 bg-amber-500/10 text-amber-400 rounded-lg">
  375. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  376. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  377. </svg>
  378. </div>
  379. </div>
  380. <div class="space-y-1">
  381. <div class="flex items-center justify-between text-xs">
  382. <span class="text-slate-400 flex items-center gap-1.5"><span class="text-emerald-400 font-bold">↓</span> RX:</span>
  383. <span id="stat-traffic-rx" class="font-mono font-semibold text-emerald-400 text-sm">0 B/s</span>
  384. </div>
  385. <div class="flex items-center justify-between text-xs">
  386. <span class="text-slate-400 flex items-center gap-1.5"><span class="text-cyan-400 font-bold">↑</span> TX:</span>
  387. <span id="stat-traffic-tx" class="font-mono font-semibold text-cyan-400 text-sm">0 B/s</span>
  388. </div>
  389. </div>
  390. <div class="mt-2.5 pt-2 border-t border-slate-800/80 text-[11px] text-slate-500 flex items-center justify-between font-mono">
  391. <span>Throughput</span>
  392. <span class="text-emerald-400 font-semibold flex items-center gap-1"><span class="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"></span> Streaming</span>
  393. </div>
  394. </div>
  395. </div>
  396. <!-- Port Matrix -->
  397. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  398. <div class="flex items-center justify-between mb-4">
  399. <div>
  400. <h3 class="text-sm font-bold text-white uppercase tracking-wider flex items-center gap-2">
  401. <span>Hardware & Virtual Port Matrix</span>
  402. <span class="text-[10px] bg-slate-800 text-slate-400 font-normal px-2 py-0.5 rounded-full">Live Hardware State</span>
  403. </h3>
  404. </div>
  405. </div>
  406. <div id="port-matrix" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3"></div>
  407. </div>
  408. <!-- Quick Overview: Interfaces -->
  409. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  410. <div class="flex items-center justify-between mb-4">
  411. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  412. <span>Interfaces Overview</span>
  413. <span class="text-[10px] bg-slate-800 text-slate-400 font-normal px-2 py-0.5 rounded-full">Active Ports & Addresses</span>
  414. </h3>
  415. <button onclick="navigate('interfaces')" class="text-xs text-brand-400 hover:text-brand-300 font-medium">View All Interfaces →</button>
  416. </div>
  417. <div class="overflow-x-auto">
  418. <table class="w-full text-left text-xs">
  419. <thead class="text-slate-400 border-b border-slate-800 text-[11px] uppercase tracking-wider">
  420. <tr>
  421. <th class="pb-2.5">Interface</th>
  422. <th class="pb-2.5">Role / Type</th>
  423. <th class="pb-2.5">MAC Address</th>
  424. <th class="pb-2.5">IP Address</th>
  425. <th class="pb-2.5">Live Traffic</th>
  426. <th class="pb-2.5 text-right">Status</th>
  427. </tr>
  428. </thead>
  429. <tbody id="quick-interfaces-table" class="divide-y divide-slate-800/60 font-mono"></tbody>
  430. </table>
  431. </div>
  432. </div>
  433. </section>
  434. <!-- ================= SECTION: INTERFACES (HIERARCHICAL TREE) ================= -->
  435. <section id="section-interfaces" class="hidden space-y-6">
  436. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
  437. <div class="relative flex-1 min-w-[280px]">
  438. <div class="absolute inset-y-0 left-0 pl-3.5 flex items-center pointer-events-none text-slate-400">
  439. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  440. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
  441. </svg>
  442. </div>
  443. <input type="text" id="iface-search" oninput="renderInterfacesList()"
  444. placeholder="Search interfaces by Name or IP (e.g. eth0, 192.168.1.1)..."
  445. class="w-full bg-slate-800/90 border border-slate-700 rounded-lg pl-10 pr-4 py-2 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-brand-500 transition">
  446. </div>
  447. <div class="flex items-center space-x-2">
  448. <button onclick="expandAllIfaces(true)" class="text-xs text-cyan-400 hover:text-cyan-300 font-medium px-3 py-2 rounded-lg bg-cyan-950/50 hover:bg-cyan-950 border border-cyan-800/60 transition flex items-center gap-1.5">
  449. <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
  450. <span>Expand All</span>
  451. </button>
  452. <button onclick="expandAllIfaces(false)" class="text-xs text-slate-400 hover:text-slate-300 font-medium px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 transition flex items-center gap-1.5">
  453. <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"/></svg>
  454. <span>Collapse All</span>
  455. </button>
  456. </div>
  457. </div>
  458. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden shadow-2xl">
  459. <div class="p-4 border-b border-slate-800 bg-slate-950/40 flex items-center justify-between">
  460. <div>
  461. <h3 class="text-sm font-bold text-white">Interface Table View</h3>
  462. </div>
  463. <div class="text-xs text-slate-400">
  464. <span id="ifaces-list-summary" class="font-mono">Loading interfaces...</span>
  465. </div>
  466. </div>
  467. <div class="overflow-x-auto">
  468. <table class="w-full text-left text-xs">
  469. <thead class="text-slate-400 bg-slate-950/80 border-b border-slate-800 uppercase tracking-wider text-[11px]">
  470. <tr>
  471. <th class="py-3 px-3 font-semibold w-8 text-center"></th>
  472. <th class="py-3 px-4 font-semibold">Interface / Type</th>
  473. <th class="py-3 px-4 font-semibold">Role & Alias</th>
  474. <th class="py-3 px-4 font-semibold">IP Address (CIDR)</th>
  475. <th class="py-3 px-4 font-semibold">MAC & MTU</th>
  476. <th class="py-3 px-4 font-semibold">Throughput (RX/TX)</th>
  477. <th class="py-3 px-4 font-semibold">Link State</th>
  478. <th class="py-3 px-4 font-semibold text-right">Actions</th>
  479. </tr>
  480. </thead>
  481. <tbody id="interfaces-tree-tbody" class="divide-y divide-slate-800 font-mono"></tbody>
  482. </table>
  483. </div>
  484. <div id="interfaces-empty-state" class="hidden p-12 text-center text-slate-500">
  485. No interfaces found matching your search.
  486. </div>
  487. </div>
  488. </section>
  489. <!-- ================= SECTION: DHCP CLIENT (/ip dhcp-client) ================= -->
  490. <section id="section-dhcp-client" class="hidden space-y-6">
  491. <!-- Top Banner -->
  492. <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">
  493. <div>
  494. <div class="flex items-center gap-2 mb-1">
  495. <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 dhcp-client</span>
  496. <h2 class="text-base font-bold text-white">DHCP Client Configuration</h2>
  497. </div>
  498. <p class="text-xs text-slate-400">RouterOS-style dynamic IP configuration on any physical interface, bridge or VLAN sub-interface.</p>
  499. </div>
  500. <div class="flex items-center gap-2">
  501. <button onclick="openDHCPClientModal()" class="px-4 py-2 rounded-lg font-semibold text-xs bg-amber-500 hover:bg-amber-400 text-slate-950 shadow-lg shadow-amber-500/20 transition flex items-center gap-1.5">
  502. <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>
  503. <span>Add DHCP Client</span>
  504. </button>
  505. <button onclick="loadDHCPClients(true)" class="p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition" title="Refresh Telemetry">
  506. <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 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>
  507. </button>
  508. </div>
  509. </div>
  510. <!-- KPI Summary Cards -->
  511. <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
  512. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  513. <div class="text-xs text-slate-400">Total Configured</div>
  514. <div id="dhcp-stat-total" class="text-xl font-bold text-white font-mono mt-1">0</div>
  515. </div>
  516. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  517. <div class="text-xs text-slate-400">Bound Leases</div>
  518. <div id="dhcp-stat-bound" class="text-xl font-bold text-emerald-400 font-mono mt-1">0</div>
  519. </div>
  520. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  521. <div class="text-xs text-slate-400">Searching / Requesting</div>
  522. <div id="dhcp-stat-searching" class="text-xl font-bold text-amber-400 font-mono mt-1">0</div>
  523. </div>
  524. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  525. <div class="text-xs text-slate-400">Disabled</div>
  526. <div id="dhcp-stat-disabled" class="text-xl font-bold text-slate-500 font-mono mt-1">0</div>
  527. </div>
  528. </div>
  529. <!-- DHCP Clients Table -->
  530. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  531. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  532. <div>
  533. <h3 class="text-xs font-bold text-white">DHCP Client Interfaces</h3>
  534. <p class="text-[11px] text-slate-400 mt-0.5">Active leases, assigned IP addresses, default gateways and lease duration</p>
  535. </div>
  536. </div>
  537. <div class="overflow-x-auto">
  538. <table class="w-full text-left text-xs">
  539. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px]">
  540. <tr>
  541. <th class="py-3 px-4">Interface</th>
  542. <th class="py-3 px-4">Status</th>
  543. <th class="py-3 px-4">IP Address / Netmask</th>
  544. <th class="py-3 px-4">Gateway</th>
  545. <th class="py-3 px-4">DHCP Server</th>
  546. <th class="py-3 px-4">DNS Servers</th>
  547. <th class="py-3 px-4">Expires In</th>
  548. <th class="py-3 px-4">Options</th>
  549. <th class="py-3 px-4 text-right">Actions</th>
  550. </tr>
  551. </thead>
  552. <tbody id="dhcp-clients-tbody" class="divide-y divide-slate-800 font-mono"></tbody>
  553. </table>
  554. </div>
  555. <div id="dhcp-clients-empty" class="hidden p-12 text-center text-slate-500">
  556. <div class="text-3xl mb-2">⚡</div>
  557. <div class="font-semibold text-slate-400 text-sm">No DHCP Clients Configured</div>
  558. <div class="text-xs mt-1 text-slate-500">Click &ldquo;Add DHCP Client&rdquo; to automatically obtain an IP on any interface.</div>
  559. </div>
  560. </div>
  561. </section>
  562. <!-- ================= SECTION: BRIDGE (/interface bridge) ================= -->
  563. <section id="section-bridge" class="hidden space-y-6">
  564. <!-- Bridge Navigation Header -->
  565. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
  566. <div class="flex items-center space-x-3">
  567. <div class="p-2.5 rounded-lg bg-sky-500/10 border border-sky-500/20 text-sky-400">
  568. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  569. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M3 14h18M5 14v4a2 2 0 002 2h2a2 2 0 002-2v-4m6 0v4a2 2 0 002 2h2a2 2 0 002-2v-4M4 10V6a2 2 0 012-2h12a2 2 0 012 2v4" />
  570. </svg>
  571. </div>
  572. <div>
  573. <div class="flex items-center gap-2">
  574. <h2 class="text-base font-bold text-white">Bridge Interfaces</h2>
  575. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-sky-500/20 text-sky-300 border border-sky-500/30 font-semibold">IEEE 802.1D / 802.1Q</span>
  576. </div>
  577. <p class="text-xs text-slate-400">MikroTik RouterOS style bridge with RSTP, VLAN filtering, split-horizon port isolation & dynamic host MAC forwarding table.</p>
  578. </div>
  579. </div>
  580. <div class="flex items-center space-x-3">
  581. <button id="bridge-top-action-btn" onclick="openCurrentBridgeModal()" class="flex items-center space-x-2 bg-gradient-to-r from-sky-600 to-cyan-600 hover:from-sky-500 hover:to-cyan-500 text-white font-semibold text-xs px-4 py-2.5 rounded-lg shadow-lg shadow-sky-500/20 transition">
  582. <span>+ Add Bridge</span>
  583. </button>
  584. </div>
  585. </div>
  586. <!-- Bridge Subtabs Nav -->
  587. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl overflow-hidden p-1 flex flex-wrap items-center justify-between gap-2">
  588. <div class="flex items-center space-x-1">
  589. <button id="bridge-subtab-btn-bridges" onclick="switchBridgeSubTab('bridges')" class="px-4 py-2 text-xs font-bold rounded-lg bg-slate-800 text-white shadow-sm transition flex items-center gap-2">
  590. <span>Bridges</span>
  591. <span id="bridge-badge-bridges" class="px-1.5 py-0.2 rounded text-[10px] bg-sky-950 text-sky-300 border border-sky-800/40">0</span>
  592. </button>
  593. <button id="bridge-subtab-btn-ports" onclick="switchBridgeSubTab('ports')" class="px-4 py-2 text-xs font-bold rounded-lg text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
  594. <span>Ports</span>
  595. <span id="bridge-badge-ports" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  596. </button>
  597. <button id="bridge-subtab-btn-vlans" onclick="switchBridgeSubTab('vlans')" class="px-4 py-2 text-xs font-bold rounded-lg text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
  598. <span>VLANs</span>
  599. <span id="bridge-badge-vlans" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  600. </button>
  601. <button id="bridge-subtab-btn-hosts" onclick="switchBridgeSubTab('hosts')" class="px-4 py-2 text-xs font-bold rounded-lg text-slate-400 hover:text-slate-200 transition flex items-center gap-2">
  602. <span>Hosts (MAC Table)</span>
  603. <span id="bridge-badge-hosts" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  604. </button>
  605. </div>
  606. <!-- Stats Bar -->
  607. <div class="flex items-center space-x-4 px-3 text-xs font-mono text-slate-400">
  608. <div>Bridges: <span id="bridge-stat-bridges" class="font-bold text-white">0</span></div>
  609. <div>Ports: <span id="bridge-stat-ports" class="font-bold text-sky-400">0</span></div>
  610. <div>Learned MACs: <span id="bridge-stat-hosts" class="font-bold text-emerald-400">0</span></div>
  611. </div>
  612. </div>
  613. <!-- ================= SUBTAB 1: BRIDGES ================= -->
  614. <div id="bridge-subtab-bridges" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  615. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  616. <h3 class="text-sm font-bold text-white">Configured Bridges</h3>
  617. <span id="bridge-count-badge" class="text-xs font-mono text-slate-400">0 Bridges</span>
  618. </div>
  619. <div class="overflow-x-auto">
  620. <table class="w-full text-left text-xs font-mono">
  621. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  622. <tr>
  623. <th class="py-2.5 px-3 w-10 text-center">#</th>
  624. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  625. <th class="py-2.5 px-3">Name</th>
  626. <th class="py-2.5 px-3">MTU</th>
  627. <th class="py-2.5 px-3">MAC Address</th>
  628. <th class="py-2.5 px-3">STP</th>
  629. <th class="py-2.5 px-3">VLAN Filtering</th>
  630. <th class="py-2.5 px-3">PVID</th>
  631. <th class="py-2.5 px-3">Ports</th>
  632. <th class="py-2.5 px-3">IP Addresses</th>
  633. <th class="py-2.5 px-3">Traffic</th>
  634. <th class="py-2.5 px-3">Comment</th>
  635. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  636. </tr>
  637. </thead>
  638. <tbody id="bridge-table-body" class="divide-y divide-slate-800/80"></tbody>
  639. </table>
  640. </div>
  641. <div id="bridge-empty-bridges" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  642. No bridge interfaces configured. Click "+ Add Bridge" to create one.
  643. </div>
  644. </div>
  645. <!-- ================= SUBTAB 2: PORTS ================= -->
  646. <div id="bridge-subtab-ports" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  647. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  648. <div class="flex items-center gap-3">
  649. <h3 class="text-sm font-bold text-white">Bridge Ports</h3>
  650. <span id="bridge-ports-count-badge" class="text-xs font-mono text-slate-400">0 Ports</span>
  651. </div>
  652. <div class="flex items-center space-x-2">
  653. <label class="text-xs text-slate-400">Filter Bridge:</label>
  654. <select id="bridge-ports-filter-bridge" onchange="renderBridgePorts()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white">
  655. <option value="">All Bridges</option>
  656. </select>
  657. </div>
  658. </div>
  659. <div class="overflow-x-auto">
  660. <table class="w-full text-left text-xs font-mono">
  661. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  662. <tr>
  663. <th class="py-2.5 px-3 w-10 text-center">#</th>
  664. <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled">Flag</th>
  665. <th class="py-2.5 px-3">Interface</th>
  666. <th class="py-2.5 px-3">Bridge</th>
  667. <th class="py-2.5 px-3">PVID</th>
  668. <th class="py-2.5 px-3">Frame Types</th>
  669. <th class="py-2.5 px-3">Ingress Filter</th>
  670. <th class="py-2.5 px-3">Horizon</th>
  671. <th class="py-2.5 px-3">Role / Status</th>
  672. <th class="py-2.5 px-3">Comment</th>
  673. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  674. </tr>
  675. </thead>
  676. <tbody id="bridge-ports-table-body" class="divide-y divide-slate-800/80"></tbody>
  677. </table>
  678. </div>
  679. <div id="bridge-empty-ports" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  680. No bridge ports configured. Click "+ Add Port" to attach a physical NIC, VLAN or EoIP tunnel.
  681. </div>
  682. </div>
  683. <!-- ================= SUBTAB 3: VLANS ================= -->
  684. <div id="bridge-subtab-vlans" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  685. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  686. <div class="flex items-center gap-3">
  687. <h3 class="text-sm font-bold text-white">Bridge VLAN Filtering Table</h3>
  688. <span id="bridge-vlans-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
  689. </div>
  690. <div class="flex items-center space-x-2">
  691. <label class="text-xs text-slate-400">Filter Bridge:</label>
  692. <select id="bridge-vlans-filter-bridge" onchange="renderBridgeVLANs()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white">
  693. <option value="">All Bridges</option>
  694. </select>
  695. </div>
  696. </div>
  697. <div class="overflow-x-auto">
  698. <table class="w-full text-left text-xs font-mono">
  699. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  700. <tr>
  701. <th class="py-2.5 px-3 w-10 text-center">#</th>
  702. <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled">Flag</th>
  703. <th class="py-2.5 px-3">Bridge</th>
  704. <th class="py-2.5 px-3">VLAN IDs</th>
  705. <th class="py-2.5 px-3">Tagged Member Ports</th>
  706. <th class="py-2.5 px-3">Untagged Member Ports</th>
  707. <th class="py-2.5 px-3">Comment</th>
  708. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  709. </tr>
  710. </thead>
  711. <tbody id="bridge-vlans-table-body" class="divide-y divide-slate-800/80"></tbody>
  712. </table>
  713. </div>
  714. <div id="bridge-empty-vlans" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  715. No bridge VLAN filtering entries configured. Click "+ Add VLAN Entry" to configure 802.1Q tagged ports.
  716. </div>
  717. </div>
  718. <!-- ================= SUBTAB 4: HOSTS (MAC TABLE) ================= -->
  719. <div id="bridge-subtab-hosts" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  720. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  721. <div class="flex items-center gap-3">
  722. <h3 class="text-sm font-bold text-white">Forwarding Database (MAC Table)</h3>
  723. <span id="bridge-hosts-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
  724. </div>
  725. <div class="flex items-center space-x-2">
  726. <input type="text" id="bridge-hosts-search" oninput="renderBridgeHosts()" placeholder="Search MAC or Interface..." class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white">
  727. <select id="bridge-hosts-filter-bridge" onchange="loadBridgeHosts()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-xs text-white">
  728. <option value="">All Bridges</option>
  729. </select>
  730. <button onclick="loadBridgeHosts()" class="px-2.5 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-xs font-semibold text-slate-200 border border-slate-700">🔄 Refresh</button>
  731. <button onclick="flushBridgeHosts()" class="px-2.5 py-1 rounded-lg bg-rose-950/60 hover:bg-rose-900/80 text-rose-300 border border-rose-800/40 text-xs font-semibold">🗑️ Flush Dynamic</button>
  732. </div>
  733. </div>
  734. <div class="overflow-x-auto">
  735. <table class="w-full text-left text-xs font-mono">
  736. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  737. <tr>
  738. <th class="py-2.5 px-3">MAC Address</th>
  739. <th class="py-2.5 px-3">Interface / Port</th>
  740. <th class="py-2.5 px-3">Bridge</th>
  741. <th class="py-2.5 px-3">VLAN</th>
  742. <th class="py-2.5 px-3">Age (s)</th>
  743. <th class="py-2.5 px-3">Flags (L=Local, S=Static, D=Dynamic)</th>
  744. </tr>
  745. </thead>
  746. <tbody id="bridge-hosts-table-body" class="divide-y divide-slate-800/80"></tbody>
  747. </table>
  748. </div>
  749. <div id="bridge-empty-hosts" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  750. No MAC addresses learned in the forwarding database.
  751. </div>
  752. </div>
  753. </section>
  754. <!-- ================= SECTION: PPPoE CLIENTS (MikroTik style) ================= -->
  755. <section id="section-pppoe" class="hidden space-y-6">
  756. <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">
  757. <div>
  758. <div class="flex items-center gap-2 mb-1">
  759. <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>
  760. <h2 class="text-base font-bold text-white">PPPoE Client Sessions</h2>
  761. </div>
  762. <p class="text-xs text-slate-400">Manage multiple Point-to-Point Protocol over Ethernet WAN connections (MikroTik RouterOS style).</p>
  763. </div>
  764. <div class="flex items-center gap-2">
  765. <button onclick="navigate('ppp'); switchPPPSubTab('pppoe')" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-blue-300 border border-blue-900/40 transition flex items-center gap-1.5" title="Configure Router as PPPoE Access Concentrator Server">
  766. <span>⚙ Server Settings</span>
  767. </button>
  768. <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">
  769. <span>+ Add PPPoE Client</span>
  770. </button>
  771. </div>
  772. </div>
  773. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  774. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  775. <h3 class="text-sm font-bold text-white">Configured PPPoE Interfaces</h3>
  776. <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>
  777. </div>
  778. <div class="overflow-x-auto">
  779. <table class="w-full text-left text-xs font-mono">
  780. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  781. <tr>
  782. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  783. <th class="py-2.5 px-3">Name</th>
  784. <th class="py-2.5 px-3">Interface</th>
  785. <th class="py-2.5 px-3">User</th>
  786. <th class="py-2.5 px-3">Assigned IP</th>
  787. <th class="py-2.5 px-3">Device</th>
  788. <th class="py-2.5 px-3 text-center">Def. Route</th>
  789. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  790. </tr>
  791. </thead>
  792. <tbody id="pppoe-table-body" class="divide-y divide-slate-800/80"></tbody>
  793. </table>
  794. </div>
  795. <div id="pppoe-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  796. No PPPoE clients configured. Click "+ Add PPPoE Client" to add a connection.
  797. </div>
  798. </div>
  799. </section>
  800. <!-- ================= SECTION: WIREGUARD (MikroTik style) ================= -->
  801. <section id="section-wireguard" class="hidden space-y-6">
  802. <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">
  803. <div>
  804. <div class="flex items-center gap-2 mb-1">
  805. <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>
  806. <h2 class="text-base font-bold text-white">WireGuard VPN Suite</h2>
  807. </div>
  808. <p class="text-xs text-slate-400">High-performance multi-interface WireGuard server and peer controller (MikroTik RouterOS v7 style).</p>
  809. </div>
  810. <div class="flex items-center space-x-2.5">
  811. <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">
  812. + Add Interface
  813. </button>
  814. <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">
  815. + Add Peer
  816. </button>
  817. </div>
  818. </div>
  819. <!-- Sub Tabs: Interfaces / Peers -->
  820. <div class="flex border-b border-slate-800 space-x-2">
  821. <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">
  822. <span>Interfaces</span>
  823. <span id="wg-subtab-badge-ifaces" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  824. </button>
  825. <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">
  826. <span>Peers</span>
  827. <span id="wg-subtab-badge-peers" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  828. </button>
  829. </div>
  830. <!-- Sub-Tab 1: Interfaces -->
  831. <div id="wg-subtab-ifaces" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  832. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  833. <h3 class="text-sm font-bold text-white">WireGuard Interfaces</h3>
  834. <span id="wg-ifaces-count" class="text-xs font-mono text-slate-400">0 Interfaces</span>
  835. </div>
  836. <div class="overflow-x-auto">
  837. <table class="w-full text-left text-xs font-mono">
  838. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  839. <tr>
  840. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  841. <th class="py-2.5 px-3">Name</th>
  842. <th class="py-2.5 px-3">Listen Port</th>
  843. <th class="py-2.5 px-3">Tunnel Address</th>
  844. <th class="py-2.5 px-3">Public Key</th>
  845. <th class="py-2.5 px-3">MTU</th>
  846. <th class="py-2.5 px-3 text-center">Peers</th>
  847. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  848. </tr>
  849. </thead>
  850. <tbody id="wg-ifaces-table-body" class="divide-y divide-slate-800/80"></tbody>
  851. </table>
  852. </div>
  853. <div id="wg-ifaces-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  854. No WireGuard interfaces configured. Click "+ Add Interface" to create wg0.
  855. </div>
  856. </div>
  857. <!-- Sub-Tab 2: Peers -->
  858. <div id="wg-subtab-peers" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  859. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  860. <div class="flex items-center gap-3">
  861. <h3 class="text-sm font-bold text-white">WireGuard Peers</h3>
  862. <span id="wg-peers-count" class="text-xs font-mono text-slate-400">0 Peers</span>
  863. </div>
  864. <div class="flex items-center gap-2">
  865. <label class="text-xs text-slate-400 font-sans">Filter Interface:</label>
  866. <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">
  867. <option value="">All Interfaces</option>
  868. </select>
  869. </div>
  870. </div>
  871. <div class="overflow-x-auto">
  872. <table class="w-full text-left text-xs font-mono">
  873. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  874. <tr>
  875. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Active, X=Disabled">Flag</th>
  876. <th class="py-2.5 px-3">Interface</th>
  877. <th class="py-2.5 px-3">Peer Name</th>
  878. <th class="py-2.5 px-3">Public Key</th>
  879. <th class="py-2.5 px-3">Allowed IPs</th>
  880. <th class="py-2.5 px-3">Endpoint</th>
  881. <th class="py-2.5 px-3">Latest Handshake</th>
  882. <th class="py-2.5 px-3">Traffic (RX/TX)</th>
  883. <th class="py-2.5 px-3 text-right font-sans">Action</th>
  884. </tr>
  885. </thead>
  886. <tbody id="wg-peers-table-body" class="divide-y divide-slate-800/80"></tbody>
  887. </table>
  888. </div>
  889. <div id="wg-peers-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  890. No peers found for the selected interface. Click "+ Add Peer" to add a client or branch.
  891. </div>
  892. </div>
  893. </section>
  894. <!-- ================= SECTION: IPSEC (MikroTik style) ================= -->
  895. <section id="section-ipsec" class="hidden space-y-6">
  896. <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">
  897. <div>
  898. <div class="flex items-center gap-2 mb-1">
  899. <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>
  900. <h2 class="text-base font-bold text-white">IPSec (IKEv2) Tunnels</h2>
  901. </div>
  902. <p class="text-xs text-slate-400">Enterprise strongSwan 6 Site-to-Site and Remote Gateway connections.</p>
  903. </div>
  904. <div class="flex items-center gap-2">
  905. <button onclick="openIPSecServerModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-amber-300 border border-amber-900/40 transition flex items-center gap-1.5" title="Configure Router as IPSec IKEv2 Roadwarrior Mobile Client Server">
  906. <span>⚙ Roadwarrior Server</span>
  907. </button>
  908. <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">
  909. + Add IPSec Tunnel
  910. </button>
  911. </div>
  912. </div>
  913. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  914. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  915. <h3 class="text-sm font-bold text-white">Configured IPSec Tunnels</h3>
  916. <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>
  917. </div>
  918. <div class="overflow-x-auto">
  919. <table class="w-full text-left text-xs font-mono">
  920. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  921. <tr>
  922. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Established, X=Disabled">Flag</th>
  923. <th class="py-2.5 px-4">Connection Name</th>
  924. <th class="py-2.5 px-4">Local Subnet</th>
  925. <th class="py-2.5 px-4">Remote Gateway</th>
  926. <th class="py-2.5 px-4">Remote Subnet</th>
  927. <th class="py-2.5 px-4">Status</th>
  928. <th class="py-2.5 px-4 text-right font-sans">Actions</th>
  929. </tr>
  930. </thead>
  931. <tbody id="ipsec-table-body" class="divide-y divide-slate-800"></tbody>
  932. </table>
  933. </div>
  934. <div id="ipsec-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  935. No IPSec tunnels configured. Click "+ Add IPSec Tunnel" to set up site-to-site networking.
  936. </div>
  937. </div>
  938. </section>
  939. <!-- ================= SECTION: L2TP CLIENT (MikroTik style) ================= -->
  940. <section id="section-l2tp" class="hidden space-y-6">
  941. <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">
  942. <div>
  943. <div class="flex items-center gap-2 mb-1">
  944. <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>
  945. <h2 class="text-base font-bold text-white">L2TP Client Sessions</h2>
  946. </div>
  947. <p class="text-xs text-slate-400">Multiple Layer 2 Tunneling Protocol clients with optional IPSec PSK encryption.</p>
  948. </div>
  949. <div class="flex items-center gap-2">
  950. <button onclick="navigate('ppp'); switchPPPSubTab('l2tp')" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-cyan-300 border border-cyan-900/40 transition flex items-center gap-1.5" title="Configure Router as L2TP Server">
  951. <span>⚙ Server Settings</span>
  952. </button>
  953. <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">
  954. + Add L2TP Client
  955. </button>
  956. </div>
  957. </div>
  958. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  959. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  960. <h3 class="text-sm font-bold text-white">Configured L2TP Clients</h3>
  961. <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>
  962. </div>
  963. <div class="overflow-x-auto">
  964. <table class="w-full text-left text-xs font-mono">
  965. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  966. <tr>
  967. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  968. <th class="py-2.5 px-3">Name</th>
  969. <th class="py-2.5 px-3">Server Address</th>
  970. <th class="py-2.5 px-3">User</th>
  971. <th class="py-2.5 px-3">Assigned IP</th>
  972. <th class="py-2.5 px-3">Device</th>
  973. <th class="py-2.5 px-3 text-center">Def. Route</th>
  974. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  975. </tr>
  976. </thead>
  977. <tbody id="l2tp-table-body" class="divide-y divide-slate-800/80"></tbody>
  978. </table>
  979. </div>
  980. <div id="l2tp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  981. No L2TP clients configured. Click "+ Add L2TP Client" to add a tunnel.
  982. </div>
  983. </div>
  984. </section>
  985. <!-- ================= SECTION: PPTP CLIENT (MikroTik style) ================= -->
  986. <section id="section-pptp" class="hidden space-y-6">
  987. <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">
  988. <div>
  989. <div class="flex items-center gap-2 mb-1">
  990. <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>
  991. <h2 class="text-base font-bold text-white">PPTP Client Sessions</h2>
  992. </div>
  993. <p class="text-xs text-slate-400">Multiple Point-to-Point Tunneling Protocol clients with MPPE-128 encryption.</p>
  994. </div>
  995. <div class="flex items-center gap-2">
  996. <button onclick="navigate('ppp'); switchPPPSubTab('pptp')" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-purple-300 border border-purple-900/40 transition flex items-center gap-1.5" title="Configure Router as PPTP Server">
  997. <span>⚙ Server Settings</span>
  998. </button>
  999. <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">
  1000. + Add PPTP Client
  1001. </button>
  1002. </div>
  1003. </div>
  1004. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1005. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1006. <h3 class="text-sm font-bold text-white">Configured PPTP Clients</h3>
  1007. <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>
  1008. </div>
  1009. <div class="overflow-x-auto">
  1010. <table class="w-full text-left text-xs font-mono">
  1011. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1012. <tr>
  1013. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  1014. <th class="py-2.5 px-3">Name</th>
  1015. <th class="py-2.5 px-3">Server Address</th>
  1016. <th class="py-2.5 px-3">User</th>
  1017. <th class="py-2.5 px-3">Assigned IP</th>
  1018. <th class="py-2.5 px-3">Device</th>
  1019. <th class="py-2.5 px-3 text-center">MPPE</th>
  1020. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1021. </tr>
  1022. </thead>
  1023. <tbody id="pptp-table-body" class="divide-y divide-slate-800/80"></tbody>
  1024. </table>
  1025. </div>
  1026. <div id="pptp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1027. No PPTP clients configured. Click "+ Add PPTP Client" to add a tunnel.
  1028. </div>
  1029. </div>
  1030. </section>
  1031. <!-- ================= SECTION: PPP SERVERS & SECRETS (/ppp) ================= -->
  1032. <section id="section-ppp" class="hidden space-y-6">
  1033. <div class="bg-gradient-to-r from-violet-950/40 via-slate-900 to-slate-900 border border-violet-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  1034. <div>
  1035. <div class="flex items-center gap-2 mb-1">
  1036. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-violet-500/20 text-violet-300 border border-violet-500/30 font-semibold">/ppp</span>
  1037. <h2 class="text-base font-bold text-white">PPP Servers, Secrets & Profiles</h2>
  1038. </div>
  1039. <p class="text-xs text-slate-400">MikroTik RouterOS centralized user authentication database, IP pools and VPN server concentrators.</p>
  1040. </div>
  1041. <div class="flex items-center space-x-2.5">
  1042. <button id="ppp-primary-add-btn" onclick="openCurrentPPPModal()" class="text-xs font-semibold px-4 py-2 rounded-lg bg-violet-600 hover:bg-violet-500 text-white shadow-lg shadow-violet-500/20 transition flex items-center gap-1.5">
  1043. <span>+ Add User (Secret)</span>
  1044. </button>
  1045. </div>
  1046. </div>
  1047. <!-- Sub Tabs: Secrets / Profiles / PPPoE Server / PPTP Server / L2TP Server / Active Sessions -->
  1048. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  1049. <button id="ppp-subtab-btn-secrets" onclick="switchPPPSubTab('secrets')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-violet-500 text-white transition flex items-center gap-2 whitespace-nowrap">
  1050. <span>Secrets (Users)</span>
  1051. <span id="ppp-badge-secrets" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1052. </button>
  1053. <button id="ppp-subtab-btn-profiles" onclick="switchPPPSubTab('profiles')" 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">
  1054. <span>Profiles (Pools)</span>
  1055. <span id="ppp-badge-profiles" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1056. </button>
  1057. <button id="ppp-subtab-btn-pppoe" onclick="switchPPPSubTab('pppoe')" 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">
  1058. <span>PPPoE Server</span>
  1059. <span id="ppp-badge-pppoe-state" class="w-2 h-2 rounded-full bg-slate-600"></span>
  1060. </button>
  1061. <button id="ppp-subtab-btn-pptp" onclick="switchPPPSubTab('pptp')" 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">
  1062. <span>PPTP Server</span>
  1063. <span id="ppp-badge-pptp-state" class="w-2 h-2 rounded-full bg-slate-600"></span>
  1064. </button>
  1065. <button id="ppp-subtab-btn-l2tp" onclick="switchPPPSubTab('l2tp')" 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">
  1066. <span>L2TP Server</span>
  1067. <span id="ppp-badge-l2tp-state" class="w-2 h-2 rounded-full bg-slate-600"></span>
  1068. </button>
  1069. <button id="ppp-subtab-btn-active" onclick="switchPPPSubTab('active')" 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">
  1070. <span>Active Sessions</span>
  1071. <span id="ppp-badge-active" class="px-1.5 py-0.2 rounded text-[10px] bg-emerald-950 text-emerald-400 border border-emerald-800/40">0</span>
  1072. </button>
  1073. </div>
  1074. <!-- TAB 1: SECRETS (USERS) -->
  1075. <div id="ppp-subtab-secrets" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1076. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1077. <h3 class="text-sm font-bold text-white">PPP Secrets (/ppp secret)</h3>
  1078. <span id="secrets-count-badge" class="text-xs font-mono text-slate-400">0 Users</span>
  1079. </div>
  1080. <div class="overflow-x-auto">
  1081. <table class="w-full text-left text-xs font-mono">
  1082. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1083. <tr>
  1084. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1085. <th class="py-2.5 px-3">Name (Username)</th>
  1086. <th class="py-2.5 px-3">Service</th>
  1087. <th class="py-2.5 px-3">Profile</th>
  1088. <th class="py-2.5 px-3">Local Address</th>
  1089. <th class="py-2.5 px-3">Remote Address</th>
  1090. <th class="py-2.5 px-3">Comment</th>
  1091. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1092. </tr>
  1093. </thead>
  1094. <tbody id="secrets-table-body" class="divide-y divide-slate-800/80"></tbody>
  1095. </table>
  1096. </div>
  1097. <div id="secrets-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1098. No PPP secrets configured. Click "+ Add User" to define an account.
  1099. </div>
  1100. </div>
  1101. <!-- TAB 2: PROFILES (POOLS) -->
  1102. <div id="ppp-subtab-profiles" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1103. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1104. <h3 class="text-sm font-bold text-white">PPP Profiles (/ppp profile)</h3>
  1105. <span id="profiles-count-badge" class="text-xs font-mono text-slate-400">0 Profiles</span>
  1106. </div>
  1107. <div class="overflow-x-auto">
  1108. <table class="w-full text-left text-xs font-mono">
  1109. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1110. <tr>
  1111. <th class="py-2.5 px-3">Profile Name</th>
  1112. <th class="py-2.5 px-3">Local Address</th>
  1113. <th class="py-2.5 px-3">Remote Address (Pool)</th>
  1114. <th class="py-2.5 px-3">DNS Servers</th>
  1115. <th class="py-2.5 px-3">Encryption</th>
  1116. <th class="py-2.5 px-3 text-center">Only One</th>
  1117. <th class="py-2.5 px-3">Comment</th>
  1118. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1119. </tr>
  1120. </thead>
  1121. <tbody id="profiles-table-body" class="divide-y divide-slate-800/80"></tbody>
  1122. </table>
  1123. </div>
  1124. </div>
  1125. <!-- TAB 3: PPPoE SERVER -->
  1126. <div id="ppp-subtab-pppoe" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl p-6">
  1127. <form onsubmit="savePPPoEServerConfig(event)" class="max-w-2xl space-y-5">
  1128. <div class="flex items-center justify-between border-b border-slate-800 pb-4">
  1129. <div>
  1130. <h3 class="text-sm font-bold text-white">PPPoE Access Concentrator Server</h3>
  1131. <p class="text-xs text-slate-400">Listens on physical interface or VLAN for PPPoE Discovery (PADI) packets</p>
  1132. </div>
  1133. <div class="flex items-center gap-3">
  1134. <span id="pppoe-server-status-pill" class="px-2 py-0.5 rounded text-[10px] font-mono font-semibold bg-slate-800 text-slate-400">STOPPED</span>
  1135. <label class="relative inline-flex items-center cursor-pointer">
  1136. <input type="checkbox" id="pppoe-server-enabled" class="sr-only peer">
  1137. <div class="w-11 h-6 bg-slate-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
  1138. </label>
  1139. </div>
  1140. </div>
  1141. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs font-sans">
  1142. <div>
  1143. <label class="block text-slate-300 font-medium mb-1">Service Name</label>
  1144. <input type="text" id="pppoe-server-name" placeholder="proxmox-pppoe" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1145. </div>
  1146. <div>
  1147. <label class="block text-slate-300 font-medium mb-1">Listen Interface</label>
  1148. <select id="pppoe-server-iface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  1149. </div>
  1150. <div>
  1151. <label class="block text-slate-300 font-medium mb-1">Default Profile</label>
  1152. <select id="pppoe-server-profile" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  1153. </div>
  1154. <div>
  1155. <label class="block text-slate-300 font-medium mb-1">Max MTU / MRU</label>
  1156. <input type="number" id="pppoe-server-mtu" value="1480" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1157. </div>
  1158. </div>
  1159. <div class="flex items-center space-x-2 pt-2">
  1160. <input type="checkbox" id="pppoe-server-onesession" class="rounded bg-slate-800 border-slate-700 text-blue-600">
  1161. <label for="pppoe-server-onesession" class="text-xs text-slate-300">One Session Per Host (limit 1 PPPoE session per client MAC)</label>
  1162. </div>
  1163. <div class="pt-4 border-t border-slate-800 flex justify-end">
  1164. <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 transition">
  1165. Apply PPPoE Server Settings
  1166. </button>
  1167. </div>
  1168. </form>
  1169. </div>
  1170. <!-- TAB 4: PPTP SERVER -->
  1171. <div id="ppp-subtab-pptp" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl p-6">
  1172. <form onsubmit="savePPTPServerConfig(event)" class="max-w-2xl space-y-5">
  1173. <div class="flex items-center justify-between border-b border-slate-800 pb-4">
  1174. <div>
  1175. <h3 class="text-sm font-bold text-white">PPTP Server (/interface pptp-server server)</h3>
  1176. <p class="text-xs text-slate-400">Point-to-Point Tunneling Server listening on TCP port 1723 with MPPE-128 encryption</p>
  1177. </div>
  1178. <div class="flex items-center gap-3">
  1179. <span id="pptp-server-status-pill" class="px-2 py-0.5 rounded text-[10px] font-mono font-semibold bg-slate-800 text-slate-400">STOPPED</span>
  1180. <label class="relative inline-flex items-center cursor-pointer">
  1181. <input type="checkbox" id="pptp-server-enabled" class="sr-only peer">
  1182. <div class="w-11 h-6 bg-slate-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-purple-600"></div>
  1183. </label>
  1184. </div>
  1185. </div>
  1186. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs font-sans">
  1187. <div>
  1188. <label class="block text-slate-300 font-medium mb-1">Port</label>
  1189. <input type="number" id="pptp-server-port" value="1723" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1190. </div>
  1191. <div>
  1192. <label class="block text-slate-300 font-medium mb-1">Default Profile</label>
  1193. <select id="pptp-server-profile" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  1194. </div>
  1195. </div>
  1196. <div class="flex items-center space-x-2 pt-2">
  1197. <input type="checkbox" id="pptp-server-mppe" checked class="rounded bg-slate-800 border-slate-700 text-purple-600">
  1198. <label for="pptp-server-mppe" class="text-xs text-slate-300">Require 128-bit MPPE Encryption (MS-CHAPv2)</label>
  1199. </div>
  1200. <div class="pt-4 border-t border-slate-800 flex justify-end">
  1201. <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 transition">
  1202. Apply PPTP Server Settings
  1203. </button>
  1204. </div>
  1205. </form>
  1206. </div>
  1207. <!-- TAB 5: L2TP SERVER -->
  1208. <div id="ppp-subtab-l2tp" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl p-6">
  1209. <form onsubmit="saveL2TPServerConfig(event)" class="max-w-2xl space-y-5">
  1210. <div class="flex items-center justify-between border-b border-slate-800 pb-4">
  1211. <div>
  1212. <h3 class="text-sm font-bold text-white">L2TP Server (/interface l2tp-server server)</h3>
  1213. <p class="text-xs text-slate-400">Layer 2 Tunneling Protocol Server listening on UDP port 1701 with optional IPSec</p>
  1214. </div>
  1215. <div class="flex items-center gap-3">
  1216. <span id="l2tp-server-status-pill" class="px-2 py-0.5 rounded text-[10px] font-mono font-semibold bg-slate-800 text-slate-400">STOPPED</span>
  1217. <label class="relative inline-flex items-center cursor-pointer">
  1218. <input type="checkbox" id="l2tp-server-enabled" class="sr-only peer">
  1219. <div class="w-11 h-6 bg-slate-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-cyan-600"></div>
  1220. </label>
  1221. </div>
  1222. </div>
  1223. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs font-sans">
  1224. <div>
  1225. <label class="block text-slate-300 font-medium mb-1">Port</label>
  1226. <input type="number" id="l2tp-server-port" value="1701" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1227. </div>
  1228. <div>
  1229. <label class="block text-slate-300 font-medium mb-1">Default Profile</label>
  1230. <select id="l2tp-server-profile" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  1231. </div>
  1232. <div>
  1233. <label class="block text-slate-300 font-medium mb-1">Use IPSec</label>
  1234. <select id="l2tp-server-useipsec" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1235. <option value="no">no</option>
  1236. <option value="yes">yes</option>
  1237. <option value="required">required</option>
  1238. </select>
  1239. </div>
  1240. <div>
  1241. <label class="block text-slate-300 font-medium mb-1">IPSec Secret (PSK)</label>
  1242. <input type="password" id="l2tp-server-ipsecsecret" placeholder="Optional Pre-Shared Key" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  1243. </div>
  1244. </div>
  1245. <div class="pt-4 border-t border-slate-800 flex justify-end">
  1246. <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 transition">
  1247. Apply L2TP Server Settings
  1248. </button>
  1249. </div>
  1250. </form>
  1251. </div>
  1252. <!-- TAB 6: ACTIVE SESSIONS -->
  1253. <div id="ppp-subtab-active" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1254. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1255. <h3 class="text-sm font-bold text-white">Active PPP Connections (/ppp active)</h3>
  1256. <button onclick="loadPPPSessions()" class="text-xs text-slate-400 hover:text-white px-2 py-1 rounded bg-slate-800">Refresh</button>
  1257. </div>
  1258. <div class="overflow-x-auto">
  1259. <table class="w-full text-left text-xs font-mono">
  1260. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1261. <tr>
  1262. <th class="py-2.5 px-3">Interface</th>
  1263. <th class="py-2.5 px-3">Username</th>
  1264. <th class="py-2.5 px-3">Service</th>
  1265. <th class="py-2.5 px-3">Client IP Address</th>
  1266. <th class="py-2.5 px-3">Uptime</th>
  1267. <th class="py-2.5 px-3">RX / TX Traffic</th>
  1268. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1269. </tr>
  1270. </thead>
  1271. <tbody id="active-ppp-table-body" class="divide-y divide-slate-800/80"></tbody>
  1272. </table>
  1273. </div>
  1274. <div id="active-ppp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1275. No active PPP sessions currently connected.
  1276. </div>
  1277. </div>
  1278. </section>
  1279. <!-- ================= SECTION: EoIP TUNNELS (/interface eoip) ================= -->
  1280. <section id="section-eoip" class="hidden space-y-6">
  1281. <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">
  1282. <div>
  1283. <div class="flex items-center gap-2 mb-1">
  1284. <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">/interface eoip</span>
  1285. <h2 class="text-base font-bold text-white">EoIP Tunnels (Ethernet over IP)</h2>
  1286. </div>
  1287. <p class="text-xs text-slate-400">MikroTik RouterOS Layer 2 GRETAP tunneling over IP. Transparently bridge Ethernet subnets across the Internet.</p>
  1288. </div>
  1289. <button onclick="openAddEoIPModal()" 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">
  1290. <span>+ Add EoIP Tunnel</span>
  1291. </button>
  1292. </div>
  1293. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1294. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1295. <h3 class="text-sm font-bold text-white">Configured EoIP Interfaces</h3>
  1296. <span id="eoip-count-badge" class="text-xs font-mono bg-slate-800 text-slate-300 px-2.5 py-0.5 rounded-full">0 Tunnels</span>
  1297. </div>
  1298. <div class="overflow-x-auto">
  1299. <table class="w-full text-left text-xs font-mono">
  1300. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1301. <tr>
  1302. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  1303. <th class="py-2.5 px-3">Name</th>
  1304. <th class="py-2.5 px-3">Tunnel ID</th>
  1305. <th class="py-2.5 px-3">Tunnel IP</th>
  1306. <th class="py-2.5 px-3">Remote Address</th>
  1307. <th class="py-2.5 px-3">Local Address</th>
  1308. <th class="py-2.5 px-3">MAC Address</th>
  1309. <th class="py-2.5 px-3">MTU</th>
  1310. <th class="py-2.5 px-3">RX / TX Traffic</th>
  1311. <th class="py-2.5 px-3">Comment</th>
  1312. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1313. </tr>
  1314. </thead>
  1315. <tbody id="eoip-table-body" class="divide-y divide-slate-800/80"></tbody>
  1316. </table>
  1317. </div>
  1318. <div id="eoip-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1319. No EoIP tunnels configured. Click "+ Add EoIP Tunnel" to create one.
  1320. </div>
  1321. </div>
  1322. </section>
  1323. <!-- ================= SECTION: FIREWALL (/ip firewall) ================= -->
  1324. <section id="section-firewall" class="hidden space-y-6">
  1325. <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">
  1326. <div>
  1327. <div class="flex items-center gap-2 mb-1">
  1328. <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>
  1329. <h2 class="text-base font-bold text-white">Firewall & Traffic Controller</h2>
  1330. </div>
  1331. <p class="text-xs text-slate-400">Complete MikroTik-grade stateful filter, NAT, packet/connection marking (Mangle), address lists and live connection tracker.</p>
  1332. </div>
  1333. <div class="flex items-center space-x-2.5">
  1334. <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">
  1335. <span>+ Add Rule</span>
  1336. </button>
  1337. <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">
  1338. Reset Counters
  1339. </button>
  1340. </div>
  1341. </div>
  1342. <!-- Sub Tabs: Filter / NAT / Mangle / Address Lists / Connections -->
  1343. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  1344. <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">
  1345. <span>Filter Rules</span>
  1346. <span id="fw-badge-filter" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1347. </button>
  1348. <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">
  1349. <span>NAT</span>
  1350. <span id="fw-badge-nat" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1351. </button>
  1352. <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">
  1353. <span>Mangle</span>
  1354. <span id="fw-badge-mangle" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1355. </button>
  1356. <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">
  1357. <span>Address Lists</span>
  1358. <span id="fw-badge-addrlist" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1359. </button>
  1360. <button id="fw-subtab-btn-geo" onclick="switchFWSubTab('geo')" 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">
  1361. <span>Geo-Location</span>
  1362. <span id="fw-badge-geo" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1363. </button>
  1364. <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">
  1365. <span>Connections</span>
  1366. <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>
  1367. </button>
  1368. </div>
  1369. <!-- ================= TAB 1: FILTER RULES ================= -->
  1370. <div id="fw-subtab-filter" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1371. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1372. <div class="flex items-center gap-3">
  1373. <h3 class="text-sm font-bold text-white">Firewall Filter Rules</h3>
  1374. <span id="filter-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1375. </div>
  1376. <div class="flex items-center gap-2">
  1377. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  1378. <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">
  1379. <option value="">All Chains</option>
  1380. <option value="input">input</option>
  1381. <option value="forward">forward</option>
  1382. <option value="output">output</option>
  1383. </select>
  1384. </div>
  1385. </div>
  1386. <div class="overflow-x-auto">
  1387. <table class="w-full text-left text-xs font-mono">
  1388. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1389. <tr>
  1390. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1391. <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled, C=Comment">Flag</th>
  1392. <th class="py-2.5 px-3">Chain</th>
  1393. <th class="py-2.5 px-3">Src. Address</th>
  1394. <th class="py-2.5 px-3">Dst. Address</th>
  1395. <th class="py-2.5 px-3">Protocol</th>
  1396. <th class="py-2.5 px-3">Ports</th>
  1397. <th class="py-2.5 px-3">In / Out</th>
  1398. <th class="py-2.5 px-3">Action</th>
  1399. <th class="py-2.5 px-3">Packets / Bytes</th>
  1400. <th class="py-2.5 px-3">Comment</th>
  1401. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  1402. </tr>
  1403. </thead>
  1404. <tbody id="filter-table-body" class="divide-y divide-slate-800/80"></tbody>
  1405. </table>
  1406. </div>
  1407. <div id="filter-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1408. No filter rules found in this chain. Click "+ Add Rule" to create one.
  1409. </div>
  1410. </div>
  1411. <!-- ================= TAB 2: NAT RULES ================= -->
  1412. <div id="fw-subtab-nat" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1413. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1414. <div class="flex items-center gap-3">
  1415. <h3 class="text-sm font-bold text-white">NAT Rules</h3>
  1416. <span id="nat-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1417. </div>
  1418. <div class="flex items-center gap-2">
  1419. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  1420. <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">
  1421. <option value="">All Chains</option>
  1422. <option value="srcnat">srcnat (SNAT / Masquerade)</option>
  1423. <option value="dstnat">dstnat (Port Forwarding)</option>
  1424. </select>
  1425. </div>
  1426. </div>
  1427. <div class="overflow-x-auto">
  1428. <table class="w-full text-left text-xs font-mono">
  1429. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1430. <tr>
  1431. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1432. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1433. <th class="py-2.5 px-3">Chain</th>
  1434. <th class="py-2.5 px-3">Src. Address</th>
  1435. <th class="py-2.5 px-3">Dst. Address</th>
  1436. <th class="py-2.5 px-3">Proto/Port</th>
  1437. <th class="py-2.5 px-3">Out / In</th>
  1438. <th class="py-2.5 px-3">Action</th>
  1439. <th class="py-2.5 px-3">To Address:Port</th>
  1440. <th class="py-2.5 px-3">Packets / Bytes</th>
  1441. <th class="py-2.5 px-3">Comment</th>
  1442. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  1443. </tr>
  1444. </thead>
  1445. <tbody id="nat-table-body" class="divide-y divide-slate-800/80"></tbody>
  1446. </table>
  1447. </div>
  1448. <div id="nat-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1449. No NAT rules configured. Click "+ Add Rule" to add masquerade or port forwarding.
  1450. </div>
  1451. </div>
  1452. <!-- ================= TAB 3: MANGLE RULES ================= -->
  1453. <div id="fw-subtab-mangle" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1454. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1455. <div class="flex items-center gap-3">
  1456. <h3 class="text-sm font-bold text-white">Mangle Packet & Connection Marking</h3>
  1457. <span id="mangle-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1458. </div>
  1459. <div class="flex items-center gap-2">
  1460. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  1461. <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">
  1462. <option value="">All Chains</option>
  1463. <option value="prerouting">prerouting</option>
  1464. <option value="forward">forward</option>
  1465. <option value="postrouting">postrouting</option>
  1466. <option value="input">input</option>
  1467. <option value="output">output</option>
  1468. </select>
  1469. </div>
  1470. </div>
  1471. <div class="overflow-x-auto">
  1472. <table class="w-full text-left text-xs font-mono">
  1473. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1474. <tr>
  1475. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1476. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1477. <th class="py-2.5 px-3">Chain</th>
  1478. <th class="py-2.5 px-3">Src. Address</th>
  1479. <th class="py-2.5 px-3">Dst. Address</th>
  1480. <th class="py-2.5 px-3">Action</th>
  1481. <th class="py-2.5 px-3">New Mark / Value</th>
  1482. <th class="py-2.5 px-3 text-center">Pass</th>
  1483. <th class="py-2.5 px-3">Packets / Bytes</th>
  1484. <th class="py-2.5 px-3">Comment</th>
  1485. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  1486. </tr>
  1487. </thead>
  1488. <tbody id="mangle-table-body" class="divide-y divide-slate-800/80"></tbody>
  1489. </table>
  1490. </div>
  1491. <div id="mangle-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1492. No mangle rules configured. Click "+ Add Rule" to mark connections or routing for Multi-WAN.
  1493. </div>
  1494. </div>
  1495. <!-- ================= TAB 4: ADDRESS LISTS ================= -->
  1496. <div id="fw-subtab-addrlist" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1497. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1498. <div class="flex items-center gap-3">
  1499. <h3 class="text-sm font-bold text-white">Address Lists (ipset)</h3>
  1500. <span id="addrlist-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
  1501. </div>
  1502. <div class="flex items-center gap-2">
  1503. <label class="text-xs text-slate-400 font-sans">List:</label>
  1504. <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">
  1505. <option value="">All Lists</option>
  1506. </select>
  1507. </div>
  1508. </div>
  1509. <div class="overflow-x-auto">
  1510. <table class="w-full text-left text-xs font-mono">
  1511. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1512. <tr>
  1513. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1514. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1515. <th class="py-2.5 px-3">List Name</th>
  1516. <th class="py-2.5 px-3">IP Address / CIDR</th>
  1517. <th class="py-2.5 px-3">Comment</th>
  1518. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1519. </tr>
  1520. </thead>
  1521. <tbody id="addrlist-table-body" class="divide-y divide-slate-800/80"></tbody>
  1522. </table>
  1523. </div>
  1524. <div id="addrlist-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1525. No address list entries configured. Click "+ Add Item" to define a group of IPs/subnets.
  1526. </div>
  1527. </div>
  1528. <!-- ================= TAB 5: ACTIVE CONNECTIONS ================= -->
  1529. <div id="fw-subtab-connections" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1530. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1531. <div class="flex items-center gap-3">
  1532. <h3 class="text-sm font-bold text-white">Active Conntrack Connections</h3>
  1533. <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>
  1534. </div>
  1535. <div class="flex items-center gap-2 flex-wrap">
  1536. <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">
  1537. <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">
  1538. <option value="">All Proto</option>
  1539. <option value="TCP">TCP</option>
  1540. <option value="UDP">UDP</option>
  1541. <option value="ICMP">ICMP</option>
  1542. </select>
  1543. <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>
  1544. </div>
  1545. </div>
  1546. <div class="overflow-x-auto max-h-[550px] overflow-y-auto">
  1547. <table class="w-full text-left text-xs font-mono">
  1548. <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">
  1549. <tr>
  1550. <th class="py-2.5 px-3">Proto</th>
  1551. <th class="py-2.5 px-3">Source Address</th>
  1552. <th class="py-2.5 px-3">Destination Address</th>
  1553. <th class="py-2.5 px-3">Reply Source</th>
  1554. <th class="py-2.5 px-3">Reply Dest</th>
  1555. <th class="py-2.5 px-3">TCP State</th>
  1556. <th class="py-2.5 px-3">Mark</th>
  1557. <th class="py-2.5 px-3">Timeout</th>
  1558. <th class="py-2.5 px-3 text-right font-sans">Action</th>
  1559. </tr>
  1560. </thead>
  1561. <tbody id="conns-table-body" class="divide-y divide-slate-800/60"></tbody>
  1562. </table>
  1563. </div>
  1564. <div id="conns-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1565. No active connections found matching your search.
  1566. </div>
  1567. </div>
  1568. <!-- ================= TAB 5: GEO-LOCATION ================= -->
  1569. <div id="fw-subtab-geo" class="hidden space-y-4">
  1570. <!-- Geo Header & Scheduler Status -->
  1571. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
  1572. <div class="flex items-center space-x-3">
  1573. <div class="p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/20 text-emerald-400">
  1574. <span class="text-xl">🌍</span>
  1575. </div>
  1576. <div>
  1577. <div class="flex items-center gap-2">
  1578. <h3 class="text-sm font-bold text-white">Geo-Location IP Filtering</h3>
  1579. <span id="geo-status-badge" class="px-2 py-0.5 rounded text-[10px] font-mono font-bold bg-emerald-500/20 text-emerald-300 border border-emerald-500/30">Auto-Update ON</span>
  1580. </div>
  1581. <p class="text-xs text-slate-400">Aggregated country CIDR databases loaded into Linux kernel <code class="text-emerald-300">ipset</code>. Usable anywhere in Filter, NAT, and Mangle rules.</p>
  1582. </div>
  1583. </div>
  1584. <!-- Controls -->
  1585. <div class="flex items-center flex-wrap gap-2">
  1586. <div class="flex items-center space-x-1.5 bg-slate-950/60 border border-slate-800 px-3 py-1.5 rounded-lg text-xs font-mono">
  1587. <span class="text-slate-400">Schedule:</span>
  1588. <span id="geo-interval-label" class="font-bold text-white">Every 24h</span>
  1589. </div>
  1590. <button onclick="openGeoIntervalModal()" class="text-xs font-semibold px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-200 border border-slate-700 transition">
  1591. ⚙️ Settings
  1592. </button>
  1593. <button id="geo-btn-update-now" onclick="triggerGeoUpdateNow()" class="text-xs font-semibold px-3.5 py-1.5 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20 transition flex items-center gap-1.5">
  1594. <span id="geo-update-spinner" class="hidden animate-spin text-xs">⏳</span>
  1595. <span>🔄 Update Now</span>
  1596. </button>
  1597. </div>
  1598. </div>
  1599. <!-- Stats Bar -->
  1600. <div class="grid grid-cols-2 sm:grid-cols-4 gap-3">
  1601. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1602. <span class="text-[10px] uppercase font-bold text-slate-500 block">Countries in Rules</span>
  1603. <span id="geo-stat-active-countries" class="text-base font-bold font-mono text-emerald-400">0</span>
  1604. </div>
  1605. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1606. <span class="text-[10px] uppercase font-bold text-slate-500 block">Total Subnets in Kernel</span>
  1607. <span id="geo-stat-total-subnets" class="text-base font-bold font-mono text-cyan-400">0</span>
  1608. </div>
  1609. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1610. <span class="text-[10px] uppercase font-bold text-slate-500 block">Last Synced</span>
  1611. <span id="geo-stat-last-sync" class="text-xs font-mono text-slate-300">-</span>
  1612. </div>
  1613. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1614. <span class="text-[10px] uppercase font-bold text-slate-500 block">Next Scheduled Run</span>
  1615. <span id="geo-stat-next-sync" class="text-xs font-mono text-slate-300">-</span>
  1616. </div>
  1617. </div>
  1618. <!-- Filters & Country Table -->
  1619. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1620. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1621. <div class="flex items-center flex-wrap gap-2">
  1622. <input type="text" id="geo-search-input" oninput="renderGeoCountries()" placeholder="Search country name or code (e.g. Greece, GR, Germany)..." class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-emerald-500 w-64">
  1623. <select id="geo-continent-filter" onchange="renderGeoCountries()" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono">
  1624. <option value="">All Continents</option>
  1625. <option value="Europe">Europe</option>
  1626. <option value="Asia">Asia</option>
  1627. <option value="Americas">Americas</option>
  1628. <option value="Africa">Africa</option>
  1629. <option value="Oceania">Oceania</option>
  1630. </select>
  1631. <label class="flex items-center space-x-1.5 text-xs text-slate-300 cursor-pointer ml-2">
  1632. <input type="checkbox" id="geo-filter-inuse-only" onchange="renderGeoCountries()" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  1633. <span>In Use by Rules only</span>
  1634. </label>
  1635. <label class="flex items-center space-x-1.5 text-xs text-slate-300 cursor-pointer ml-2">
  1636. <input type="checkbox" id="geo-filter-cached-only" onchange="renderGeoCountries()" class="rounded bg-slate-800 border-slate-700 text-cyan-500">
  1637. <span>Cached Only</span>
  1638. </label>
  1639. </div>
  1640. <div class="flex items-center space-x-2">
  1641. <span class="text-xs text-slate-400 font-sans">Quick Filter:</span>
  1642. <button onclick="quickFilterGeo('GR')" class="px-2.5 py-1 text-xs rounded bg-slate-800 hover:bg-slate-700 text-slate-200 border border-slate-700 font-mono">🇬🇷 GR</button>
  1643. <button onclick="quickFilterGeo('Europe')" class="px-2.5 py-1 text-xs rounded bg-slate-800 hover:bg-slate-700 text-slate-200 border border-slate-700 font-mono">🇪🇺 Europe</button>
  1644. <button onclick="quickFilterGeo('HIGHRISK')" class="px-2.5 py-1 text-xs rounded bg-rose-950/40 hover:bg-rose-900/50 text-rose-300 border border-rose-800/50 font-mono">🚫 High-Risk</button>
  1645. <button onclick="quickFilterGeo('')" class="px-2.5 py-1 text-xs rounded bg-slate-800 hover:bg-slate-700 text-slate-400 border border-slate-700 font-mono">Reset</button>
  1646. </div>
  1647. </div>
  1648. <div class="overflow-x-auto max-h-[600px] overflow-y-auto">
  1649. <table class="w-full text-left text-xs font-mono">
  1650. <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">
  1651. <tr>
  1652. <th class="py-2.5 px-3 w-16 text-center">Code</th>
  1653. <th class="py-2.5 px-3">Country Name</th>
  1654. <th class="py-2.5 px-3">Continent</th>
  1655. <th class="py-2.5 px-3">Subnets</th>
  1656. <th class="py-2.5 px-3">Kernel IPSet</th>
  1657. <th class="py-2.5 px-3">Rule Usage</th>
  1658. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1659. </tr>
  1660. </thead>
  1661. <tbody id="geo-table-body" class="divide-y divide-slate-800/60"></tbody>
  1662. </table>
  1663. </div>
  1664. <div id="geo-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1665. No countries found matching your search.
  1666. </div>
  1667. </div>
  1668. </div>
  1669. </section>
  1670. <!-- ================= SECTION: ROUTES & POLICY (/ip route & rules) ================= -->
  1671. <section id="section-routes" class="hidden space-y-6">
  1672. <!-- Top Routing Switcher Bar -->
  1673. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  1674. <button onclick="navigate('routes')" class="px-3.5 py-1.5 text-xs font-bold rounded-lg transition bg-cyan-600/20 text-cyan-300 border border-cyan-500/40 shadow-sm flex items-center gap-2">
  1675. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1676. <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" />
  1677. </svg>
  1678. <span>Routes & Policy (/ip route)</span>
  1679. </button>
  1680. <button onclick="navigate('bgp')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1681. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1682. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  1683. </svg>
  1684. <span>BGP (/routing bgp)</span>
  1685. </button>
  1686. <button onclick="navigate('ospf')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1687. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1688. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
  1689. </svg>
  1690. <span>OSPF (/routing ospf)</span>
  1691. </button>
  1692. <button onclick="navigate('routing-filters')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1693. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1694. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
  1695. </svg>
  1696. <span>Filters (/routing filter)</span>
  1697. </button>
  1698. </div>
  1699. <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">
  1700. <div>
  1701. <div class="flex items-center gap-2 mb-1">
  1702. <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>
  1703. <h2 class="text-base font-bold text-white">IP Routes & Policy Rules</h2>
  1704. </div>
  1705. <p class="text-xs text-slate-400">Kernel FIB/RIB routing tables, static gateways, multipath uplinks, and policy routing (ip rule / fwmark lookup).</p>
  1706. </div>
  1707. <div class="flex items-center space-x-2.5">
  1708. <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">
  1709. + Add Route
  1710. </button>
  1711. <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">
  1712. + Add Rule
  1713. </button>
  1714. <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">
  1715. + New Table
  1716. </button>
  1717. </div>
  1718. </div>
  1719. <!-- Sub Tabs: Routes / Policy Rules / Tables -->
  1720. <div class="flex border-b border-slate-800 space-x-1">
  1721. <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">
  1722. <span>Routes</span>
  1723. <span id="routes-badge-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1724. </button>
  1725. <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">
  1726. <span>Policy Rules (/ip route rule)</span>
  1727. <span id="routes-badge-rules" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1728. </button>
  1729. <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">
  1730. <span>Routing Tables</span>
  1731. <span id="routes-badge-tables" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1732. </button>
  1733. </div>
  1734. <!-- Sub-Tab 1: Routes Table -->
  1735. <div id="routes-subtab-routes" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1736. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1737. <div class="flex items-center gap-3">
  1738. <h3 class="text-sm font-bold text-white">Active Routing Table (RIB)</h3>
  1739. <span id="routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
  1740. </div>
  1741. <div class="flex items-center gap-2">
  1742. <label class="text-xs text-slate-400 font-sans">Table Filter:</label>
  1743. <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">
  1744. <option value="">All Tables</option>
  1745. <option value="main">main</option>
  1746. </select>
  1747. <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>
  1748. </div>
  1749. </div>
  1750. <div class="overflow-x-auto">
  1751. <table class="w-full text-left text-xs font-mono">
  1752. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1753. <tr>
  1754. <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>
  1755. <th class="py-2.5 px-3">Dst. Address</th>
  1756. <th class="py-2.5 px-3">Gateway</th>
  1757. <th class="py-2.5 px-3">Distance</th>
  1758. <th class="py-2.5 px-3">Table / Mark</th>
  1759. <th class="py-2.5 px-3">Interface</th>
  1760. <th class="py-2.5 px-3">Comment</th>
  1761. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1762. </tr>
  1763. </thead>
  1764. <tbody id="routes-table-body" class="divide-y divide-slate-800/80"></tbody>
  1765. </table>
  1766. </div>
  1767. <div id="routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1768. No routes found.
  1769. </div>
  1770. </div>
  1771. <!-- Sub-Tab 2: Policy Rules (/ip route rule) -->
  1772. <div id="routes-subtab-rules" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1773. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1774. <h3 class="text-sm font-bold text-white">Policy Routing Rules (ip rule)</h3>
  1775. <span id="rules-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1776. </div>
  1777. <div class="overflow-x-auto">
  1778. <table class="w-full text-left text-xs font-mono">
  1779. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1780. <tr>
  1781. <th class="py-2.5 px-3 w-16">Pref</th>
  1782. <th class="py-2.5 px-3">Src. Address</th>
  1783. <th class="py-2.5 px-3">Dst. Address</th>
  1784. <th class="py-2.5 px-3">Routing Mark (fwmark)</th>
  1785. <th class="py-2.5 px-3">Lookup Table</th>
  1786. <th class="py-2.5 px-3">Action</th>
  1787. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1788. </tr>
  1789. </thead>
  1790. <tbody id="rules-table-body" class="divide-y divide-slate-800/80"></tbody>
  1791. </table>
  1792. </div>
  1793. <div id="rules-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1794. No policy rules configured. Click "+ Add Rule" to route traffic based on routing-mark or source IP.
  1795. </div>
  1796. </div>
  1797. <!-- Sub-Tab 3: Routing Tables -->
  1798. <div id="routes-subtab-tables" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1799. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1800. <h3 class="text-sm font-bold text-white">Defined Routing Tables (/etc/iproute2/rt_tables)</h3>
  1801. <span id="tables-count-badge" class="text-xs font-mono text-slate-400">0 Tables</span>
  1802. </div>
  1803. <div class="overflow-x-auto">
  1804. <table class="w-full text-left text-xs font-mono">
  1805. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1806. <tr>
  1807. <th class="py-2.5 px-3 w-20">FIB ID</th>
  1808. <th class="py-2.5 px-3">Table Name</th>
  1809. <th class="py-2.5 px-3">Comment / Purpose</th>
  1810. </tr>
  1811. </thead>
  1812. <tbody id="tables-table-body" class="divide-y divide-slate-800/80"></tbody>
  1813. </table>
  1814. </div>
  1815. </div>
  1816. </section>
  1817. <!-- ================= SECTION: BGP ROUTING (/routing bgp) ================= -->
  1818. <section id="section-bgp" class="hidden space-y-6">
  1819. <!-- Top Routing Switcher Bar -->
  1820. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  1821. <button onclick="navigate('routes')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1822. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1823. <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" />
  1824. </svg>
  1825. <span>Routes & Policy (/ip route)</span>
  1826. </button>
  1827. <button onclick="navigate('bgp')" class="px-3.5 py-1.5 text-xs font-bold rounded-lg transition bg-purple-600/20 text-purple-300 border border-purple-500/40 shadow-sm flex items-center gap-2">
  1828. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1829. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  1830. </svg>
  1831. <span>BGP (/routing bgp)</span>
  1832. </button>
  1833. <button onclick="navigate('ospf')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1834. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1835. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
  1836. </svg>
  1837. <span>OSPF (/routing ospf)</span>
  1838. </button>
  1839. <button onclick="navigate('routing-filters')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1840. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1841. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
  1842. </svg>
  1843. <span>Filters (/routing filter)</span>
  1844. </button>
  1845. </div>
  1846. <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">
  1847. <div>
  1848. <div class="flex items-center gap-2 mb-1">
  1849. <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">/routing bgp</span>
  1850. <h2 class="text-base font-bold text-white">BGP Dynamic Routing</h2>
  1851. <span id="bgp-live-status-pill" class="text-[10px] px-2 py-0.5 rounded font-mono bg-slate-800 text-slate-400 border border-slate-700">Checking...</span>
  1852. </div>
  1853. <p class="text-xs text-slate-400">Enterprise FRRouting BGP stack: Autonomous System peering sessions, prefix announcements, and BGP routing table (RIB).</p>
  1854. </div>
  1855. <div class="flex items-center space-x-2 flex-wrap gap-y-2">
  1856. <button onclick="openBgpInstanceModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-purple-300 border border-purple-900/50 transition flex items-center gap-1.5">
  1857. <span>⚙ BGP Settings</span>
  1858. </button>
  1859. <button onclick="openAddBgpPeerModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20 transition">
  1860. + Add BGP Peer
  1861. </button>
  1862. <button onclick="openAddBgpNetworkModal()" 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">
  1863. + Add Network
  1864. </button>
  1865. <button onclick="loadDynamicRouting()" class="text-xs text-slate-400 hover:text-white px-2.5 py-2 bg-slate-800 rounded-lg border border-slate-700 transition">
  1866. Refresh
  1867. </button>
  1868. </div>
  1869. </div>
  1870. <!-- BGP Sub-Tabs -->
  1871. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  1872. <button id="bgp-subtab-btn-bgp-peers" onclick="switchBgpSubTab('bgp-peers')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-purple-500 text-white transition flex items-center gap-2 whitespace-nowrap">
  1873. <span>BGP Peers (/routing bgp connection)</span>
  1874. <span id="dyn-badge-bgp-peers" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1875. </button>
  1876. <button id="bgp-subtab-btn-bgp-nets" onclick="switchBgpSubTab('bgp-nets')" 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">
  1877. <span>Advertised Networks (/routing bgp network)</span>
  1878. <span id="dyn-badge-bgp-nets" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1879. </button>
  1880. <button id="bgp-subtab-btn-bgp-routes" onclick="switchBgpSubTab('bgp-routes')" 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">
  1881. <span>BGP Routes (RIB)</span>
  1882. <span id="dyn-badge-bgp-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1883. </button>
  1884. </div>
  1885. <!-- Sub-Tab 1: BGP Peers -->
  1886. <div id="dyn-subtab-bgp-peers" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1887. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1888. <div class="flex items-center gap-3">
  1889. <h3 class="text-sm font-bold text-white">Configured BGP Peers</h3>
  1890. <span id="bgp-peers-count-badge" class="text-xs font-mono text-slate-400">0 Peers</span>
  1891. <span id="bgp-live-status-pill" class="text-[10px] px-2 py-0.5 rounded font-mono bg-slate-800 text-slate-400 border border-slate-700">Checking...</span>
  1892. </div>
  1893. <div class="flex items-center gap-2">
  1894. <button onclick="loadDynamicRouting()" class="text-xs text-purple-400 hover:text-purple-300 font-semibold px-2.5 py-1 bg-slate-800 rounded border border-slate-700">Refresh</button>
  1895. </div>
  1896. </div>
  1897. <div class="overflow-x-auto">
  1898. <table class="w-full text-left text-xs font-mono">
  1899. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1900. <tr>
  1901. <th class="py-2.5 px-3 w-16 text-center">Flags</th>
  1902. <th class="py-2.5 px-3">Name</th>
  1903. <th class="py-2.5 px-3">Remote Address</th>
  1904. <th class="py-2.5 px-3">Remote AS</th>
  1905. <th class="py-2.5 px-3">State</th>
  1906. <th class="py-2.5 px-3">Uptime</th>
  1907. <th class="py-2.5 px-3">Prefixes (RX/TX)</th>
  1908. <th class="py-2.5 px-3">Routing Filters</th>
  1909. <th class="py-2.5 px-3">Comment</th>
  1910. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1911. </tr>
  1912. </thead>
  1913. <tbody id="bgp-peers-table-body" class="divide-y divide-slate-800/80"></tbody>
  1914. </table>
  1915. </div>
  1916. <div id="bgp-peers-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1917. No BGP peers configured. Click "+ Add BGP Peer" to establish an eBGP or iBGP peering session.
  1918. </div>
  1919. </div>
  1920. <!-- Sub-Tab 2: BGP Networks -->
  1921. <div id="dyn-subtab-bgp-nets" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1922. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1923. <div class="flex items-center gap-3">
  1924. <h3 class="text-sm font-bold text-white">Advertised BGP Networks (/routing bgp network)</h3>
  1925. <span id="bgp-nets-count-badge" class="text-xs font-mono text-slate-400">0 Networks</span>
  1926. </div>
  1927. <button onclick="openAddBgpNetworkModal()" class="text-xs font-semibold px-3 py-1.5 rounded-lg bg-purple-600 hover:bg-purple-500 text-white transition">
  1928. + Add Network
  1929. </button>
  1930. </div>
  1931. <div class="overflow-x-auto">
  1932. <table class="w-full text-left text-xs font-mono">
  1933. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1934. <tr>
  1935. <th class="py-2.5 px-3">Network (CIDR)</th>
  1936. <th class="py-2.5 px-3">Status</th>
  1937. <th class="py-2.5 px-3">Comment</th>
  1938. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1939. </tr>
  1940. </thead>
  1941. <tbody id="bgp-nets-table-body" class="divide-y divide-slate-800/80"></tbody>
  1942. </table>
  1943. </div>
  1944. <div id="bgp-nets-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1945. No networks advertised. Click "+ Add Network" to announce your IP prefixes to BGP peers.
  1946. </div>
  1947. </div>
  1948. <!-- Sub-Tab 3: BGP Routes -->
  1949. <div id="dyn-subtab-bgp-routes" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1950. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1951. <h3 class="text-sm font-bold text-white">BGP Routing Information Base (show ip bgp)</h3>
  1952. <span id="bgp-routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
  1953. </div>
  1954. <div class="overflow-x-auto">
  1955. <table class="w-full text-left text-xs font-mono">
  1956. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1957. <tr>
  1958. <th class="py-2.5 px-3">Prefix</th>
  1959. <th class="py-2.5 px-3">Next Hop</th>
  1960. <th class="py-2.5 px-3">Metric</th>
  1961. <th class="py-2.5 px-3">Weight</th>
  1962. <th class="py-2.5 px-3">AS Path</th>
  1963. <th class="py-2.5 px-3">Origin</th>
  1964. </tr>
  1965. </thead>
  1966. <tbody id="bgp-routes-table-body" class="divide-y divide-slate-800/80"></tbody>
  1967. </table>
  1968. </div>
  1969. <div id="bgp-routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1970. No active routes in BGP table. Check peer connections and ensure BGP is enabled.
  1971. </div>
  1972. </div>
  1973. </section>
  1974. <!-- ================= SECTION: OSPF ROUTING (/routing ospf) ================= -->
  1975. <section id="section-ospf" class="hidden space-y-6">
  1976. <!-- Top Routing Switcher Bar -->
  1977. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  1978. <button onclick="navigate('routes')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1979. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1980. <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" />
  1981. </svg>
  1982. <span>Routes & Policy (/ip route)</span>
  1983. </button>
  1984. <button onclick="navigate('bgp')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1985. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1986. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  1987. </svg>
  1988. <span>BGP (/routing bgp)</span>
  1989. </button>
  1990. <button onclick="navigate('ospf')" class="px-3.5 py-1.5 text-xs font-bold rounded-lg transition bg-indigo-600/20 text-indigo-300 border border-indigo-500/40 shadow-sm flex items-center gap-2">
  1991. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1992. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
  1993. </svg>
  1994. <span>OSPF (/routing ospf)</span>
  1995. </button>
  1996. <button onclick="navigate('routing-filters')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  1997. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1998. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
  1999. </svg>
  2000. <span>Filters (/routing filter)</span>
  2001. </button>
  2002. </div>
  2003. <div class="bg-gradient-to-r from-indigo-950/40 via-slate-900 to-slate-900 border border-indigo-900/30 rounded-xl p-5 flex flex-wrap items-center justify-between gap-4">
  2004. <div>
  2005. <div class="flex items-center gap-2 mb-1">
  2006. <span class="px-2 py-0.5 rounded text-[10px] font-mono bg-indigo-500/20 text-indigo-300 border border-indigo-500/30 font-semibold">/routing ospf</span>
  2007. <h2 class="text-base font-bold text-white">OSPF Dynamic Routing</h2>
  2008. <span id="ospf-live-status-pill" class="text-[10px] px-2 py-0.5 rounded font-mono bg-slate-800 text-slate-400 border border-slate-700">Checking...</span>
  2009. </div>
  2010. <p class="text-xs text-slate-400">Enterprise FRRouting OSPFv2 stack: Link-state interior gateway routing, multi-area topologies, and neighbor adjacencies.</p>
  2011. </div>
  2012. <div class="flex items-center space-x-2 flex-wrap gap-y-2">
  2013. <button onclick="openOspfInstanceModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-indigo-300 border border-indigo-900/50 transition flex items-center gap-1.5">
  2014. <span>⚙ OSPF Settings</span>
  2015. </button>
  2016. <button onclick="openAddOspfInterfaceModal()" class="text-xs font-semibold px-3 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white shadow-lg shadow-indigo-500/20 transition">
  2017. + Add OSPF Interface
  2018. </button>
  2019. <button onclick="openAddOspfAreaModal()" 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">
  2020. + Add Area
  2021. </button>
  2022. <button onclick="loadDynamicRouting()" class="text-xs text-slate-400 hover:text-white px-2.5 py-2 bg-slate-800 rounded-lg border border-slate-700 transition">
  2023. Refresh
  2024. </button>
  2025. </div>
  2026. </div>
  2027. <!-- OSPF Sub-Tabs -->
  2028. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  2029. <button id="ospf-subtab-btn-ospf-ifaces" onclick="switchOspfSubTab('ospf-ifaces')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-indigo-500 text-white transition flex items-center gap-2 whitespace-nowrap">
  2030. <span>OSPF Interfaces</span>
  2031. <span id="dyn-badge-ospf-ifaces" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2032. </button>
  2033. <button id="ospf-subtab-btn-ospf-areas" onclick="switchOspfSubTab('ospf-areas')" 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">
  2034. <span>OSPF Areas</span>
  2035. <span id="dyn-badge-ospf-areas" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2036. </button>
  2037. <button id="ospf-subtab-btn-ospf-nbrs" onclick="switchOspfSubTab('ospf-nbrs')" 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">
  2038. <span>OSPF Neighbors</span>
  2039. <span id="dyn-badge-ospf-nbrs" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2040. </button>
  2041. <button id="ospf-subtab-btn-ospf-routes" onclick="switchOspfSubTab('ospf-routes')" 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">
  2042. <span>OSPF Routes</span>
  2043. <span id="dyn-badge-ospf-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2044. </button>
  2045. </div>
  2046. <!-- Sub-Tab 4: OSPF Interfaces -->
  2047. <div id="dyn-subtab-ospf-ifaces" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2048. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  2049. <div class="flex items-center gap-3">
  2050. <h3 class="text-sm font-bold text-white">OSPF Interface Templates (/routing ospf interface-template)</h3>
  2051. <span id="ospf-ifaces-count-badge" class="text-xs font-mono text-slate-400">0 Interfaces</span>
  2052. <span id="ospf-live-status-pill" class="text-[10px] px-2 py-0.5 rounded font-mono bg-slate-800 text-slate-400 border border-slate-700">Checking...</span>
  2053. </div>
  2054. <button onclick="openAddOspfInterfaceModal()" class="text-xs font-semibold px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white transition">
  2055. + Add Interface
  2056. </button>
  2057. </div>
  2058. <div class="overflow-x-auto">
  2059. <table class="w-full text-left text-xs font-mono">
  2060. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2061. <tr>
  2062. <th class="py-2.5 px-3 w-16 text-center">Flags</th>
  2063. <th class="py-2.5 px-3">Network (CIDR)</th>
  2064. <th class="py-2.5 px-3">Area</th>
  2065. <th class="py-2.5 px-3">Interface</th>
  2066. <th class="py-2.5 px-3">Cost</th>
  2067. <th class="py-2.5 px-3">Priority</th>
  2068. <th class="py-2.5 px-3">Timers (H/D)</th>
  2069. <th class="py-2.5 px-3">Auth</th>
  2070. <th class="py-2.5 px-3">Comment</th>
  2071. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  2072. </tr>
  2073. </thead>
  2074. <tbody id="ospf-ifaces-table-body" class="divide-y divide-slate-800/80"></tbody>
  2075. </table>
  2076. </div>
  2077. <div id="ospf-ifaces-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2078. No OSPF interfaces configured. Click "+ Add OSPF Interface" to enable OSPF on local subnets.
  2079. </div>
  2080. </div>
  2081. <!-- Sub-Tab 5: OSPF Areas -->
  2082. <div id="dyn-subtab-ospf-areas" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2083. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2084. <div class="flex items-center gap-3">
  2085. <h3 class="text-sm font-bold text-white">OSPF Areas (/routing ospf area)</h3>
  2086. <span id="ospf-areas-count-badge" class="text-xs font-mono text-slate-400">0 Areas</span>
  2087. </div>
  2088. <button onclick="openAddOspfAreaModal()" class="text-xs font-semibold px-3 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white transition">
  2089. + Add Area
  2090. </button>
  2091. </div>
  2092. <div class="overflow-x-auto">
  2093. <table class="w-full text-left text-xs font-mono">
  2094. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2095. <tr>
  2096. <th class="py-2.5 px-3">Name</th>
  2097. <th class="py-2.5 px-3">Area ID</th>
  2098. <th class="py-2.5 px-3">Type</th>
  2099. <th class="py-2.5 px-3">Comment</th>
  2100. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  2101. </tr>
  2102. </thead>
  2103. <tbody id="ospf-areas-table-body" class="divide-y divide-slate-800/80"></tbody>
  2104. </table>
  2105. </div>
  2106. </div>
  2107. <!-- Sub-Tab 6: OSPF Neighbors -->
  2108. <div id="dyn-subtab-ospf-nbrs" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2109. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2110. <h3 class="text-sm font-bold text-white">Live OSPF Neighbors (show ip ospf neighbor)</h3>
  2111. <span id="ospf-nbrs-count-badge" class="text-xs font-mono text-slate-400">0 Neighbors</span>
  2112. </div>
  2113. <div class="overflow-x-auto">
  2114. <table class="w-full text-left text-xs font-mono">
  2115. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2116. <tr>
  2117. <th class="py-2.5 px-3">Neighbor ID</th>
  2118. <th class="py-2.5 px-3">IP Address</th>
  2119. <th class="py-2.5 px-3">Interface</th>
  2120. <th class="py-2.5 px-3">Area</th>
  2121. <th class="py-2.5 px-3">State</th>
  2122. <th class="py-2.5 px-3">Dead Timer</th>
  2123. </tr>
  2124. </thead>
  2125. <tbody id="ospf-nbrs-table-body" class="divide-y divide-slate-800/80"></tbody>
  2126. </table>
  2127. </div>
  2128. <div id="ospf-nbrs-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2129. No active OSPF neighbors discovered. Ensure neighbors are in the same subnet and hello/dead timers match.
  2130. </div>
  2131. </div>
  2132. <!-- Sub-Tab 7: OSPF Routes -->
  2133. <div id="dyn-subtab-ospf-routes" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2134. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2135. <h3 class="text-sm font-bold text-white">OSPF Routing Table (show ip ospf route)</h3>
  2136. <span id="ospf-routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
  2137. </div>
  2138. <div class="overflow-x-auto">
  2139. <table class="w-full text-left text-xs font-mono">
  2140. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2141. <tr>
  2142. <th class="py-2.5 px-3">Prefix</th>
  2143. <th class="py-2.5 px-3">Type</th>
  2144. <th class="py-2.5 px-3">Cost</th>
  2145. <th class="py-2.5 px-3">Area</th>
  2146. <th class="py-2.5 px-3">Next Hop / Dev</th>
  2147. </tr>
  2148. </thead>
  2149. <tbody id="ospf-routes-table-body" class="divide-y divide-slate-800/80"></tbody>
  2150. </table>
  2151. </div>
  2152. <div id="ospf-routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2153. No OSPF routes calculated.
  2154. </div>
  2155. </div>
  2156. </section>
  2157. <!-- ================= SECTION: ROUTING FILTERS (/routing filter) ================= -->
  2158. <section id="section-routing-filters" class="hidden space-y-6">
  2159. <!-- Top Routing Switcher Bar -->
  2160. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  2161. <button onclick="navigate('routes')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  2162. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2163. <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" />
  2164. </svg>
  2165. <span>Routes & Policy (/ip route)</span>
  2166. </button>
  2167. <button onclick="navigate('bgp')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  2168. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2169. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  2170. </svg>
  2171. <span>BGP (/routing bgp)</span>
  2172. </button>
  2173. <button onclick="navigate('ospf')" class="px-3.5 py-1.5 text-xs font-medium rounded-lg text-slate-400 hover:text-white hover:bg-slate-800/60 transition flex items-center gap-2">
  2174. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2175. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
  2176. </svg>
  2177. <span>OSPF (/routing ospf)</span>
  2178. </button>
  2179. <button onclick="navigate('routing-filters')" class="px-3.5 py-1.5 text-xs font-bold rounded-lg transition bg-emerald-600/20 text-emerald-300 border border-emerald-500/40 shadow-sm flex items-center gap-2">
  2180. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2181. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
  2182. </svg>
  2183. <span>Filters (/routing filter)</span>
  2184. </button>
  2185. </div>
  2186. <!-- Top Banner -->
  2187. <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">
  2188. <div>
  2189. <div class="flex items-center gap-2 mb-1">
  2190. <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">/routing filter</span>
  2191. <h2 class="text-base font-bold text-white">Routing Filters & Policy Maps</h2>
  2192. </div>
  2193. <p class="text-xs text-slate-400">RouterOS-style filter chains (in-filter / out-filter), prefix-lists, community matching, and BGP attribute modifications</p>
  2194. </div>
  2195. <div class="flex items-center gap-2.5">
  2196. <div class="flex items-center gap-2">
  2197. <label class="text-[11px] text-slate-400 font-medium">Chain:</label>
  2198. <select id="routing-filter-chain-select" onchange="filterRoutingFiltersByChain(this.value)" class="bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono">
  2199. <option value="all">All Chains</option>
  2200. </select>
  2201. </div>
  2202. <button onclick="openAddRoutingFilterModal()" class="px-3.5 py-1.5 rounded-lg text-xs font-semibold bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-500/20 transition flex items-center gap-1.5">
  2203. <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2204. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
  2205. </svg>
  2206. <span>+ Add Filter Rule</span>
  2207. </button>
  2208. <button onclick="loadDynamicRouting(true)" class="px-3 py-1.5 rounded-lg text-xs font-medium bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition" title="Refresh routing telemetry">
  2209. ↻
  2210. </button>
  2211. </div>
  2212. </div>
  2213. <!-- Filter Rules Table -->
  2214. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2215. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2216. <div class="flex items-center gap-2">
  2217. <h3 class="text-sm font-bold text-white">Filter Rules</h3>
  2218. <span id="routing-filters-count-badge" class="px-2 py-0.5 rounded text-[10px] font-mono bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 font-semibold">0 Rules</span>
  2219. </div>
  2220. <span class="text-xs text-slate-500 font-sans">Evaluated sequentially by order</span>
  2221. </div>
  2222. <div class="overflow-x-auto">
  2223. <table class="w-full text-left text-xs font-mono">
  2224. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2225. <tr>
  2226. <th class="py-2.5 px-3 text-center w-12">Flags</th>
  2227. <th class="py-2.5 px-3 w-16">#</th>
  2228. <th class="py-2.5 px-3">Chain</th>
  2229. <th class="py-2.5 px-3">Action</th>
  2230. <th class="py-2.5 px-3">Match Prefix / Length</th>
  2231. <th class="py-2.5 px-3">Match AS-Path / Community</th>
  2232. <th class="py-2.5 px-3">Set Modifications</th>
  2233. <th class="py-2.5 px-3">Comment</th>
  2234. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  2235. </tr>
  2236. </thead>
  2237. <tbody id="routing-filters-table-body" class="divide-y divide-slate-800/80"></tbody>
  2238. </table>
  2239. </div>
  2240. <div id="routing-filters-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2241. No routing filter rules configured. Click "+ Add Filter Rule" to create a filter chain.
  2242. </div>
  2243. </div>
  2244. </section>
  2245. <!-- ================= SECTION: DEBIAN CONFIG PERSISTENCE ================= -->
  2246. <section id="section-persistence" class="hidden space-y-6">
  2247. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2248. <div class="flex flex-wrap items-center justify-between gap-4 mb-4">
  2249. <div>
  2250. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  2251. <span>Debian /etc/network/interfaces.d/ Persistence</span>
  2252. <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>
  2253. </h3>
  2254. <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>
  2255. </div>
  2256. <div class="flex items-center space-x-3">
  2257. <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>
  2258. <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">
  2259. <span>Save to Debian Config</span>
  2260. </button>
  2261. </div>
  2262. </div>
  2263. <div class="relative">
  2264. <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>
  2265. </div>
  2266. </div>
  2267. </section>
  2268. <!-- ================= SECTION: TROUBLESHOOT TOOLS (/tool) ================= -->
  2269. <section id="section-tools" class="hidden space-y-6">
  2270. <!-- Top Banner -->
  2271. <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">
  2272. <div>
  2273. <div class="flex items-center gap-2 mb-1">
  2274. <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">/tool</span>
  2275. <h2 class="text-base font-bold text-white">Troubleshoot & Diagnostic Tools</h2>
  2276. </div>
  2277. <p class="text-xs text-slate-400">RouterOS-style network diagnostics: ICMP Ping, Traceroute, MTR telemetry, DNS Resolution, and TCP Port Probing</p>
  2278. </div>
  2279. </div>
  2280. <!-- Tools Subtabs Navigation -->
  2281. <div class="flex items-center gap-1 border-b border-slate-800 pb-0 overflow-x-auto">
  2282. <button id="tools-subtab-btn-ping" onclick="switchToolsSubTab('ping')" class="px-4 py-2.5 text-xs font-bold border-b-2 border-amber-400 text-amber-300 transition flex items-center gap-2 whitespace-nowrap">
  2283. <span>Ping (/tool ping)</span>
  2284. </button>
  2285. <button id="tools-subtab-btn-traceroute" onclick="switchToolsSubTab('traceroute')" 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">
  2286. <span>Traceroute (/tool traceroute)</span>
  2287. </button>
  2288. <button id="tools-subtab-btn-mtr" onclick="switchToolsSubTab('mtr')" 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">
  2289. <span>MTR Telemetry</span>
  2290. </button>
  2291. <button id="tools-subtab-btn-dns" onclick="switchToolsSubTab('dns')" 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">
  2292. <span>DNS Lookup (/tool resolve)</span>
  2293. </button>
  2294. <button id="tools-subtab-btn-port" onclick="switchToolsSubTab('port')" 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">
  2295. <span>Port Probe (TCP Check)</span>
  2296. </button>
  2297. </div>
  2298. <!-- ================= SUBTAB: PING ================= -->
  2299. <div id="tools-view-ping" class="space-y-5">
  2300. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2301. <form id="tools-ping-form" onsubmit="executePing(event)" class="space-y-4">
  2302. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  2303. <div class="md:col-span-2">
  2304. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2305. <input type="text" id="tools-ping-target" required placeholder="e.g. 8.8.8.8, 1.1.1.1, google.com" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2306. </div>
  2307. <div>
  2308. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Count</label>
  2309. <select id="tools-ping-count" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2310. <option value="0">Continuous (Until Stopped)</option>
  2311. <option value="4" selected>4 packets</option>
  2312. <option value="5">5 packets</option>
  2313. <option value="10">10 packets</option>
  2314. <option value="20">20 packets</option>
  2315. <option value="50">50 packets</option>
  2316. <option value="100">100 packets</option>
  2317. </select>
  2318. </div>
  2319. <div>
  2320. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Source Interface</label>
  2321. <select id="tools-ping-iface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2322. <option value="">Auto (Default Route)</option>
  2323. </select>
  2324. </div>
  2325. </div>
  2326. <div class="flex flex-wrap items-center justify-between gap-4 pt-2">
  2327. <div class="flex items-center space-x-6 text-xs">
  2328. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  2329. <input type="checkbox" id="tools-ping-df" class="rounded text-amber-500 bg-slate-800 border-slate-700">
  2330. <span>Don't Fragment (DF bit)</span>
  2331. </label>
  2332. <div class="flex items-center space-x-2">
  2333. <span class="text-slate-400">Size (bytes):</span>
  2334. <input type="number" id="tools-ping-size" value="56" min="1" max="65500" class="w-20 bg-slate-800 border border-slate-700 rounded px-2 py-1 text-xs text-white font-mono">
  2335. </div>
  2336. </div>
  2337. <button type="submit" id="tools-ping-btn" class="px-5 py-2 rounded-lg font-semibold text-xs bg-amber-500 hover:bg-amber-400 text-slate-950 shadow-lg shadow-amber-500/20 transition flex items-center gap-2">
  2338. <span id="tools-ping-spinner" class="hidden animate-spin">↻</span>
  2339. <span id="tools-ping-btn-text">Start Ping</span>
  2340. </button>
  2341. </div>
  2342. </form>
  2343. </div>
  2344. <!-- Ping Results Container -->
  2345. <div id="tools-ping-results" class="hidden space-y-4">
  2346. <!-- KPI Summary Cards -->
  2347. <div class="grid grid-cols-2 md:grid-cols-5 gap-3">
  2348. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2349. <div class="text-[10px] text-slate-400 uppercase">Packets Sent</div>
  2350. <div id="tools-ping-stat-sent" class="text-base font-bold text-white font-mono mt-1">0</div>
  2351. </div>
  2352. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2353. <div class="text-[10px] text-slate-400 uppercase">Received</div>
  2354. <div id="tools-ping-stat-recv" class="text-base font-bold text-emerald-400 font-mono mt-1">0</div>
  2355. </div>
  2356. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2357. <div class="text-[10px] text-slate-400 uppercase">Packet Loss</div>
  2358. <div id="tools-ping-stat-loss" class="text-base font-bold font-mono mt-1">0%</div>
  2359. </div>
  2360. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2361. <div class="text-[10px] text-slate-400 uppercase">Avg RTT</div>
  2362. <div id="tools-ping-stat-avg" class="text-base font-bold text-cyan-400 font-mono mt-1">0 ms</div>
  2363. </div>
  2364. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2365. <div class="text-[10px] text-slate-400 uppercase">Min / Max</div>
  2366. <div id="tools-ping-stat-minmax" class="text-xs font-bold text-purple-300 font-mono mt-1.5">-</div>
  2367. </div>
  2368. </div>
  2369. <!-- Replies Table -->
  2370. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2371. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2372. <div class="flex items-center gap-2.5">
  2373. <span class="text-xs font-bold text-white">ICMP Echo Replies</span>
  2374. <span id="tools-ping-status-badge" class="px-2 py-0.5 rounded text-[10px] font-mono font-semibold"></span>
  2375. </div>
  2376. <button type="button" onclick="clearPingTable()" class="text-[11px] text-slate-400 hover:text-white px-2 py-0.5 rounded bg-slate-800/60 hover:bg-slate-800 border border-slate-700/60 transition">Clear</button>
  2377. </div>
  2378. <div class="overflow-x-auto">
  2379. <table class="w-full text-left text-xs font-mono">
  2380. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2381. <tr>
  2382. <th class="py-2 px-3"># Seq</th>
  2383. <th class="py-2 px-3">Responder</th>
  2384. <th class="py-2 px-3">Bytes</th>
  2385. <th class="py-2 px-3">TTL</th>
  2386. <th class="py-2 px-3">Latency (RTT)</th>
  2387. <th class="py-2 px-3 text-right">Status</th>
  2388. </tr>
  2389. </thead>
  2390. <tbody id="tools-ping-tbody" class="divide-y divide-slate-800/80"></tbody>
  2391. </table>
  2392. </div>
  2393. </div>
  2394. <!-- Raw CLI Drawer -->
  2395. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2396. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2397. <pre id="tools-ping-raw" class="mt-2 bg-slate-950 p-3 rounded font-mono text-[11px] text-slate-300 overflow-x-auto border border-slate-800 leading-relaxed"></pre>
  2398. </details>
  2399. </div>
  2400. </div>
  2401. <!-- ================= SUBTAB: TRACEROUTE ================= -->
  2402. <div id="tools-view-traceroute" class="hidden space-y-5">
  2403. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2404. <form id="tools-traceroute-form" onsubmit="executeTraceroute(event)" class="space-y-4">
  2405. <div class="grid grid-cols-1 md:grid-cols-5 gap-4">
  2406. <div class="md:col-span-2">
  2407. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2408. <input type="text" id="tools-tr-target" required placeholder="e.g. 1.1.1.1 or google.com" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2409. </div>
  2410. <div>
  2411. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Max Hops</label>
  2412. <input type="number" id="tools-tr-maxhops" value="15" min="1" max="30" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2413. </div>
  2414. <div>
  2415. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Protocol</label>
  2416. <select id="tools-tr-proto" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2417. <option value="icmp" selected>ICMP Echo (-I)</option>
  2418. <option value="udp">UDP Probe</option>
  2419. </select>
  2420. </div>
  2421. <div>
  2422. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Source Interface</label>
  2423. <select id="tools-tr-iface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2424. <option value="">Auto (Default Route)</option>
  2425. </select>
  2426. </div>
  2427. </div>
  2428. <div class="flex items-center justify-between pt-2">
  2429. <label class="flex items-center space-x-2 text-xs text-slate-300 cursor-pointer">
  2430. <input type="checkbox" id="tools-tr-resolve" class="rounded text-amber-500 bg-slate-800 border-slate-700">
  2431. <span>Resolve Hostnames (Reverse DNS)</span>
  2432. </label>
  2433. <button type="submit" id="tools-tr-btn" class="px-5 py-2 rounded-lg font-semibold text-xs bg-amber-500 hover:bg-amber-400 text-slate-950 shadow-lg shadow-amber-500/20 transition flex items-center gap-2">
  2434. <span id="tools-tr-spinner" class="hidden animate-spin">↻</span>
  2435. <span id="tools-tr-btn-text">Start Traceroute</span>
  2436. </button>
  2437. </div>
  2438. </form>
  2439. </div>
  2440. <div id="tools-tr-results" class="hidden space-y-4">
  2441. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2442. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2443. <div class="flex items-center gap-2.5">
  2444. <span class="text-xs font-bold text-white">Route Hops</span>
  2445. <span id="tools-tr-hops-count" class="text-xs font-mono text-slate-400">0 Hops</span>
  2446. </div>
  2447. <button type="button" onclick="clearTracerouteTable()" class="text-[11px] text-slate-400 hover:text-white px-2 py-0.5 rounded bg-slate-800/60 hover:bg-slate-800 border border-slate-700/60 transition">Clear</button>
  2448. </div>
  2449. <div class="overflow-x-auto">
  2450. <table class="w-full text-left text-xs font-mono">
  2451. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2452. <tr>
  2453. <th class="py-2.5 px-3 w-16">Hop #</th>
  2454. <th class="py-2.5 px-3">Gateway Host / IP</th>
  2455. <th class="py-2.5 px-3">RTT 1</th>
  2456. <th class="py-2.5 px-3">RTT 2</th>
  2457. <th class="py-2.5 px-3 text-right">Status</th>
  2458. </tr>
  2459. </thead>
  2460. <tbody id="tools-tr-tbody" class="divide-y divide-slate-800/80"></tbody>
  2461. </table>
  2462. </div>
  2463. </div>
  2464. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2465. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2466. <pre id="tools-tr-raw" class="mt-2 bg-slate-950 p-3 rounded font-mono text-[11px] text-slate-300 overflow-x-auto border border-slate-800 leading-relaxed"></pre>
  2467. </details>
  2468. </div>
  2469. </div>
  2470. <!-- ================= SUBTAB: MTR ================= -->
  2471. <div id="tools-view-mtr" class="hidden space-y-5">
  2472. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2473. <form id="tools-mtr-form" onsubmit="executeMTR(event)" class="space-y-4">
  2474. <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
  2475. <div class="md:col-span-2">
  2476. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2477. <input type="text" id="tools-mtr-target" required placeholder="e.g. 1.1.1.1 or 8.8.8.8" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2478. </div>
  2479. <div>
  2480. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Cycle Count</label>
  2481. <select id="tools-mtr-count" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2482. <option value="2">2 cycles (Fast)</option>
  2483. <option value="3" selected>3 cycles</option>
  2484. <option value="5">5 cycles</option>
  2485. <option value="10">10 cycles (Deep)</option>
  2486. </select>
  2487. </div>
  2488. </div>
  2489. <div class="flex justify-end pt-2">
  2490. <button type="submit" id="tools-mtr-btn" class="px-5 py-2 rounded-lg font-semibold text-xs bg-amber-500 hover:bg-amber-400 text-slate-950 shadow-lg shadow-amber-500/20 transition flex items-center gap-2">
  2491. <span id="tools-mtr-spinner" class="hidden">↻</span>
  2492. <span>Start MTR Report</span>
  2493. </button>
  2494. </div>
  2495. </form>
  2496. </div>
  2497. <div id="tools-mtr-results" class="hidden space-y-4">
  2498. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2499. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2500. <span class="text-xs font-bold text-white">MTR Route Telemetry</span>
  2501. <span id="tools-mtr-hops-count" class="text-xs font-mono text-slate-400">0 Hops</span>
  2502. </div>
  2503. <div class="overflow-x-auto">
  2504. <table class="w-full text-left text-xs font-mono">
  2505. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2506. <tr>
  2507. <th class="py-2.5 px-3 w-16">Hop #</th>
  2508. <th class="py-2.5 px-3">Host / Router</th>
  2509. <th class="py-2.5 px-3">Loss %</th>
  2510. <th class="py-2.5 px-3">Sent</th>
  2511. <th class="py-2.5 px-3">Last (ms)</th>
  2512. <th class="py-2.5 px-3">Avg (ms)</th>
  2513. <th class="py-2.5 px-3">Best (ms)</th>
  2514. <th class="py-2.5 px-3">Worst (ms)</th>
  2515. <th class="py-2.5 px-3">StDev</th>
  2516. </tr>
  2517. </thead>
  2518. <tbody id="tools-mtr-tbody" class="divide-y divide-slate-800/80"></tbody>
  2519. </table>
  2520. </div>
  2521. </div>
  2522. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2523. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2524. <pre id="tools-mtr-raw" class="mt-2 bg-slate-950 p-3 rounded font-mono text-[11px] text-slate-300 overflow-x-auto border border-slate-800 leading-relaxed"></pre>
  2525. </details>
  2526. </div>
  2527. </div>
  2528. <!-- ================= SUBTAB: DNS LOOKUP ================= -->
  2529. <div id="tools-view-dns" class="hidden space-y-5">
  2530. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2531. <form id="tools-dns-form" onsubmit="executeDNS(event)" class="space-y-4">
  2532. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  2533. <div class="md:col-span-2">
  2534. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Domain Name *</label>
  2535. <input type="text" id="tools-dns-domain" required placeholder="e.g. cloudflare.com, google.com" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2536. </div>
  2537. <div>
  2538. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Record Type</label>
  2539. <select id="tools-dns-type" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2540. <option value="A" selected>A (IPv4)</option>
  2541. <option value="AAAA">AAAA (IPv6)</option>
  2542. <option value="CNAME">CNAME</option>
  2543. <option value="MX">MX (Mail)</option>
  2544. <option value="TXT">TXT</option>
  2545. <option value="NS">NS (Nameserver)</option>
  2546. <option value="SOA">SOA</option>
  2547. <option value="ANY">ANY</option>
  2548. </select>
  2549. </div>
  2550. <div>
  2551. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Custom DNS Server (Optional)</label>
  2552. <input type="text" id="tools-dns-server" placeholder="e.g. 1.1.1.1, 8.8.8.8" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2553. </div>
  2554. </div>
  2555. <div class="flex justify-end pt-2">
  2556. <button type="submit" id="tools-dns-btn" class="px-5 py-2 rounded-lg font-semibold text-xs bg-amber-500 hover:bg-amber-400 text-slate-950 shadow-lg shadow-amber-500/20 transition flex items-center gap-2">
  2557. <span id="tools-dns-spinner" class="hidden">↻</span>
  2558. <span>Resolve Domain</span>
  2559. </button>
  2560. </div>
  2561. </form>
  2562. </div>
  2563. <div id="tools-dns-results" class="hidden space-y-4">
  2564. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2565. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2566. <div class="flex items-center gap-2">
  2567. <span class="text-xs font-bold text-white">DNS Answer Records</span>
  2568. <span id="tools-dns-meta" class="text-[11px] font-mono text-cyan-300"></span>
  2569. </div>
  2570. </div>
  2571. <div class="overflow-x-auto">
  2572. <table class="w-full text-left text-xs font-mono">
  2573. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2574. <tr>
  2575. <th class="py-2.5 px-3">Name</th>
  2576. <th class="py-2.5 px-3">TTL (s)</th>
  2577. <th class="py-2.5 px-3">Class</th>
  2578. <th class="py-2.5 px-3">Type</th>
  2579. <th class="py-2.5 px-3">Value / Target</th>
  2580. </tr>
  2581. </thead>
  2582. <tbody id="tools-dns-tbody" class="divide-y divide-slate-800/80"></tbody>
  2583. </table>
  2584. </div>
  2585. </div>
  2586. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2587. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2588. <pre id="tools-dns-raw" class="mt-2 bg-slate-950 p-3 rounded font-mono text-[11px] text-slate-300 overflow-x-auto border border-slate-800 leading-relaxed"></pre>
  2589. </details>
  2590. </div>
  2591. </div>
  2592. <!-- ================= SUBTAB: PORT PROBE ================= -->
  2593. <div id="tools-view-port" class="hidden space-y-5">
  2594. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2595. <form id="tools-port-form" onsubmit="executePortProbe(event)" class="space-y-4">
  2596. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  2597. <div class="md:col-span-2">
  2598. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2599. <input type="text" id="tools-port-target" required placeholder="e.g. 1.1.1.1, 192.168.131.1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2600. </div>
  2601. <div>
  2602. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Port (TCP) *</label>
  2603. <input type="number" id="tools-port-num" required min="1" max="65535" value="80" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2604. </div>
  2605. <div>
  2606. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Timeout (s)</label>
  2607. <input type="number" id="tools-port-timeout" value="3" min="1" max="10" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white font-mono">
  2608. </div>
  2609. </div>
  2610. <!-- Quick Presets -->
  2611. <div class="flex flex-wrap items-center gap-2 pt-1">
  2612. <span class="text-[11px] text-slate-400">Quick Ports:</span>
  2613. <button type="button" onclick="setPortPreset(80)" class="px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-[11px] font-mono text-cyan-300 border border-slate-700">HTTP: 80</button>
  2614. <button type="button" onclick="setPortPreset(443)" class="px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-[11px] font-mono text-emerald-300 border border-slate-700">HTTPS: 443</button>
  2615. <button type="button" onclick="setPortPreset(22)" class="px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-[11px] font-mono text-purple-300 border border-slate-700">SSH: 22</button>
  2616. <button type="button" onclick="setPortPreset(53)" class="px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-[11px] font-mono text-indigo-300 border border-slate-700">DNS: 53</button>
  2617. <button type="button" onclick="setPortPreset(179)" class="px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-[11px] font-mono text-amber-300 border border-slate-700">BGP: 179</button>
  2618. <button type="button" onclick="setPortPreset(8291)" class="px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-[11px] font-mono text-pink-300 border border-slate-700">Winbox: 8291</button>
  2619. <button type="button" onclick="setPortPreset(8006)" class="px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-[11px] font-mono text-orange-300 border border-slate-700">PVE: 8006</button>
  2620. </div>
  2621. <div class="flex justify-end pt-2">
  2622. <button type="submit" id="tools-port-btn" class="px-5 py-2 rounded-lg font-semibold text-xs bg-amber-500 hover:bg-amber-400 text-slate-950 shadow-lg shadow-amber-500/20 transition flex items-center gap-2">
  2623. <span id="tools-port-spinner" class="hidden">↻</span>
  2624. <span>Probe Port</span>
  2625. </button>
  2626. </div>
  2627. </form>
  2628. </div>
  2629. <div id="tools-port-results" class="hidden space-y-4">
  2630. <div id="tools-port-banner" class="rounded-xl p-5 border flex items-center justify-between">
  2631. <div class="flex items-center gap-3">
  2632. <span id="tools-port-icon" class="w-8 h-8 rounded-full flex items-center justify-center font-bold text-sm"></span>
  2633. <div>
  2634. <h3 id="tools-port-title" class="text-sm font-bold"></h3>
  2635. <p id="tools-port-sub" class="text-xs mt-0.5 font-mono"></p>
  2636. </div>
  2637. </div>
  2638. <div class="text-right">
  2639. <div class="text-[10px] uppercase text-slate-400">Handshake Latency</div>
  2640. <div id="tools-port-latency" class="text-base font-bold font-mono text-white"></div>
  2641. </div>
  2642. </div>
  2643. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2644. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Handshake Details</summary>
  2645. <pre id="tools-port-raw" class="mt-2 bg-slate-950 p-3 rounded font-mono text-[11px] text-slate-300 overflow-x-auto border border-slate-800 leading-relaxed"></pre>
  2646. </details>
  2647. </div>
  2648. </div>
  2649. </section>
  2650. </main>
  2651. </div>
  2652. </div>
  2653. <!-- ================= MODAL: CREATE VLAN ================= -->
  2654. <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">
  2655. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2656. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2657. <h3 class="text-sm font-bold text-white">Create New VLAN Interface</h3>
  2658. <button onclick="closeVlanModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2659. </div>
  2660. <form id="vlan-form" onsubmit="submitCreateVlan(event)" class="p-6 space-y-4">
  2661. <div>
  2662. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Parent Interface *</label>
  2663. <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>
  2664. </div>
  2665. <div class="grid grid-cols-2 gap-4">
  2666. <div>
  2667. <label class="block text-xs font-semibold text-slate-300 mb-1.5">VLAN ID (1-4094) *</label>
  2668. <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">
  2669. </div>
  2670. <div>
  2671. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface Name</label>
  2672. <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">
  2673. </div>
  2674. </div>
  2675. <div>
  2676. <div class="flex items-center justify-between mb-1.5">
  2677. <label class="text-xs font-semibold text-slate-300">Router IP Address & CIDR</label>
  2678. <div class="flex space-x-1">
  2679. <button type="button" onclick="setSubnetPreset('/24')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/24</button>
  2680. <button type="button" onclick="setSubnetPreset('/23')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/23</button>
  2681. <button type="button" onclick="setSubnetPreset('/16')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/16</button>
  2682. </div>
  2683. </div>
  2684. <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">
  2685. </div>
  2686. <div class="grid grid-cols-2 gap-4">
  2687. <div>
  2688. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
  2689. <select id="vlan-role" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  2690. <option value="LAN">LAN</option>
  2691. <option value="GUEST">Guest Network</option>
  2692. <option value="IOT">IoT / Smart Home</option>
  2693. <option value="DMZ">DMZ / Isolated</option>
  2694. <option value="MGMT">Management</option>
  2695. <option value="WAN">WAN / Uplink</option>
  2696. </select>
  2697. </div>
  2698. <div>
  2699. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description / Alias</label>
  2700. <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">
  2701. </div>
  2702. </div>
  2703. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2704. <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>
  2705. <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>
  2706. </div>
  2707. </form>
  2708. </div>
  2709. </div>
  2710. <!-- ================= MODAL: EDIT INTERFACE ================= -->
  2711. <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">
  2712. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2713. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2714. <div>
  2715. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  2716. <span id="modal-iface-name">eth0</span>
  2717. <span id="modal-iface-badge" class="text-[10px] font-mono px-2 py-0.5 rounded bg-slate-800 text-slate-300">Ethernet</span>
  2718. </h3>
  2719. </div>
  2720. <button onclick="closeIfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2721. </div>
  2722. <div class="p-6 space-y-5">
  2723. <div class="grid grid-cols-2 gap-4 p-3 bg-slate-950/60 rounded-xl border border-slate-800/80">
  2724. <div>
  2725. <span class="block text-[11px] text-slate-400 mb-1">Administrative Link</span>
  2726. <div class="flex items-center space-x-2">
  2727. <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>
  2728. <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>
  2729. </div>
  2730. </div>
  2731. <div>
  2732. <span class="block text-[11px] text-slate-400 mb-1">MTU Size</span>
  2733. <div class="flex items-center space-x-2">
  2734. <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">
  2735. <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>
  2736. </div>
  2737. </div>
  2738. </div>
  2739. <div>
  2740. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Assigned IP Addresses</label>
  2741. <div id="modal-ip-list" class="space-y-1.5 mb-3 font-mono text-xs"></div>
  2742. <div class="flex space-x-2">
  2743. <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">
  2744. <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>
  2745. </div>
  2746. </div>
  2747. <div class="grid grid-cols-2 gap-4">
  2748. <div>
  2749. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
  2750. <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">
  2751. <option value="WAN">WAN / Uplink</option>
  2752. <option value="LAN">LAN</option>
  2753. <option value="DMZ">DMZ</option>
  2754. <option value="GUEST">Guest</option>
  2755. <option value="IOT">IoT</option>
  2756. <option value="MGMT">Management</option>
  2757. </select>
  2758. </div>
  2759. <div>
  2760. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description</label>
  2761. <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">
  2762. </div>
  2763. </div>
  2764. <div class="pt-4 border-t border-slate-800 flex justify-between items-center">
  2765. <button id="modal-delete-vlan-btn" onclick="confirmDeleteVlan(currentModalIface)" class="hidden text-xs text-rose-400 hover:text-rose-300">Delete VLAN</button>
  2766. <div class="flex space-x-3">
  2767. <button onclick="closeIfaceModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Close</button>
  2768. <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>
  2769. </div>
  2770. </div>
  2771. </div>
  2772. </div>
  2773. </div>
  2774. <!-- ================= MODAL: PPPoE CLIENT ================= -->
  2775. <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">
  2776. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2777. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2778. <h3 id="pppoe-modal-title" class="text-sm font-bold text-white">Add PPPoE Client Interface</h3>
  2779. <button onclick="closePPPoEModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2780. </div>
  2781. <form onsubmit="submitSavePPPoE(event)" class="p-6 space-y-4">
  2782. <input type="hidden" id="pppoe-modal-edit-orig">
  2783. <div class="grid grid-cols-2 gap-4">
  2784. <div>
  2785. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Name *</label>
  2786. <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">
  2787. </div>
  2788. <div>
  2789. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface *</label>
  2790. <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>
  2791. </div>
  2792. </div>
  2793. <div class="grid grid-cols-2 gap-4">
  2794. <div>
  2795. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  2796. <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">
  2797. </div>
  2798. <div>
  2799. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  2800. <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">
  2801. </div>
  2802. </div>
  2803. <div class="grid grid-cols-2 gap-4">
  2804. <div>
  2805. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Service Name (Optional)</label>
  2806. <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">
  2807. </div>
  2808. <div>
  2809. <label class="block text-xs font-semibold text-slate-300 mb-1.5">MTU</label>
  2810. <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">
  2811. </div>
  2812. </div>
  2813. <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
  2814. <label class="flex items-center space-x-2 cursor-pointer">
  2815. <input type="checkbox" id="pppoe-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
  2816. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  2817. </label>
  2818. <label class="flex items-center space-x-2 cursor-pointer">
  2819. <input type="checkbox" id="pppoe-modal-reconnect" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
  2820. <span class="text-xs text-slate-300 font-medium">Auto-Reconnect</span>
  2821. </label>
  2822. <label class="flex items-center space-x-2 cursor-pointer">
  2823. <input type="checkbox" id="pppoe-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  2824. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  2825. </label>
  2826. </div>
  2827. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2828. <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>
  2829. <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>
  2830. </div>
  2831. </form>
  2832. </div>
  2833. </div>
  2834. <!-- ================= MODAL: WIREGUARD INTERFACE ================= -->
  2835. <!-- ================= MODAL: ADD / EDIT WIREGUARD INTERFACE ================= -->
  2836. <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">
  2837. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2838. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2839. <div class="flex items-center gap-2">
  2840. <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>
  2841. <h3 id="wg-iface-modal-title" class="text-sm font-bold text-white">Add WireGuard Interface</h3>
  2842. </div>
  2843. <button onclick="closeAddWGInterfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2844. </div>
  2845. <form onsubmit="submitSaveWGInterface(event)" class="p-6 space-y-4 text-xs">
  2846. <input type="hidden" id="wg-iface-modal-edit-orig">
  2847. <div class="grid grid-cols-2 gap-4">
  2848. <div>
  2849. <label class="block font-semibold text-slate-300 mb-1.5">Interface Name *</label>
  2850. <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-white font-mono focus:outline-none focus:border-rose-500">
  2851. <p class="text-[10px] text-slate-500 mt-1">e.g. wg0, wg-office, wgx-Space</p>
  2852. </div>
  2853. <div>
  2854. <label class="block font-semibold text-slate-300 mb-1.5">Listen Port *</label>
  2855. <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-white font-mono focus:outline-none focus:border-rose-500">
  2856. </div>
  2857. </div>
  2858. <div class="grid grid-cols-2 gap-4">
  2859. <div>
  2860. <label class="block font-semibold text-slate-300 mb-1.5">Tunnel IP (CIDR)</label>
  2861. <input type="text" id="wg-iface-modal-addr" placeholder="10.10.0.1/24" 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-rose-500">
  2862. <p class="text-[10px] text-slate-500 mt-1">Assigned IP/mask, or leave blank</p>
  2863. </div>
  2864. <div>
  2865. <label class="block font-semibold text-slate-300 mb-1.5">MTU</label>
  2866. <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-white font-mono">
  2867. </div>
  2868. </div>
  2869. <div>
  2870. <label class="block font-semibold text-slate-300 mb-1.5">Comment / Alias</label>
  2871. <input type="text" id="wg-iface-modal-comment" placeholder="e.g. Main Roadwarrior Server, Site-to-Site tunnel" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white focus:outline-none focus:border-rose-500">
  2872. </div>
  2873. <div class="bg-slate-950/60 border border-slate-800/80 rounded-xl p-3.5 space-y-3">
  2874. <div class="flex items-center justify-between">
  2875. <span class="text-[11px] font-bold text-slate-400 uppercase tracking-wider font-mono">Cryptographic Keypair</span>
  2876. <button type="button" onclick="generateWGInterfaceKeys()" class="text-[11px] text-rose-400 hover:text-rose-300 font-semibold flex items-center gap-1">
  2877. <span>⚡ Generate New Keypair</span>
  2878. </button>
  2879. </div>
  2880. <div>
  2881. <div class="flex items-center justify-between mb-1">
  2882. <label class="text-[11px] font-semibold text-slate-300">Public Key</label>
  2883. <button type="button" onclick="copyWGInterfacePubKey()" class="text-[10px] text-cyan-400 hover:text-cyan-300">📋 Copy Public Key</button>
  2884. </div>
  2885. <input type="text" id="wg-iface-modal-pubkey" readonly class="w-full bg-slate-900 border border-slate-800 rounded-lg px-3 py-2 text-slate-300 font-mono text-[11px]">
  2886. </div>
  2887. <div>
  2888. <div class="flex items-center justify-between mb-1">
  2889. <label class="text-[11px] font-semibold text-slate-300">Private Key (Secret) *</label>
  2890. <button type="button" onclick="toggleWGPrivKeyVisibility()" id="btn-toggle-wg-privkey" class="text-[10px] text-slate-400 hover:text-white">👁️ Show</button>
  2891. </div>
  2892. <input type="password" id="wg-iface-modal-privkey" required oninput="onWGInterfacePrivKeyInput()" class="w-full bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono text-[11px] focus:outline-none focus:border-rose-500">
  2893. <p class="text-[10px] text-slate-500 mt-1">You can paste any existing base64 private key; the public key will update automatically.</p>
  2894. </div>
  2895. </div>
  2896. <div class="pt-1">
  2897. <label class="flex items-center space-x-2.5 cursor-pointer">
  2898. <input type="checkbox" id="wg-iface-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500 focus:ring-rose-500">
  2899. <span class="font-medium text-slate-300">Disabled (X)</span>
  2900. </label>
  2901. </div>
  2902. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2903. <button type="button" onclick="closeAddWGInterfaceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800 transition">Cancel</button>
  2904. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-500/20 transition">Save Interface</button>
  2905. </div>
  2906. </form>
  2907. </div>
  2908. </div>
  2909. <!-- ================= MODAL: ADD / EDIT WIREGUARD PEER ================= -->
  2910. <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">
  2911. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2912. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2913. <div class="flex items-center gap-2">
  2914. <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 peers</span>
  2915. <h3 id="wg-peer-modal-title" class="text-sm font-bold text-white">Add WireGuard Peer</h3>
  2916. </div>
  2917. <button onclick="closeAddWGPeerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2918. </div>
  2919. <form onsubmit="submitSaveWGPeer(event)" class="p-6 space-y-4 text-xs">
  2920. <input type="hidden" id="wg-peer-modal-edit-orig-iface">
  2921. <input type="hidden" id="wg-peer-modal-edit-orig-pubkey">
  2922. <div class="grid grid-cols-2 gap-4">
  2923. <div>
  2924. <label class="block font-semibold text-slate-300 mb-1.5">WireGuard Interface *</label>
  2925. <select id="wg-peer-modal-iface" onchange="checkWGPeerKeyValidity()" 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-rose-500"></select>
  2926. </div>
  2927. <div>
  2928. <label class="block font-semibold text-slate-300 mb-1.5">Peer Name / Alias *</label>
  2929. <input type="text" id="wg-peer-modal-name" placeholder="Laptop, iPhone, Branch-Athens" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white focus:outline-none focus:border-rose-500">
  2930. </div>
  2931. </div>
  2932. <div>
  2933. <div class="flex items-center justify-between mb-1.5">
  2934. <label class="font-semibold text-slate-300">Peer Public Key *</label>
  2935. <button type="button" onclick="generatePeerKeypairHelper()" class="text-[11px] text-cyan-400 hover:text-cyan-300 font-semibold flex items-center gap-1">
  2936. <span>⚡ Generate Client Keypair</span>
  2937. </button>
  2938. </div>
  2939. <input type="text" id="wg-peer-modal-pubkey" oninput="checkWGPeerKeyValidity()" placeholder="Base64 44-character public key" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono text-xs focus:outline-none focus:border-rose-500">
  2940. <!-- Warning if user tries to paste interface's own public key -->
  2941. <div id="wg-peer-key-warning" class="hidden text-rose-400 text-[11px] font-sans mt-1.5 bg-rose-950/50 p-2.5 rounded-lg border border-rose-800/70">
  2942. ⚠️ <strong>Invalid Key:</strong> The peer public key cannot be the same as the interface's own public key. A WireGuard node cannot connect to itself!
  2943. </div>
  2944. <!-- Box showing generated client secret key if generated here -->
  2945. <div id="wg-peer-gen-key-box" class="hidden mt-2.5 bg-slate-950/80 p-3 rounded-xl border border-cyan-800/60 text-xs font-mono space-y-1.5">
  2946. <div class="flex items-center justify-between text-[11px] text-cyan-300 font-bold font-sans">
  2947. <span>Generated Client Private Key (Secret):</span>
  2948. <button type="button" onclick="copyGeneratedPeerPrivKey()" class="text-white hover:text-cyan-300 font-semibold text-[10px] bg-slate-800 px-2 py-0.5 rounded border border-slate-700">📋 Copy Secret</button>
  2949. </div>
  2950. <input type="text" id="wg-peer-gen-privkey" readonly class="w-full bg-slate-900 border border-slate-800 rounded px-2.5 py-1.5 text-slate-300 text-xs font-mono">
  2951. <p class="text-[10px] text-slate-400 font-sans">Copy and save this private key to configure the client device (e.g. phone or remote router).</p>
  2952. </div>
  2953. </div>
  2954. <div>
  2955. <label class="block font-semibold text-slate-300 mb-1.5">Allowed IPs (CIDR) *</label>
  2956. <input type="text" id="wg-peer-modal-allowedips" placeholder="e.g. 10.10.0.2/32, 192.168.20.0/24 or 0.0.0.0/0" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono text-xs focus:outline-none focus:border-rose-500">
  2957. <p class="text-[10px] text-slate-500 mt-1">IP ranges routed to/from this peer (comma-separated)</p>
  2958. </div>
  2959. <div class="grid grid-cols-3 gap-3">
  2960. <div class="col-span-2">
  2961. <label class="block font-semibold text-slate-300 mb-1.5">Endpoint Host/IP (Optional)</label>
  2962. <input type="text" id="wg-peer-modal-endpoint" placeholder="e.g. 10.2.145.253 or vpn.example.com" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono text-xs focus:outline-none focus:border-rose-500">
  2963. </div>
  2964. <div>
  2965. <label class="block font-semibold text-slate-300 mb-1.5">Endpoint Port</label>
  2966. <input type="number" id="wg-peer-modal-port" placeholder="51820" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono text-xs focus:outline-none focus:border-rose-500">
  2967. </div>
  2968. </div>
  2969. <div class="grid grid-cols-2 gap-4">
  2970. <div>
  2971. <label class="block font-semibold text-slate-300 mb-1.5">Keepalive (seconds)</label>
  2972. <input type="number" id="wg-peer-modal-keepalive" value="25" min="0" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono text-xs focus:outline-none focus:border-rose-500">
  2973. <p class="text-[10px] text-slate-500 mt-1">25s recommended for NAT traversal</p>
  2974. </div>
  2975. <div>
  2976. <div class="flex items-center justify-between mb-1.5">
  2977. <label class="font-semibold text-slate-300">Preshared Key</label>
  2978. <button type="button" onclick="generatePeerPSK()" class="text-[10px] text-purple-400 hover:text-purple-300 font-semibold">Generate</button>
  2979. </div>
  2980. <input type="password" id="wg-peer-modal-preshared" placeholder="Optional PSK" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono text-xs focus:outline-none focus:border-rose-500">
  2981. </div>
  2982. </div>
  2983. <div class="pt-1">
  2984. <label class="flex items-center space-x-2.5 cursor-pointer">
  2985. <input type="checkbox" id="wg-peer-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500 focus:ring-rose-500">
  2986. <span class="font-medium text-slate-300">Disabled (X)</span>
  2987. </label>
  2988. </div>
  2989. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2990. <button type="button" onclick="closeAddWGPeerModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800 transition">Cancel</button>
  2991. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-rose-600 hover:bg-rose-500 text-white shadow-lg shadow-rose-500/20 transition">Save Peer</button>
  2992. </div>
  2993. </form>
  2994. </div>
  2995. </div>
  2996. <!-- ================= MODAL: IPSEC TUNNEL ================= -->
  2997. <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">
  2998. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2999. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3000. <h3 id="ipsec-modal-title" class="text-sm font-bold text-white">Configure IPSec IKEv2 Tunnel</h3>
  3001. <button onclick="closeAddIPSecModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3002. </div>
  3003. <form onsubmit="submitSaveIPSec(event)" class="p-6 space-y-4">
  3004. <div>
  3005. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connection Name *</label>
  3006. <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">
  3007. </div>
  3008. <div class="grid grid-cols-2 gap-4">
  3009. <div>
  3010. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Local Subnet *</label>
  3011. <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">
  3012. </div>
  3013. <div>
  3014. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Subnet *</label>
  3015. <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">
  3016. </div>
  3017. </div>
  3018. <div>
  3019. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Gateway IP / FQDN *</label>
  3020. <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">
  3021. </div>
  3022. <div>
  3023. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Pre-Shared Key (PSK) *</label>
  3024. <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">
  3025. </div>
  3026. <div class="grid grid-cols-2 gap-4">
  3027. <div>
  3028. <label class="block text-xs font-semibold text-slate-300 mb-1.5">IKE Proposals</label>
  3029. <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">
  3030. </div>
  3031. <div>
  3032. <label class="block text-xs font-semibold text-slate-300 mb-1.5">ESP Proposals</label>
  3033. <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">
  3034. </div>
  3035. </div>
  3036. <div class="grid grid-cols-2 gap-4 pt-2">
  3037. <label class="flex items-center space-x-2 cursor-pointer">
  3038. <input type="checkbox" id="ipsec-modal-autostart" checked class="rounded bg-slate-800 border-slate-700 text-amber-500">
  3039. <span class="text-xs text-slate-300 font-medium">Auto-start on boot</span>
  3040. </label>
  3041. <label class="flex items-center space-x-2 cursor-pointer">
  3042. <input type="checkbox" id="ipsec-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3043. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  3044. </label>
  3045. </div>
  3046. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3047. <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>
  3048. <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>
  3049. </div>
  3050. </form>
  3051. </div>
  3052. </div>
  3053. <!-- ================= MODAL: L2TP CLIENT ================= -->
  3054. <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">
  3055. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3056. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3057. <h3 id="l2tp-modal-title" class="text-sm font-bold text-white">Add L2TP Client Interface</h3>
  3058. <button onclick="closeL2TPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3059. </div>
  3060. <form onsubmit="submitSaveL2TP(event)" class="p-6 space-y-4">
  3061. <div>
  3062. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
  3063. <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">
  3064. </div>
  3065. <div>
  3066. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
  3067. <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">
  3068. </div>
  3069. <div class="grid grid-cols-2 gap-4">
  3070. <div>
  3071. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  3072. <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">
  3073. </div>
  3074. <div>
  3075. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  3076. <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">
  3077. </div>
  3078. </div>
  3079. <div>
  3080. <label class="block text-xs font-semibold text-slate-300 mb-1.5">IPSec Secret / PSK (Optional for L2TP/IPsec)</label>
  3081. <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">
  3082. </div>
  3083. <div class="grid grid-cols-2 gap-4 pt-2">
  3084. <label class="flex items-center space-x-2 cursor-pointer">
  3085. <input type="checkbox" id="l2tp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-cyan-500">
  3086. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  3087. </label>
  3088. <label class="flex items-center space-x-2 cursor-pointer">
  3089. <input type="checkbox" id="l2tp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3090. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  3091. </label>
  3092. </div>
  3093. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3094. <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>
  3095. <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>
  3096. </div>
  3097. </form>
  3098. </div>
  3099. </div>
  3100. <!-- ================= MODAL: PPTP CLIENT ================= -->
  3101. <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">
  3102. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3103. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3104. <h3 id="pptp-modal-title" class="text-sm font-bold text-white">Add PPTP Client Interface</h3>
  3105. <button onclick="closePPTPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3106. </div>
  3107. <form onsubmit="submitSavePPTP(event)" class="p-6 space-y-4">
  3108. <div>
  3109. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
  3110. <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">
  3111. </div>
  3112. <div>
  3113. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
  3114. <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">
  3115. </div>
  3116. <div class="grid grid-cols-2 gap-4">
  3117. <div>
  3118. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  3119. <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">
  3120. </div>
  3121. <div>
  3122. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  3123. <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">
  3124. </div>
  3125. </div>
  3126. <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
  3127. <label class="flex items-center space-x-2 cursor-pointer">
  3128. <input type="checkbox" id="pptp-modal-mppe" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
  3129. <span class="text-xs text-slate-300 font-medium">MPPE-128</span>
  3130. </label>
  3131. <label class="flex items-center space-x-2 cursor-pointer">
  3132. <input type="checkbox" id="pptp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
  3133. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  3134. </label>
  3135. <label class="flex items-center space-x-2 cursor-pointer">
  3136. <input type="checkbox" id="pptp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3137. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  3138. </label>
  3139. </div>
  3140. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3141. <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>
  3142. <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>
  3143. </div>
  3144. </form>
  3145. </div>
  3146. </div>
  3147. <!-- ================= MODAL: FIREWALL FILTER RULE ================= -->
  3148. <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">
  3149. <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">
  3150. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3151. <h3 id="filter-modal-title" class="text-sm font-bold text-white">Add Firewall Filter Rule</h3>
  3152. <button onclick="closeFilterModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3153. </div>
  3154. <form onsubmit="submitSaveFilterRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  3155. <input type="hidden" id="filter-modal-id">
  3156. <div class="grid grid-cols-2 gap-4">
  3157. <div>
  3158. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  3159. <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">
  3160. <option value="input">input (traffic to router)</option>
  3161. <option value="forward" selected>forward (routed traffic)</option>
  3162. <option value="output">output (traffic from router)</option>
  3163. </select>
  3164. </div>
  3165. <div>
  3166. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  3167. <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">
  3168. <option value="accept" selected>accept</option>
  3169. <option value="drop">drop</option>
  3170. <option value="reject">reject</option>
  3171. <option value="log">log</option>
  3172. <option value="jump">jump</option>
  3173. <option value="return">return</option>
  3174. </select>
  3175. </div>
  3176. </div>
  3177. <div id="filter-action-reject-box" class="hidden p-3 bg-rose-950/20 border border-rose-900/30 rounded-lg">
  3178. <label class="block font-semibold text-rose-300 mb-1">Reject With</label>
  3179. <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">
  3180. <option value="icmp-network-unreachable">icmp-network-unreachable</option>
  3181. <option value="icmp-host-unreachable">icmp-host-unreachable</option>
  3182. <option value="icmp-port-unreachable">icmp-port-unreachable</option>
  3183. <option value="tcp-reset">tcp-reset (TCP RST)</option>
  3184. </select>
  3185. </div>
  3186. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3187. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
  3188. <div class="grid grid-cols-2 gap-3">
  3189. <div>
  3190. <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
  3191. <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">
  3192. <option value="all">all</option>
  3193. <option value="tcp">tcp (6)</option>
  3194. <option value="udp">udp (17)</option>
  3195. <option value="icmp">icmp (1)</option>
  3196. <option value="gre">gre (47)</option>
  3197. <option value="esp">esp (50)</option>
  3198. </select>
  3199. </div>
  3200. <div>
  3201. <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
  3202. <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">
  3203. </div>
  3204. </div>
  3205. <div class="grid grid-cols-2 gap-3">
  3206. <div>
  3207. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  3208. <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">
  3209. </div>
  3210. <div>
  3211. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  3212. <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">
  3213. </div>
  3214. </div>
  3215. <div class="grid grid-cols-2 gap-3">
  3216. <div>
  3217. <label class="block font-semibold text-slate-300 mb-1">Src. Port(s)</label>
  3218. <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">
  3219. </div>
  3220. <div>
  3221. <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
  3222. <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">
  3223. </div>
  3224. </div>
  3225. <div class="grid grid-cols-2 gap-3">
  3226. <div>
  3227. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  3228. <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>
  3229. </div>
  3230. <div>
  3231. <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
  3232. <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>
  3233. </div>
  3234. </div>
  3235. <div>
  3236. <label class="block font-semibold text-slate-300 mb-1.5">Connection State</label>
  3237. <div class="flex flex-wrap gap-3">
  3238. <label class="flex items-center space-x-1.5 cursor-pointer">
  3239. <input type="checkbox" id="filter-modal-cs-established" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3240. <span class="text-slate-300">established</span>
  3241. </label>
  3242. <label class="flex items-center space-x-1.5 cursor-pointer">
  3243. <input type="checkbox" id="filter-modal-cs-related" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3244. <span class="text-slate-300">related</span>
  3245. </label>
  3246. <label class="flex items-center space-x-1.5 cursor-pointer">
  3247. <input type="checkbox" id="filter-modal-cs-new" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3248. <span class="text-slate-300">new</span>
  3249. </label>
  3250. <label class="flex items-center space-x-1.5 cursor-pointer">
  3251. <input type="checkbox" id="filter-modal-cs-invalid" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3252. <span class="text-slate-300">invalid</span>
  3253. </label>
  3254. </div>
  3255. </div>
  3256. <div class="grid grid-cols-2 gap-3">
  3257. <div>
  3258. <div class="flex items-center justify-between mb-1">
  3259. <label class="font-semibold text-slate-300">Src. Address List</label>
  3260. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3261. <input type="checkbox" id="filter-modal-srclist-inv" class="rounded bg-slate-800 border-slate-700">
  3262. <span>! Invert</span>
  3263. </label>
  3264. </div>
  3265. <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">
  3266. <option value="">(None)</option>
  3267. </select>
  3268. </div>
  3269. <div>
  3270. <div class="flex items-center justify-between mb-1">
  3271. <label class="font-semibold text-slate-300">Dst. Address List</label>
  3272. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3273. <input type="checkbox" id="filter-modal-dstlist-inv" class="rounded bg-slate-800 border-slate-700">
  3274. <span>! Invert</span>
  3275. </label>
  3276. </div>
  3277. <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">
  3278. <option value="">(None)</option>
  3279. </select>
  3280. </div>
  3281. </div>
  3282. <div class="grid grid-cols-2 gap-3">
  3283. <div>
  3284. <div class="flex items-center justify-between mb-1">
  3285. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Source GEO IP List</span></label>
  3286. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3287. <input type="checkbox" id="filter-modal-srcgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3288. <span>! Invert</span>
  3289. </label>
  3290. </div>
  3291. <select id="filter-modal-srcgeoip" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  3292. <option value="">(None)</option>
  3293. </select>
  3294. </div>
  3295. <div>
  3296. <div class="flex items-center justify-between mb-1">
  3297. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Destination GEO IP List</span></label>
  3298. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3299. <input type="checkbox" id="filter-modal-dstgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3300. <span>! Invert</span>
  3301. </label>
  3302. </div>
  3303. <select id="filter-modal-dstgeoip" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  3304. <option value="">(None)</option>
  3305. </select>
  3306. </div>
  3307. </div>
  3308. </div>
  3309. <div>
  3310. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  3311. <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">
  3312. </div>
  3313. <div class="pt-2">
  3314. <label class="flex items-center space-x-2 cursor-pointer">
  3315. <input type="checkbox" id="filter-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3316. <span class="font-medium text-slate-300">Disabled (X)</span>
  3317. </label>
  3318. </div>
  3319. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3320. <button type="button" onclick="closeFilterModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3321. <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>
  3322. </div>
  3323. </form>
  3324. </div>
  3325. </div>
  3326. <!-- ================= MODAL: FIREWALL NAT RULE ================= -->
  3327. <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">
  3328. <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">
  3329. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3330. <h3 id="nat-modal-title" class="text-sm font-bold text-white">Add NAT Rule</h3>
  3331. <button onclick="closeNATModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3332. </div>
  3333. <form onsubmit="submitSaveNATRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  3334. <input type="hidden" id="nat-modal-id">
  3335. <div class="grid grid-cols-2 gap-4">
  3336. <div>
  3337. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  3338. <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">
  3339. <option value="srcnat" selected>srcnat (Outgoing / Masquerade)</option>
  3340. <option value="dstnat">dstnat (Incoming / Port Forwarding)</option>
  3341. </select>
  3342. </div>
  3343. <div>
  3344. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  3345. <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">
  3346. <option value="masquerade" selected>masquerade</option>
  3347. <option value="src-nat">src-nat</option>
  3348. <option value="dst-nat">dst-nat</option>
  3349. <option value="redirect">redirect</option>
  3350. <option value="accept">accept</option>
  3351. </select>
  3352. </div>
  3353. </div>
  3354. <div id="nat-action-to-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3355. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">NAT Target (To Addresses / Ports)</span>
  3356. <div class="grid grid-cols-2 gap-3">
  3357. <div>
  3358. <label class="block font-semibold text-slate-300 mb-1">To Addresses</label>
  3359. <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">
  3360. </div>
  3361. <div>
  3362. <label class="block font-semibold text-slate-300 mb-1">To Ports</label>
  3363. <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">
  3364. </div>
  3365. </div>
  3366. </div>
  3367. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3368. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
  3369. <div class="grid grid-cols-2 gap-3">
  3370. <div>
  3371. <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
  3372. <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">
  3373. <option value="all">all</option>
  3374. <option value="tcp">tcp</option>
  3375. <option value="udp">udp</option>
  3376. <option value="icmp">icmp</option>
  3377. </select>
  3378. </div>
  3379. <div>
  3380. <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
  3381. <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">
  3382. </div>
  3383. </div>
  3384. <div class="grid grid-cols-2 gap-3">
  3385. <div>
  3386. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  3387. <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">
  3388. </div>
  3389. <div>
  3390. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  3391. <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">
  3392. </div>
  3393. </div>
  3394. <div class="grid grid-cols-2 gap-3">
  3395. <div>
  3396. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  3397. <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>
  3398. </div>
  3399. <div>
  3400. <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
  3401. <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>
  3402. </div>
  3403. </div>
  3404. <div class="grid grid-cols-2 gap-3">
  3405. <div>
  3406. <div class="flex items-center justify-between mb-1">
  3407. <label class="font-semibold text-slate-300">Src. Address List</label>
  3408. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3409. <input type="checkbox" id="nat-modal-srclist-inv" class="rounded bg-slate-800 border-slate-700">
  3410. <span>! Invert</span>
  3411. </label>
  3412. </div>
  3413. <select id="nat-modal-srclist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  3414. </div>
  3415. <div>
  3416. <div class="flex items-center justify-between mb-1">
  3417. <label class="font-semibold text-slate-300">Dst. Address List</label>
  3418. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3419. <input type="checkbox" id="nat-modal-dstlist-inv" class="rounded bg-slate-800 border-slate-700">
  3420. <span>! Invert</span>
  3421. </label>
  3422. </div>
  3423. <select id="nat-modal-dstlist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  3424. </div>
  3425. </div>
  3426. <div class="grid grid-cols-2 gap-3">
  3427. <div>
  3428. <div class="flex items-center justify-between mb-1">
  3429. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Source GEO IP List</span></label>
  3430. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3431. <input type="checkbox" id="nat-modal-srcgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3432. <span>! Invert</span>
  3433. </label>
  3434. </div>
  3435. <select id="nat-modal-srcgeoip" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  3436. <option value="">(None)</option>
  3437. </select>
  3438. </div>
  3439. <div>
  3440. <div class="flex items-center justify-between mb-1">
  3441. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Destination GEO IP List</span></label>
  3442. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3443. <input type="checkbox" id="nat-modal-dstgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3444. <span>! Invert</span>
  3445. </label>
  3446. </div>
  3447. <select id="nat-modal-dstgeoip" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  3448. <option value="">(None)</option>
  3449. </select>
  3450. </div>
  3451. </div>
  3452. </div>
  3453. <div>
  3454. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  3455. <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">
  3456. </div>
  3457. <div class="pt-2">
  3458. <label class="flex items-center space-x-2 cursor-pointer">
  3459. <input type="checkbox" id="nat-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3460. <span class="font-medium text-slate-300">Disabled (X)</span>
  3461. </label>
  3462. </div>
  3463. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3464. <button type="button" onclick="closeNATModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3465. <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>
  3466. </div>
  3467. </form>
  3468. </div>
  3469. </div>
  3470. <!-- ================= MODAL: FIREWALL MANGLE RULE ================= -->
  3471. <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">
  3472. <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">
  3473. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3474. <h3 id="mangle-modal-title" class="text-sm font-bold text-white">Add Mangle Rule</h3>
  3475. <button onclick="closeMangleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3476. </div>
  3477. <form onsubmit="submitSaveMangleRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  3478. <input type="hidden" id="mangle-modal-id">
  3479. <div class="grid grid-cols-2 gap-4">
  3480. <div>
  3481. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  3482. <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">
  3483. <option value="prerouting" selected>prerouting (Policy Routing / Marks)</option>
  3484. <option value="forward">forward</option>
  3485. <option value="postrouting">postrouting</option>
  3486. <option value="input">input</option>
  3487. <option value="output">output</option>
  3488. </select>
  3489. </div>
  3490. <div>
  3491. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  3492. <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">
  3493. <option value="mark-connection" selected>mark-connection</option>
  3494. <option value="mark-routing">mark-routing (Policy Routing)</option>
  3495. <option value="mark-packet">mark-packet (QoS / Queues)</option>
  3496. <option value="change-mss">change-mss (TCP MSS Clamp)</option>
  3497. <option value="set-dscp">set-dscp</option>
  3498. <option value="accept">accept</option>
  3499. </select>
  3500. </div>
  3501. </div>
  3502. <div id="mangle-target-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3503. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Mark Target & Passthrough</span>
  3504. <div class="grid grid-cols-2 gap-3">
  3505. <div id="mangle-field-newmark">
  3506. <label class="block font-semibold text-slate-300 mb-1">New Mark Name</label>
  3507. <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">
  3508. </div>
  3509. <div class="flex items-center pt-5">
  3510. <label class="flex items-center space-x-2 cursor-pointer">
  3511. <input type="checkbox" id="mangle-modal-passthrough" checked class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3512. <span class="font-medium text-slate-300">Passthrough</span>
  3513. </label>
  3514. </div>
  3515. </div>
  3516. </div>
  3517. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3518. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Criteria</span>
  3519. <div class="grid grid-cols-2 gap-3">
  3520. <div>
  3521. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  3522. <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">
  3523. </div>
  3524. <div>
  3525. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  3526. <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">
  3527. </div>
  3528. </div>
  3529. <div class="grid grid-cols-2 gap-3">
  3530. <div>
  3531. <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
  3532. <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">
  3533. </div>
  3534. <div>
  3535. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  3536. <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>
  3537. </div>
  3538. </div>
  3539. <div class="grid grid-cols-2 gap-3">
  3540. <div>
  3541. <div class="flex items-center justify-between mb-1">
  3542. <label class="font-semibold text-slate-300">Src. Address List</label>
  3543. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3544. <input type="checkbox" id="mangle-modal-srclist-inv" class="rounded bg-slate-800 border-slate-700">
  3545. <span>! Invert</span>
  3546. </label>
  3547. </div>
  3548. <select id="mangle-modal-srclist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  3549. </div>
  3550. <div>
  3551. <div class="flex items-center justify-between mb-1">
  3552. <label class="font-semibold text-slate-300">Dst. Address List</label>
  3553. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3554. <input type="checkbox" id="mangle-modal-dstlist-inv" class="rounded bg-slate-800 border-slate-700">
  3555. <span>! Invert</span>
  3556. </label>
  3557. </div>
  3558. <select id="mangle-modal-dstlist" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono"></select>
  3559. </div>
  3560. </div>
  3561. <div class="grid grid-cols-2 gap-3">
  3562. <div>
  3563. <div class="flex items-center justify-between mb-1">
  3564. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Source GEO IP List</span></label>
  3565. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3566. <input type="checkbox" id="mangle-modal-srcgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3567. <span>! Invert</span>
  3568. </label>
  3569. </div>
  3570. <select id="mangle-modal-srcgeoip" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  3571. <option value="">(None)</option>
  3572. </select>
  3573. </div>
  3574. <div>
  3575. <div class="flex items-center justify-between mb-1">
  3576. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Destination GEO IP List</span></label>
  3577. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3578. <input type="checkbox" id="mangle-modal-dstgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3579. <span>! Invert</span>
  3580. </label>
  3581. </div>
  3582. <select id="mangle-modal-dstgeoip" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  3583. <option value="">(None)</option>
  3584. </select>
  3585. </div>
  3586. </div>
  3587. </div>
  3588. <div>
  3589. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  3590. <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">
  3591. </div>
  3592. <div class="pt-2">
  3593. <label class="flex items-center space-x-2 cursor-pointer">
  3594. <input type="checkbox" id="mangle-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3595. <span class="font-medium text-slate-300">Disabled (X)</span>
  3596. </label>
  3597. </div>
  3598. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3599. <button type="button" onclick="closeMangleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3600. <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>
  3601. </div>
  3602. </form>
  3603. </div>
  3604. </div>
  3605. <!-- ================= MODAL: ADDRESS LIST ENTRY ================= -->
  3606. <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">
  3607. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  3608. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3609. <h3 id="addrlist-modal-title" class="text-sm font-bold text-white">Add Address List Entry</h3>
  3610. <button onclick="closeAddrListModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3611. </div>
  3612. <form onsubmit="submitSaveAddrList(event)" class="p-6 space-y-4 text-xs">
  3613. <input type="hidden" id="addrlist-modal-id">
  3614. <div>
  3615. <label class="block font-semibold text-slate-300 mb-1.5">List Name *</label>
  3616. <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">
  3617. </div>
  3618. <div>
  3619. <label class="block font-semibold text-slate-300 mb-1.5">IP Address / Subnet (CIDR) *</label>
  3620. <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">
  3621. </div>
  3622. <div>
  3623. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3624. <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">
  3625. </div>
  3626. <div class="pt-2">
  3627. <label class="flex items-center space-x-2 cursor-pointer">
  3628. <input type="checkbox" id="addrlist-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3629. <span class="font-medium text-slate-300">Disabled (X)</span>
  3630. </label>
  3631. </div>
  3632. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3633. <button type="button" onclick="closeAddrListModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3634. <button type="submit" id="addrlist-modal-submit-btn" 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 Entry</button>
  3635. </div>
  3636. </form>
  3637. </div>
  3638. </div>
  3639. <!-- ================= MODAL: GEO INTERVAL SETTINGS ================= -->
  3640. <div id="geo-interval-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  3641. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  3642. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3643. <h3 class="text-sm font-bold text-white">Geo-Location Auto-Update Settings</h3>
  3644. <button onclick="closeGeoIntervalModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3645. </div>
  3646. <form onsubmit="submitGeoIntervalSettings(event)" class="p-6 space-y-4 text-xs">
  3647. <div class="p-3 bg-slate-950/60 border border-slate-800 rounded-xl space-y-2">
  3648. <label class="flex items-center space-x-2.5 cursor-pointer">
  3649. <input type="checkbox" id="geo-cfg-autoupdate" checked class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3650. <span class="font-semibold text-white">Enable Automatic Background Updates</span>
  3651. </label>
  3652. <p class="text-[11px] text-slate-400 pl-6">Automatically fetches the latest country IP blocks from IPdeny registries and updates active kernel ipsets without service interruption.</p>
  3653. </div>
  3654. <div>
  3655. <label class="block font-semibold text-slate-300 mb-1.5">Update Interval *</label>
  3656. <select id="geo-cfg-interval" onchange="toggleCustomGeoInterval()" 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">
  3657. <option value="12">Every 12 Hours</option>
  3658. <option value="24" selected>Every 24 Hours (Daily - Recommended)</option>
  3659. <option value="48">Every 48 Hours (2 Days)</option>
  3660. <option value="72">Every 3 Days</option>
  3661. <option value="168">Every 7 Days (Weekly)</option>
  3662. <option value="720">Every 30 Days (Monthly)</option>
  3663. <option value="custom">Custom Hours...</option>
  3664. </select>
  3665. </div>
  3666. <div id="geo-cfg-custom-box" class="hidden">
  3667. <label class="block font-semibold text-slate-300 mb-1.5">Custom Interval (Hours)</label>
  3668. <input type="number" id="geo-cfg-custom-hours" min="1" max="8760" value="24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3669. </div>
  3670. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3671. <button type="button" onclick="closeGeoIntervalModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3672. <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 Schedule</button>
  3673. </div>
  3674. </form>
  3675. </div>
  3676. </div>
  3677. <!-- ================= MODAL: GEO SUBNETS PREVIEW ================= -->
  3678. <div id="geo-subnets-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  3679. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3680. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3681. <div>
  3682. <h3 id="geo-subnets-title" class="text-sm font-bold text-white">Country Subnets</h3>
  3683. <span id="geo-subnets-subtitle" class="text-[11px] font-mono text-slate-400">CIDR Blocks</span>
  3684. </div>
  3685. <button onclick="closeGeoSubnetsModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3686. </div>
  3687. <div class="p-6 space-y-3 text-xs">
  3688. <p class="text-slate-400">Showing first 100 subnets in this country zone:</p>
  3689. <div id="geo-subnets-list" class="bg-slate-950 border border-slate-800 rounded-xl p-3 max-h-72 overflow-y-auto font-mono text-[11px] text-emerald-400 space-y-1"></div>
  3690. <div class="pt-3 border-t border-slate-800 flex justify-end">
  3691. <button type="button" onclick="closeGeoSubnetsModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Close</button>
  3692. </div>
  3693. </div>
  3694. </div>
  3695. </div>
  3696. <!-- ================= MODAL: ADD / EDIT ROUTE ================= -->
  3697. <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">
  3698. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3699. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3700. <h3 id="route-modal-title" class="text-sm font-bold text-white">Add Static Route</h3>
  3701. <button onclick="closeRouteModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3702. </div>
  3703. <form onsubmit="submitSaveRoute(event)" class="p-6 space-y-4 text-xs">
  3704. <input type="hidden" id="route-modal-id">
  3705. <input type="hidden" id="route-modal-old-dst">
  3706. <input type="hidden" id="route-modal-old-gw">
  3707. <input type="hidden" id="route-modal-old-distance">
  3708. <input type="hidden" id="route-modal-old-table">
  3709. <input type="hidden" id="route-modal-old-iface">
  3710. <div>
  3711. <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR) *</label>
  3712. <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">
  3713. </div>
  3714. <div class="grid grid-cols-2 gap-4">
  3715. <div>
  3716. <label class="block font-semibold text-slate-300 mb-1.5">Gateway (IP or Interface)</label>
  3717. <input type="text" id="route-modal-gw" placeholder="10.42.36.1 or wg0" 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">
  3718. </div>
  3719. <div>
  3720. <label class="block font-semibold text-slate-300 mb-1.5">Routing Table / Mark</label>
  3721. <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">
  3722. <option value="main" selected>main</option>
  3723. </select>
  3724. </div>
  3725. </div>
  3726. <div class="grid grid-cols-2 gap-4">
  3727. <div>
  3728. <label class="block font-semibold text-slate-300 mb-1.5">Distance (Metric)</label>
  3729. <input type="number" id="route-modal-distance" value="1" min="0" max="255" 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">
  3730. </div>
  3731. <div>
  3732. <label class="block font-semibold text-slate-300 mb-1.5">Interface (Optional)</label>
  3733. <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 focus:outline-none focus:border-cyan-500"></select>
  3734. </div>
  3735. </div>
  3736. <div>
  3737. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3738. <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">
  3739. </div>
  3740. <div class="pt-2">
  3741. <label class="flex items-center space-x-2 cursor-pointer">
  3742. <input type="checkbox" id="route-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3743. <span class="font-medium text-slate-300">Disabled (X)</span>
  3744. </label>
  3745. </div>
  3746. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3747. <button type="button" onclick="closeRouteModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3748. <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>
  3749. </div>
  3750. </form>
  3751. </div>
  3752. </div>
  3753. <!-- ================= MODAL: ADD POLICY ROUTING RULE ================= -->
  3754. <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">
  3755. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3756. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3757. <h3 id="prule-modal-title" class="text-sm font-bold text-white">Add Policy Routing Rule (/ip route rule)</h3>
  3758. <button onclick="closePolicyRuleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3759. </div>
  3760. <form onsubmit="submitSavePolicyRule(event)" class="p-6 space-y-4 text-xs">
  3761. <input type="hidden" id="prule-modal-id">
  3762. <div class="grid grid-cols-2 gap-4">
  3763. <div>
  3764. <label class="block font-semibold text-slate-300 mb-1.5">Priority / Preference</label>
  3765. <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">
  3766. </div>
  3767. <div>
  3768. <label class="block font-semibold text-slate-300 mb-1.5">Routing Mark (fwmark)</label>
  3769. <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">
  3770. </div>
  3771. </div>
  3772. <div class="grid grid-cols-2 gap-4">
  3773. <div>
  3774. <label class="block font-semibold text-slate-300 mb-1.5">Src. Address (CIDR)</label>
  3775. <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">
  3776. </div>
  3777. <div>
  3778. <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR)</label>
  3779. <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">
  3780. </div>
  3781. </div>
  3782. <div class="grid grid-cols-2 gap-4">
  3783. <div>
  3784. <label class="block font-semibold text-slate-300 mb-1.5">Lookup Table *</label>
  3785. <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>
  3786. </div>
  3787. <div>
  3788. <label class="block font-semibold text-slate-300 mb-1.5">Action</label>
  3789. <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">
  3790. <option value="lookup" selected>lookup (standard)</option>
  3791. <option value="unreachable">unreachable</option>
  3792. <option value="blackhole">blackhole</option>
  3793. </select>
  3794. </div>
  3795. </div>
  3796. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3797. <button type="button" onclick="closePolicyRuleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3798. <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>
  3799. </div>
  3800. </form>
  3801. </div>
  3802. </div>
  3803. <!-- ================= MODAL: CREATE ROUTING TABLE ================= -->
  3804. <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">
  3805. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  3806. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3807. <h3 class="text-sm font-bold text-white">Create New Routing Table</h3>
  3808. <button onclick="closeTableModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3809. </div>
  3810. <form onsubmit="submitSaveTable(event)" class="p-6 space-y-4 text-xs">
  3811. <div>
  3812. <label class="block font-semibold text-slate-300 mb-1.5">Table Name *</label>
  3813. <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">
  3814. </div>
  3815. <div>
  3816. <label class="block font-semibold text-slate-300 mb-1.5">FIB Table ID (Optional)</label>
  3817. <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">
  3818. </div>
  3819. <div>
  3820. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3821. <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">
  3822. </div>
  3823. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3824. <button type="button" onclick="closeTableModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3825. <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>
  3826. </div>
  3827. </form>
  3828. </div>
  3829. </div>
  3830. <!-- ================= MODAL: ADD/EDIT EoIP TUNNEL ================= -->
  3831. <div id="eoip-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  3832. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3833. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3834. <div>
  3835. <h3 id="eoip-modal-title" class="text-sm font-bold text-white">Add EoIP Tunnel</h3>
  3836. <p class="text-[11px] text-slate-400">MikroTik RouterOS Layer 2 GRETAP Tunnel</p>
  3837. </div>
  3838. <button onclick="closeEoIPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3839. </div>
  3840. <form onsubmit="submitSaveEoIP(event)" class="p-6 space-y-4 text-xs font-sans">
  3841. <input type="hidden" id="eoip-modal-id">
  3842. <div class="grid grid-cols-2 gap-4">
  3843. <div>
  3844. <label class="block font-semibold text-slate-300 mb-1.5">Interface Name *</label>
  3845. <input type="text" id="eoip-modal-name" placeholder="eoip-tunnel1" 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">
  3846. </div>
  3847. <div>
  3848. <label class="block font-semibold text-slate-300 mb-1.5">Tunnel ID (1 - 65535) *</label>
  3849. <input type="number" id="eoip-modal-tunnelid" min="1" max="65535" placeholder="10" 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">
  3850. </div>
  3851. </div>
  3852. <div class="grid grid-cols-2 gap-4">
  3853. <div>
  3854. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (Remote Router IP) *</label>
  3855. <input type="text" id="eoip-modal-remote" placeholder="e.g. 10.2.145.253" 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">
  3856. <span class="text-[10px] text-slate-400">Underlay IP of the remote MikroTik router</span>
  3857. </div>
  3858. <div>
  3859. <label class="block font-semibold text-slate-300 mb-1.5">Tunnel IP / Subnet (CIDR)</label>
  3860. <input type="text" id="eoip-modal-ip" placeholder="e.g. 172.16.33.254/30" 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">
  3861. <span class="text-[10px] text-slate-400">Overlay IPv4 assigned directly to tunnel (/30, /24)</span>
  3862. </div>
  3863. </div>
  3864. <div class="grid grid-cols-2 gap-4">
  3865. <div>
  3866. <label class="block font-semibold text-slate-300 mb-1.5">Underlay Local IP (GRE Source)</label>
  3867. <input type="text" id="eoip-modal-local" placeholder="e.g. 10.42.36.5" 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">
  3868. <span class="text-[10px] text-slate-400">Local router IP for outer GRE packets</span>
  3869. </div>
  3870. <div>
  3871. <label class="block font-semibold text-slate-300 mb-1.5">MAC Address (Auto if empty)</label>
  3872. <input type="text" id="eoip-modal-mac" placeholder="02:64:xx:xx:xx:xx" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3873. </div>
  3874. </div>
  3875. <div class="grid grid-cols-2 gap-4">
  3876. <div>
  3877. <label class="block font-semibold text-slate-300 mb-1.5">MTU</label>
  3878. <input type="number" id="eoip-modal-mtu" value="1500" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3879. </div>
  3880. <div>
  3881. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3882. <input type="text" id="eoip-modal-comment" placeholder="Bridge to Office Branch" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  3883. </div>
  3884. </div>
  3885. <div class="flex items-center justify-between pt-1">
  3886. <label class="flex items-center space-x-2 text-slate-300">
  3887. <input type="checkbox" id="eoip-modal-clampmss" checked class="rounded bg-slate-800 border-slate-700 text-emerald-600">
  3888. <span>Clamp TCP MSS (PMTUD protection)</span>
  3889. </label>
  3890. <label class="flex items-center space-x-2 text-slate-300">
  3891. <input type="checkbox" id="eoip-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-600">
  3892. <span>Disabled</span>
  3893. </label>
  3894. </div>
  3895. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3896. <button type="button" onclick="closeEoIPModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3897. <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 Tunnel</button>
  3898. </div>
  3899. </form>
  3900. </div>
  3901. </div>
  3902. <!-- ================= MODAL: ADD/EDIT PPP SECRET (USER) ================= -->
  3903. <div id="ppp-secret-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  3904. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3905. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3906. <div>
  3907. <h3 id="secret-modal-title" class="text-sm font-bold text-white">Add PPP Secret</h3>
  3908. <p class="text-[11px] text-slate-400">User account for PPPoE, PPTP, and L2TP authentication</p>
  3909. </div>
  3910. <button onclick="closePPPSecretModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3911. </div>
  3912. <form onsubmit="submitSavePPPSecret(event)" class="p-6 space-y-4 text-xs font-sans">
  3913. <input type="hidden" id="secret-modal-id">
  3914. <div class="grid grid-cols-2 gap-4">
  3915. <div>
  3916. <label class="block font-semibold text-slate-300 mb-1.5">Username (Name) *</label>
  3917. <input type="text" id="secret-modal-name" placeholder="client_user1" 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-violet-500">
  3918. </div>
  3919. <div>
  3920. <label class="block font-semibold text-slate-300 mb-1.5">Password *</label>
  3921. <input type="password" id="secret-modal-password" placeholder="••••••••" 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-violet-500">
  3922. </div>
  3923. </div>
  3924. <div class="grid grid-cols-2 gap-4">
  3925. <div>
  3926. <label class="block font-semibold text-slate-300 mb-1.5">Service</label>
  3927. <select id="secret-modal-service" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3928. <option value="any">any</option>
  3929. <option value="pppoe">pppoe</option>
  3930. <option value="pptp">pptp</option>
  3931. <option value="l2tp">l2tp</option>
  3932. </select>
  3933. </div>
  3934. <div>
  3935. <label class="block font-semibold text-slate-300 mb-1.5">Profile</label>
  3936. <select id="secret-modal-profile" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  3937. </div>
  3938. </div>
  3939. <div class="grid grid-cols-2 gap-4">
  3940. <div>
  3941. <label class="block font-semibold text-slate-300 mb-1.5">Local Address (Optional)</label>
  3942. <input type="text" id="secret-modal-local" placeholder="Override server IP" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3943. </div>
  3944. <div>
  3945. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (Optional Static IP)</label>
  3946. <input type="text" id="secret-modal-remote" placeholder="Static client IP" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3947. </div>
  3948. </div>
  3949. <div>
  3950. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3951. <input type="text" id="secret-modal-comment" placeholder="Home user / Office user" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  3952. </div>
  3953. <div class="flex items-center space-x-2 pt-1">
  3954. <input type="checkbox" id="secret-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-600">
  3955. <label for="secret-modal-disabled" class="text-slate-300">Disabled</label>
  3956. </div>
  3957. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3958. <button type="button" onclick="closePPPSecretModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3959. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-violet-600 hover:bg-violet-500 text-white shadow-lg shadow-violet-500/20">Save Secret</button>
  3960. </div>
  3961. </form>
  3962. </div>
  3963. </div>
  3964. <!-- ================= MODAL: ADD/EDIT PPP PROFILE ================= -->
  3965. <div id="ppp-profile-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  3966. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3967. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3968. <div>
  3969. <h3 id="profile-modal-title" class="text-sm font-bold text-white">Add PPP Profile</h3>
  3970. <p class="text-[11px] text-slate-400">IP pool and encryption settings for PPP servers</p>
  3971. </div>
  3972. <button onclick="closePPPProfileModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3973. </div>
  3974. <form onsubmit="submitSavePPPProfile(event)" class="p-6 space-y-4 text-xs font-sans">
  3975. <input type="hidden" id="profile-modal-id">
  3976. <div>
  3977. <label class="block font-semibold text-slate-300 mb-1.5">Profile Name *</label>
  3978. <input type="text" id="profile-modal-name" placeholder="e.g. office-pool" 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-violet-500">
  3979. </div>
  3980. <div class="grid grid-cols-2 gap-4">
  3981. <div>
  3982. <label class="block font-semibold text-slate-300 mb-1.5">Local Address *</label>
  3983. <input type="text" id="profile-modal-local" placeholder="10.10.10.1" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3984. </div>
  3985. <div>
  3986. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (Pool) *</label>
  3987. <input type="text" id="profile-modal-remote" placeholder="10.10.10.10-10.10.10.50" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3988. </div>
  3989. </div>
  3990. <div class="grid grid-cols-2 gap-4">
  3991. <div>
  3992. <label class="block font-semibold text-slate-300 mb-1.5">DNS Servers</label>
  3993. <input type="text" id="profile-modal-dns" value="1.1.1.1,8.8.8.8" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3994. </div>
  3995. <div>
  3996. <label class="block font-semibold text-slate-300 mb-1.5">Use Encryption</label>
  3997. <select id="profile-modal-encryption" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  3998. <option value="no">no</option>
  3999. <option value="yes">yes</option>
  4000. <option value="required" selected>required (MPPE-128)</option>
  4001. </select>
  4002. </div>
  4003. </div>
  4004. <div>
  4005. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4006. <input type="text" id="profile-modal-comment" placeholder="Description of this profile" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4007. </div>
  4008. <div class="flex items-center space-x-2 pt-1">
  4009. <input type="checkbox" id="profile-modal-onlyone" checked class="rounded bg-slate-800 border-slate-700 text-violet-600">
  4010. <label for="profile-modal-onlyone" class="text-slate-300">Only One session per user account</label>
  4011. </div>
  4012. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4013. <button type="button" onclick="closePPPProfileModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4014. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-violet-600 hover:bg-violet-500 text-white shadow-lg shadow-violet-500/20">Save Profile</button>
  4015. </div>
  4016. </form>
  4017. </div>
  4018. </div>
  4019. <!-- ================= MODAL: IPSEC ROADWARRIOR SERVER ================= -->
  4020. <div id="ipsec-server-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4021. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4022. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4023. <div>
  4024. <h3 class="text-sm font-bold text-white">IPSec (IKEv2) Roadwarrior Server</h3>
  4025. <p class="text-[11px] text-slate-400">Mobile VPN server for Windows, macOS, iOS, Android clients</p>
  4026. </div>
  4027. <button onclick="closeIPSecServerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4028. </div>
  4029. <form onsubmit="submitSaveIPSecServer(event)" class="p-6 space-y-4 text-xs font-sans">
  4030. <div class="flex items-center justify-between border-b border-slate-800 pb-3">
  4031. <span class="text-slate-300 font-semibold">Server State</span>
  4032. <div class="flex items-center gap-3">
  4033. <span id="modal-ipsec-server-status" class="px-2 py-0.5 rounded text-[10px] font-mono font-semibold bg-slate-800 text-slate-400">STOPPED</span>
  4034. <label class="relative inline-flex items-center cursor-pointer">
  4035. <input type="checkbox" id="modal-ipsec-server-enabled" class="sr-only peer">
  4036. <div class="w-11 h-6 bg-slate-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-amber-600"></div>
  4037. </label>
  4038. </div>
  4039. </div>
  4040. <div>
  4041. <label class="block font-semibold text-slate-300 mb-1.5">Pre-Shared Key (PSK) *</label>
  4042. <input type="password" id="modal-ipsec-server-psk" placeholder="••••••••" 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-amber-500">
  4043. </div>
  4044. <div class="grid grid-cols-2 gap-4">
  4045. <div>
  4046. <label class="block font-semibold text-slate-300 mb-1.5">Virtual IP Pool (CIDR) *</label>
  4047. <input type="text" id="modal-ipsec-server-pool" value="10.10.30.0/24" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4048. </div>
  4049. <div>
  4050. <label class="block font-semibold text-slate-300 mb-1.5">DNS Servers</label>
  4051. <input type="text" id="modal-ipsec-server-dns" value="1.1.1.1,8.8.8.8" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4052. </div>
  4053. </div>
  4054. <div>
  4055. <label class="block font-semibold text-slate-300 mb-1.5">Local Traffic Selector (Subnet)</label>
  4056. <input type="text" id="modal-ipsec-server-subnet" value="0.0.0.0/0" placeholder="0.0.0.0/0 (Full Tunnel)" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4057. </div>
  4058. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4059. <button type="button" onclick="closeIPSecServerModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4060. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-amber-600 hover:bg-amber-500 text-white shadow-lg shadow-amber-500/20">Apply IPSec Server</button>
  4061. </div>
  4062. </form>
  4063. </div>
  4064. </div>
  4065. <!-- ================= MODAL: WIREGUARD CLIENT CONFIG VIEWER ================= -->
  4066. <div id="wg-client-conf-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4067. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4068. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4069. <div>
  4070. <h3 class="text-sm font-bold text-white">WireGuard Client Configuration</h3>
  4071. <p class="text-[11px] text-slate-400">Import this .conf into WireGuard on iOS, Android, macOS or Windows</p>
  4072. </div>
  4073. <button onclick="closeWGClientConfModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4074. </div>
  4075. <div class="p-6 space-y-4">
  4076. <div>
  4077. <label class="block text-xs font-semibold text-slate-300 mb-1.5">WireGuard Client Profile (.conf)</label>
  4078. <textarea id="wg-client-conf-text" rows="11" readonly class="w-full bg-slate-950 border border-slate-800 rounded-xl p-3 text-xs font-mono text-cyan-300 select-all focus:outline-none"></textarea>
  4079. </div>
  4080. <div class="flex justify-between items-center pt-2">
  4081. <span class="text-[11px] text-slate-500">Ready for instant import</span>
  4082. <div class="space-x-2">
  4083. <button onclick="copyWGClientConf()" class="px-4 py-2 rounded-lg text-xs font-semibold bg-slate-800 hover:bg-slate-700 text-white border border-slate-700 transition">
  4084. Copy Config
  4085. </button>
  4086. <button onclick="downloadWGClientConf()" class="px-4 py-2 rounded-lg text-xs font-semibold bg-cyan-600 hover:bg-cyan-500 text-white shadow-lg shadow-cyan-500/20 transition">
  4087. Download .conf
  4088. </button>
  4089. </div>
  4090. </div>
  4091. </div>
  4092. </div>
  4093. </div>
  4094. <!-- ================= MODAL: BGP INSTANCE SETTINGS ================= -->
  4095. <div id="bgp-instance-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4096. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4097. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4098. <div>
  4099. <h3 class="text-sm font-bold text-white">BGP Instance Settings (/routing bgp instance)</h3>
  4100. <p class="text-[11px] text-slate-400">Configure global Autonomous System and route redistribution</p>
  4101. </div>
  4102. <button onclick="closeBgpInstanceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4103. </div>
  4104. <form id="bgp-instance-form" onsubmit="submitBgpInstance(event)" class="p-6 space-y-4 text-xs">
  4105. <div class="flex items-center justify-between p-3 rounded-xl bg-slate-800/60 border border-slate-700/60">
  4106. <div>
  4107. <div class="font-semibold text-white">Enable BGP Routing</div>
  4108. <div class="text-[11px] text-slate-400">Run FRRouting bgpd service for dynamic exterior gateway routing</div>
  4109. </div>
  4110. <input type="checkbox" id="modal-bgp-enabled" class="w-4 h-4 rounded text-purple-600 focus:ring-purple-500 bg-slate-800 border-slate-600">
  4111. </div>
  4112. <div class="grid grid-cols-2 gap-4">
  4113. <div>
  4114. <label class="block font-semibold text-slate-300 mb-1.5">Autonomous System (AS) *</label>
  4115. <input type="number" id="modal-bgp-as" required min="1" max="4294967295" placeholder="65001" 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-purple-500">
  4116. </div>
  4117. <div>
  4118. <label class="block font-semibold text-slate-300 mb-1.5">Router ID</label>
  4119. <input type="text" id="modal-bgp-router-id" placeholder="192.168.131.56" 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-purple-500">
  4120. </div>
  4121. </div>
  4122. <div class="grid grid-cols-2 gap-4">
  4123. <div>
  4124. <label class="block font-semibold text-slate-300 mb-1.5">Keepalive Time (s)</label>
  4125. <input type="number" id="modal-bgp-keepalive" value="60" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4126. </div>
  4127. <div>
  4128. <label class="block font-semibold text-slate-300 mb-1.5">Hold Time (s)</label>
  4129. <input type="number" id="modal-bgp-holdtime" value="180" min="3" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4130. </div>
  4131. </div>
  4132. <div class="border-t border-slate-800 pt-3">
  4133. <label class="block font-semibold text-slate-300 mb-2">Redistribute Routes into BGP</label>
  4134. <div class="space-y-2">
  4135. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4136. <input type="checkbox" id="modal-bgp-redist-conn" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4137. <span>Redistribute Connected Subnets</span>
  4138. </label>
  4139. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4140. <input type="checkbox" id="modal-bgp-redist-static" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4141. <span>Redistribute Static Routes</span>
  4142. </label>
  4143. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4144. <input type="checkbox" id="modal-bgp-redist-ospf" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4145. <span>Redistribute OSPF Routes</span>
  4146. </label>
  4147. </div>
  4148. </div>
  4149. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4150. <button type="button" onclick="closeBgpInstanceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4151. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20">Save BGP Settings</button>
  4152. </div>
  4153. </form>
  4154. </div>
  4155. </div>
  4156. <!-- ================= MODAL: BGP PEER ================= -->
  4157. <div id="bgp-peer-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4158. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4159. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4160. <div>
  4161. <h3 id="bgp-peer-modal-title" class="text-sm font-bold text-white">Add BGP Peer Connection</h3>
  4162. <p class="text-[11px] text-slate-400">Establish eBGP / iBGP session with remote router</p>
  4163. </div>
  4164. <button onclick="closeBgpPeerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4165. </div>
  4166. <form id="bgp-peer-form" onsubmit="submitBgpPeer(event)" class="p-6 space-y-4 text-xs">
  4167. <input type="hidden" id="modal-bgp-peer-id">
  4168. <div>
  4169. <label class="block font-semibold text-slate-300 mb-1.5">Connection Name *</label>
  4170. <input type="text" id="modal-bgp-peer-name" required placeholder="upstream-carrier-a" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4171. </div>
  4172. <div class="grid grid-cols-2 gap-4">
  4173. <div>
  4174. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (IP) *</label>
  4175. <input type="text" id="modal-bgp-peer-remote-addr" required placeholder="192.168.131.1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4176. </div>
  4177. <div>
  4178. <label class="block font-semibold text-slate-300 mb-1.5">Remote AS *</label>
  4179. <input type="number" id="modal-bgp-peer-remote-as" required min="1" max="4294967295" placeholder="65000" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4180. </div>
  4181. </div>
  4182. <div class="grid grid-cols-2 gap-4">
  4183. <div>
  4184. <label class="block font-semibold text-slate-300 mb-1.5">Local Address (Update Source)</label>
  4185. <input type="text" id="modal-bgp-peer-local-addr" placeholder="Optional source IP/iface" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4186. </div>
  4187. <div>
  4188. <label class="block font-semibold text-slate-300 mb-1.5">MD5 Password (BGP Auth)</label>
  4189. <input type="password" id="modal-bgp-peer-password" placeholder="Optional secret" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4190. </div>
  4191. </div>
  4192. <div class="grid grid-cols-2 gap-4">
  4193. <div>
  4194. <label class="block font-semibold text-slate-300 mb-1.5">In Filter (Routing Filter Chain)</label>
  4195. <input type="text" id="modal-bgp-peer-in-filter" placeholder="e.g. bgp-in" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4196. <p class="text-[10px] text-slate-500 mt-0.5">Filter chain for inbound routes from peer</p>
  4197. </div>
  4198. <div>
  4199. <label class="block font-semibold text-slate-300 mb-1.5">Out Filter (Routing Filter Chain)</label>
  4200. <input type="text" id="modal-bgp-peer-out-filter" placeholder="e.g. bgp-out" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4201. <p class="text-[10px] text-slate-500 mt-0.5">Filter chain for outbound routes to peer</p>
  4202. </div>
  4203. </div>
  4204. <div class="grid grid-cols-2 gap-3 p-3 rounded-xl bg-slate-800/40 border border-slate-700/50">
  4205. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4206. <input type="checkbox" id="modal-bgp-peer-multihop" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4207. <span>eBGP Multi-hop</span>
  4208. </label>
  4209. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4210. <input type="checkbox" id="modal-bgp-peer-nexthop-self" checked class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4211. <span>Next-hop Self</span>
  4212. </label>
  4213. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4214. <input type="checkbox" id="modal-bgp-peer-passive" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4215. <span>Passive Mode</span>
  4216. </label>
  4217. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4218. <input type="checkbox" id="modal-bgp-peer-disabled" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4219. <span>Disabled (X)</span>
  4220. </label>
  4221. </div>
  4222. <div>
  4223. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4224. <input type="text" id="modal-bgp-peer-comment" placeholder="Core transit uplink" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4225. </div>
  4226. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4227. <button type="button" onclick="closeBgpPeerModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4228. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20">Save Peer</button>
  4229. </div>
  4230. </form>
  4231. </div>
  4232. </div>
  4233. <!-- ================= MODAL: BGP NETWORK ================= -->
  4234. <div id="bgp-network-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4235. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  4236. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4237. <h3 id="bgp-network-modal-title" class="text-sm font-bold text-white">Advertise BGP Network</h3>
  4238. <button onclick="closeBgpNetworkModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4239. </div>
  4240. <form id="bgp-network-form" onsubmit="submitBgpNetwork(event)" class="p-6 space-y-4 text-xs">
  4241. <input type="hidden" id="modal-bgp-net-id">
  4242. <div>
  4243. <label class="block font-semibold text-slate-300 mb-1.5">Network Prefix (CIDR) *</label>
  4244. <input type="text" id="modal-bgp-net-cidr" required placeholder="10.200.0.0/24" 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-purple-500">
  4245. </div>
  4246. <div>
  4247. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4248. <input type="text" id="modal-bgp-net-comment" placeholder="Public IP block prefix" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4249. </div>
  4250. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4251. <input type="checkbox" id="modal-bgp-net-disabled" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4252. <span>Disabled</span>
  4253. </label>
  4254. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4255. <button type="button" onclick="closeBgpNetworkModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4256. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-purple-600 hover:bg-purple-500 text-white shadow-lg shadow-purple-500/20">Save Network</button>
  4257. </div>
  4258. </form>
  4259. </div>
  4260. </div>
  4261. <!-- ================= MODAL: OSPF INSTANCE SETTINGS ================= -->
  4262. <div id="ospf-instance-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4263. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4264. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4265. <div>
  4266. <h3 class="text-sm font-bold text-white">OSPF Instance Settings (/routing ospf instance)</h3>
  4267. <p class="text-[11px] text-slate-400">Configure OSPFv2 link-state routing daemon and redistributions</p>
  4268. </div>
  4269. <button onclick="closeOspfInstanceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4270. </div>
  4271. <form id="ospf-instance-form" onsubmit="submitOspfInstance(event)" class="p-6 space-y-4 text-xs">
  4272. <div class="flex items-center justify-between p-3 rounded-xl bg-slate-800/60 border border-slate-700/60">
  4273. <div>
  4274. <div class="font-semibold text-white">Enable OSPF Routing</div>
  4275. <div class="text-[11px] text-slate-400">Run FRRouting ospfd service for dynamic interior gateway routing</div>
  4276. </div>
  4277. <input type="checkbox" id="modal-ospf-enabled" class="w-4 h-4 rounded text-indigo-600 focus:ring-indigo-500 bg-slate-800 border-slate-600">
  4278. </div>
  4279. <div class="grid grid-cols-2 gap-4">
  4280. <div>
  4281. <label class="block font-semibold text-slate-300 mb-1.5">Router ID</label>
  4282. <input type="text" id="modal-ospf-router-id" placeholder="192.168.131.56" 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-indigo-500">
  4283. </div>
  4284. <div>
  4285. <label class="block font-semibold text-slate-300 mb-1.5">Default Metric</label>
  4286. <input type="number" id="modal-ospf-metric" value="10" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4287. </div>
  4288. </div>
  4289. <div class="border-t border-slate-800 pt-3">
  4290. <label class="block font-semibold text-slate-300 mb-2">Redistribute Routes into OSPF</label>
  4291. <div class="space-y-2">
  4292. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4293. <input type="checkbox" id="modal-ospf-redist-conn" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4294. <span>Redistribute Connected Subnets</span>
  4295. </label>
  4296. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4297. <input type="checkbox" id="modal-ospf-redist-static" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4298. <span>Redistribute Static Routes</span>
  4299. </label>
  4300. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4301. <input type="checkbox" id="modal-ospf-redist-bgp" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4302. <span>Redistribute BGP Routes</span>
  4303. </label>
  4304. </div>
  4305. </div>
  4306. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4307. <button type="button" onclick="closeOspfInstanceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4308. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-indigo-600 hover:bg-indigo-500 text-white shadow-lg shadow-indigo-500/20">Save OSPF Settings</button>
  4309. </div>
  4310. </form>
  4311. </div>
  4312. </div>
  4313. <!-- ================= MODAL: OSPF AREA ================= -->
  4314. <div id="ospf-area-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4315. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  4316. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4317. <h3 id="ospf-area-modal-title" class="text-sm font-bold text-white">Add OSPF Area</h3>
  4318. <button onclick="closeOspfAreaModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4319. </div>
  4320. <form id="ospf-area-form" onsubmit="submitOspfArea(event)" class="p-6 space-y-4 text-xs">
  4321. <input type="hidden" id="modal-ospf-area-id">
  4322. <div>
  4323. <label class="block font-semibold text-slate-300 mb-1.5">Area Name *</label>
  4324. <input type="text" id="modal-ospf-area-name" required placeholder="backbone" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4325. </div>
  4326. <div class="grid grid-cols-2 gap-4">
  4327. <div>
  4328. <label class="block font-semibold text-slate-300 mb-1.5">Area ID *</label>
  4329. <input type="text" id="modal-ospf-area-areaid" required placeholder="0.0.0.0" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4330. </div>
  4331. <div>
  4332. <label class="block font-semibold text-slate-300 mb-1.5">Area Type</label>
  4333. <select id="modal-ospf-area-type" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4334. <option value="default">Default / Normal</option>
  4335. <option value="stub">Stub</option>
  4336. <option value="nssa">NSSA</option>
  4337. </select>
  4338. </div>
  4339. </div>
  4340. <div>
  4341. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4342. <input type="text" id="modal-ospf-area-comment" placeholder="Area description" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4343. </div>
  4344. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4345. <button type="button" onclick="closeOspfAreaModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4346. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-indigo-600 hover:bg-indigo-500 text-white shadow-lg shadow-indigo-500/20">Save Area</button>
  4347. </div>
  4348. </form>
  4349. </div>
  4350. </div>
  4351. <!-- ================= MODAL: OSPF INTERFACE ================= -->
  4352. <div id="ospf-interface-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4353. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4354. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4355. <div>
  4356. <h3 id="ospf-interface-modal-title" class="text-sm font-bold text-white">Add OSPF Interface</h3>
  4357. <p class="text-[11px] text-slate-400">Configure OSPF link parameters on a network subnet or interface</p>
  4358. </div>
  4359. <button onclick="closeOspfInterfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4360. </div>
  4361. <form id="ospf-interface-form" onsubmit="submitOspfInterface(event)" class="p-6 space-y-4 text-xs">
  4362. <input type="hidden" id="modal-ospf-iface-id">
  4363. <div class="grid grid-cols-2 gap-4">
  4364. <div>
  4365. <label class="block font-semibold text-slate-300 mb-1.5">Subnet Network (CIDR) *</label>
  4366. <input type="text" id="modal-ospf-iface-net" required placeholder="192.168.131.0/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4367. </div>
  4368. <div>
  4369. <label class="block font-semibold text-slate-300 mb-1.5">OSPF Area *</label>
  4370. <input type="text" id="modal-ospf-iface-area" required value="0.0.0.0" placeholder="0.0.0.0" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4371. </div>
  4372. </div>
  4373. <div class="grid grid-cols-2 gap-4">
  4374. <div>
  4375. <label class="block font-semibold text-slate-300 mb-1.5">Interface (Optional Device)</label>
  4376. <select id="modal-ospf-iface-device" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4377. <option value="">Any matching interface</option>
  4378. </select>
  4379. </div>
  4380. <div>
  4381. <label class="block font-semibold text-slate-300 mb-1.5">Metric Cost</label>
  4382. <input type="number" id="modal-ospf-iface-cost" value="10" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4383. </div>
  4384. </div>
  4385. <div class="grid grid-cols-3 gap-3">
  4386. <div>
  4387. <label class="block font-semibold text-slate-300 mb-1.5">Priority</label>
  4388. <input type="number" id="modal-ospf-iface-priority" value="1" min="0" max="255" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4389. </div>
  4390. <div>
  4391. <label class="block font-semibold text-slate-300 mb-1.5">Hello (s)</label>
  4392. <input type="number" id="modal-ospf-iface-hello" value="10" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4393. </div>
  4394. <div>
  4395. <label class="block font-semibold text-slate-300 mb-1.5">Dead (s)</label>
  4396. <input type="number" id="modal-ospf-iface-dead" value="40" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4397. </div>
  4398. </div>
  4399. <div class="grid grid-cols-2 gap-4">
  4400. <div>
  4401. <label class="block font-semibold text-slate-300 mb-1.5">Authentication Type</label>
  4402. <select id="modal-ospf-iface-auth-type" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4403. <option value="none">None</option>
  4404. <option value="simple">Simple Password</option>
  4405. <option value="md5">MD5 Cryptographic</option>
  4406. </select>
  4407. </div>
  4408. <div>
  4409. <label class="block font-semibold text-slate-300 mb-1.5">Auth Secret Key</label>
  4410. <input type="password" id="modal-ospf-iface-auth-key" placeholder="••••••••" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4411. </div>
  4412. </div>
  4413. <div class="grid grid-cols-2 gap-3 p-3 rounded-xl bg-slate-800/40 border border-slate-700/50">
  4414. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4415. <input type="checkbox" id="modal-ospf-iface-passive" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4416. <span>Passive (Do not form adjs)</span>
  4417. </label>
  4418. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4419. <input type="checkbox" id="modal-ospf-iface-disabled" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4420. <span>Disabled (X)</span>
  4421. </label>
  4422. </div>
  4423. <div>
  4424. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4425. <input type="text" id="modal-ospf-iface-comment" placeholder="LAN segment routing" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4426. </div>
  4427. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4428. <button type="button" onclick="closeOspfInterfaceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4429. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-indigo-600 hover:bg-indigo-500 text-white shadow-lg shadow-indigo-500/20">Save Interface</button>
  4430. </div>
  4431. </form>
  4432. </div>
  4433. </div>
  4434. <!-- ================= MODAL: ADD / EDIT ROUTING FILTER ================= -->
  4435. <div id="modal-routing-filter" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4436. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in">
  4437. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4438. <div>
  4439. <h3 id="modal-rf-title" class="text-sm font-bold text-white">Add Routing Filter Rule</h3>
  4440. <p class="text-[11px] text-slate-400">Match routing prefixes, AS-Path, communities, and set BGP attributes (/routing filter)</p>
  4441. </div>
  4442. <button onclick="closeRoutingFilterModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4443. </div>
  4444. <form id="routing-filter-form" onsubmit="submitRoutingFilter(event)" class="p-6 space-y-4 text-xs max-h-[85vh] overflow-y-auto">
  4445. <input type="hidden" id="modal-rf-id">
  4446. <div class="grid grid-cols-3 gap-3">
  4447. <div class="col-span-1">
  4448. <label class="block font-semibold text-slate-300 mb-1.5">Chain Name *</label>
  4449. <input type="text" id="modal-rf-chain" required placeholder="bgp-in" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4450. <p class="text-[10px] text-slate-500 mt-0.5">e.g. bgp-in, bgp-out</p>
  4451. </div>
  4452. <div>
  4453. <label class="block font-semibold text-slate-300 mb-1.5">Rule Order *</label>
  4454. <input type="number" id="modal-rf-order" value="10" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4455. <p class="text-[10px] text-slate-500 mt-0.5">Sequence (10, 20...)</p>
  4456. </div>
  4457. <div>
  4458. <label class="block font-semibold text-slate-300 mb-1.5">Action *</label>
  4459. <select id="modal-rf-action" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4460. <option value="accept">accept (Permit)</option>
  4461. <option value="discard">discard (Deny)</option>
  4462. <option value="reject">reject (Deny)</option>
  4463. <option value="passthrough">passthrough (Continue)</option>
  4464. </select>
  4465. <p class="text-[10px] text-slate-500 mt-0.5">Filter action</p>
  4466. </div>
  4467. </div>
  4468. <!-- Match Criteria Box -->
  4469. <div class="p-3.5 rounded-xl bg-slate-800/40 border border-slate-700/50 space-y-3">
  4470. <div class="text-[11px] font-bold text-cyan-400 uppercase tracking-wider">Match Conditions</div>
  4471. <div class="grid grid-cols-2 gap-3">
  4472. <div>
  4473. <label class="block font-medium text-slate-300 mb-1">Prefix (CIDR)</label>
  4474. <input type="text" id="modal-rf-prefix" placeholder="e.g. 10.0.0.0/8 or 0.0.0.0/0" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4475. <p class="text-[10px] text-slate-500 mt-0.5">Leave blank to match all prefixes</p>
  4476. </div>
  4477. <div>
  4478. <label class="block font-medium text-slate-300 mb-1">Prefix Length (Range)</label>
  4479. <input type="text" id="modal-rf-prefix-len" placeholder="e.g. 16-24 or ge 24 le 32" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4480. <p class="text-[10px] text-slate-500 mt-0.5">Optional subnet mask length filter</p>
  4481. </div>
  4482. </div>
  4483. <div class="grid grid-cols-3 gap-3">
  4484. <div>
  4485. <label class="block font-medium text-slate-300 mb-1">Match Protocol</label>
  4486. <select id="modal-rf-protocol" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4487. <option value="any">Any Protocol</option>
  4488. <option value="bgp">BGP</option>
  4489. <option value="ospf">OSPF</option>
  4490. <option value="connected">Connected</option>
  4491. <option value="static">Static</option>
  4492. </select>
  4493. </div>
  4494. <div>
  4495. <label class="block font-medium text-slate-300 mb-1">Match AS-Path (Regex)</label>
  4496. <input type="text" id="modal-rf-as-path" placeholder="e.g. ^65001_ or _65000$" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4497. </div>
  4498. <div>
  4499. <label class="block font-medium text-slate-300 mb-1">Match Community</label>
  4500. <input type="text" id="modal-rf-community" placeholder="e.g. 65001:100" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4501. </div>
  4502. </div>
  4503. </div>
  4504. <!-- Set Attributes Box (Modifications) -->
  4505. <div class="p-3.5 rounded-xl bg-slate-800/40 border border-slate-700/50 space-y-3">
  4506. <div class="text-[11px] font-bold text-purple-400 uppercase tracking-wider">Set Modifications (On Accept)</div>
  4507. <div class="grid grid-cols-3 gap-3">
  4508. <div>
  4509. <label class="block font-medium text-slate-300 mb-1">Set BGP Local Pref</label>
  4510. <input type="number" id="modal-rf-set-local-pref" placeholder="e.g. 150" min="0" max="4294967295" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4511. </div>
  4512. <div>
  4513. <label class="block font-medium text-slate-300 mb-1">Set Metric / MED</label>
  4514. <input type="number" id="modal-rf-set-metric" placeholder="e.g. 20" min="0" max="4294967295" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4515. </div>
  4516. <div>
  4517. <label class="block font-medium text-slate-300 mb-1">Set AS Prepend (Count)</label>
  4518. <input type="number" id="modal-rf-set-as-prepend" placeholder="e.g. 2" min="1" max="10" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4519. </div>
  4520. </div>
  4521. <div class="grid grid-cols-2 gap-3">
  4522. <div>
  4523. <label class="block font-medium text-slate-300 mb-1">Set Community</label>
  4524. <input type="text" id="modal-rf-set-community" placeholder="e.g. 65001:200 or no-export" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4525. </div>
  4526. <div>
  4527. <label class="block font-medium text-slate-300 mb-1">Set Next Hop (IP)</label>
  4528. <input type="text" id="modal-rf-set-next-hop" placeholder="e.g. 192.168.1.1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-white font-mono">
  4529. </div>
  4530. </div>
  4531. </div>
  4532. <div class="grid grid-cols-3 gap-3">
  4533. <div class="col-span-2">
  4534. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4535. <input type="text" id="modal-rf-comment" placeholder="Filter upstream customer prefix" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4536. </div>
  4537. <div class="flex items-center pt-6">
  4538. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4539. <input type="checkbox" id="modal-rf-disabled" class="rounded text-emerald-600 bg-slate-800 border-slate-700">
  4540. <span class="font-medium">Disabled (X)</span>
  4541. </label>
  4542. </div>
  4543. </div>
  4544. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4545. <button type="button" onclick="closeRoutingFilterModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4546. <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>
  4547. </div>
  4548. </form>
  4549. </div>
  4550. </div>
  4551. <!-- ================= MODAL: ADD / EDIT DHCP CLIENT ================= -->
  4552. <div id="modal-dhcp-client" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4553. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  4554. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4555. <div class="flex items-center gap-2">
  4556. <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 dhcp-client</span>
  4557. <h3 id="modal-dhcp-title" class="text-sm font-bold text-white">Add DHCP Client</h3>
  4558. </div>
  4559. <button onclick="closeDHCPClientModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4560. </div>
  4561. <form onsubmit="submitSaveDHCPClient(event)" class="p-6 space-y-4 text-xs">
  4562. <input type="hidden" id="modal-dhcp-id">
  4563. <div>
  4564. <label class="block font-semibold text-slate-300 mb-1.5">Interface *</label>
  4565. <select id="modal-dhcp-iface" 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-amber-500">
  4566. <option value="">Select interface...</option>
  4567. </select>
  4568. <p class="text-[11px] text-slate-500 mt-1">Physical port, VLAN sub-interface, or Bridge to acquire dynamic lease on.</p>
  4569. </div>
  4570. <div class="grid grid-cols-2 gap-4">
  4571. <div>
  4572. <label class="block font-semibold text-slate-300 mb-1.5">Default Route Distance</label>
  4573. <input type="number" id="modal-dhcp-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 focus:outline-none focus:border-amber-500">
  4574. </div>
  4575. <div>
  4576. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4577. <input type="text" id="modal-dhcp-comment" placeholder="e.g. ISP WAN DHCP" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white focus:outline-none focus:border-amber-500">
  4578. </div>
  4579. </div>
  4580. <div class="bg-slate-950/60 border border-slate-800/80 rounded-xl p-3 space-y-2.5">
  4581. <div class="text-[11px] font-bold text-slate-400 uppercase tracking-wider">RouterOS Options</div>
  4582. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer">
  4583. <input type="checkbox" id="modal-dhcp-def-route" checked class="rounded text-amber-500 bg-slate-800 border-slate-700 focus:ring-amber-500">
  4584. <span>Add Default Route (default gateway from DHCP)</span>
  4585. </label>
  4586. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer">
  4587. <input type="checkbox" id="modal-dhcp-peer-dns" checked class="rounded text-amber-500 bg-slate-800 border-slate-700 focus:ring-amber-500">
  4588. <span>Use Peer DNS (DNS servers from DHCP)</span>
  4589. </label>
  4590. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer">
  4591. <input type="checkbox" id="modal-dhcp-peer-ntp" checked class="rounded text-amber-500 bg-slate-800 border-slate-700 focus:ring-amber-500">
  4592. <span>Use Peer NTP (NTP servers from DHCP)</span>
  4593. </label>
  4594. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer pt-1 border-t border-slate-800/80">
  4595. <input type="checkbox" id="modal-dhcp-enabled" checked class="rounded text-emerald-500 bg-slate-800 border-slate-700 focus:ring-emerald-500">
  4596. <span class="font-semibold text-white">Enable DHCP Client immediately</span>
  4597. </label>
  4598. </div>
  4599. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4600. <button type="button" onclick="closeDHCPClientModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800 transition">Cancel</button>
  4601. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-amber-500 hover:bg-amber-400 text-slate-950 shadow-lg shadow-amber-500/20 transition">Save DHCP Client</button>
  4602. </div>
  4603. </form>
  4604. </div>
  4605. </div>
  4606. <!-- ================= MODAL: ADD / EDIT BRIDGE ================= -->
  4607. <div id="bridge-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4608. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4609. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4610. <h3 id="bridge-modal-title" class="text-sm font-bold text-white">Add Bridge Interface</h3>
  4611. <button onclick="closeBridgeModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4612. </div>
  4613. <form onsubmit="submitSaveBridge(event)" class="p-6 space-y-4 text-xs">
  4614. <input type="hidden" id="bridge-modal-id">
  4615. <div class="grid grid-cols-2 gap-4">
  4616. <div>
  4617. <label class="block font-semibold text-slate-300 mb-1.5">Bridge Name *</label>
  4618. <input type="text" id="bridge-modal-name" required placeholder="e.g. bridge1" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4619. </div>
  4620. <div>
  4621. <label class="block font-semibold text-slate-300 mb-1.5">MTU</label>
  4622. <input type="number" id="bridge-modal-mtu" value="1500" min="68" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4623. </div>
  4624. </div>
  4625. <div>
  4626. <label class="block font-semibold text-slate-300 mb-1.5">Admin MAC Address (Optional)</label>
  4627. <input type="text" id="bridge-modal-mac" placeholder="Leave blank for auto MAC" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4628. </div>
  4629. <div class="grid grid-cols-2 gap-4">
  4630. <div>
  4631. <label class="block font-semibold text-slate-300 mb-1.5">STP Protocol</label>
  4632. <select id="bridge-modal-stp" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4633. <option value="rstp" selected>RSTP (Rapid STP - Recommended)</option>
  4634. <option value="stp">STP (IEEE 802.1D)</option>
  4635. <option value="none">none (Disable STP)</option>
  4636. </select>
  4637. </div>
  4638. <div>
  4639. <label class="block font-semibold text-slate-300 mb-1.5">STP Priority</label>
  4640. <input type="number" id="bridge-modal-priority" value="32768" min="0" max="65535" step="4096" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4641. </div>
  4642. </div>
  4643. <!-- VLAN Filtering Box -->
  4644. <div class="p-3.5 bg-slate-950/60 border border-slate-800 rounded-xl space-y-3">
  4645. <label class="flex items-center space-x-2.5 cursor-pointer">
  4646. <input type="checkbox" id="bridge-modal-vlanfiltering" onchange="toggleBridgeModalVlanFiltering()" class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4647. <span class="font-semibold text-white">VLAN Filtering (802.1Q Aware)</span>
  4648. </label>
  4649. <div id="bridge-modal-pvid-box" class="grid grid-cols-2 gap-3 pl-6">
  4650. <div>
  4651. <label class="block text-[11px] text-slate-400 mb-1">Default PVID</label>
  4652. <input type="number" id="bridge-modal-pvid" value="1" min="1" max="4094" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-2.5 py-1 text-white font-mono text-xs">
  4653. </div>
  4654. <div class="flex items-center pt-4">
  4655. <label class="flex items-center space-x-2 text-slate-400 cursor-pointer text-xs">
  4656. <input type="checkbox" id="bridge-modal-fastforward" checked class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4657. <span>Fast Forward</span>
  4658. </label>
  4659. </div>
  4660. </div>
  4661. </div>
  4662. <div>
  4663. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4664. <input type="text" id="bridge-modal-comment" placeholder="e.g. LAN Bridge with EoIP" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4665. </div>
  4666. <div class="pt-1">
  4667. <label class="flex items-center space-x-2 cursor-pointer">
  4668. <input type="checkbox" id="bridge-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  4669. <span class="font-medium text-slate-300">Disabled (X)</span>
  4670. </label>
  4671. </div>
  4672. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4673. <button type="button" onclick="closeBridgeModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4674. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-sky-600 hover:bg-sky-500 text-white shadow-lg shadow-sky-500/20">Save Bridge</button>
  4675. </div>
  4676. </form>
  4677. </div>
  4678. </div>
  4679. <!-- ================= MODAL: ADD / EDIT BRIDGE PORT ================= -->
  4680. <div id="bridge-port-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4681. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4682. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4683. <h3 id="bridge-port-modal-title" class="text-sm font-bold text-white">Add Port to Bridge</h3>
  4684. <button onclick="closeBridgePortModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4685. </div>
  4686. <form onsubmit="submitSaveBridgePort(event)" class="p-6 space-y-4 text-xs">
  4687. <input type="hidden" id="bridge-port-modal-id">
  4688. <div class="grid grid-cols-2 gap-4">
  4689. <div>
  4690. <label class="block font-semibold text-slate-300 mb-1.5">Target Bridge *</label>
  4691. <select id="bridge-port-modal-bridge" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  4692. </div>
  4693. <div>
  4694. <label class="block font-semibold text-slate-300 mb-1.5">Interface *</label>
  4695. <select id="bridge-port-modal-interface" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  4696. </div>
  4697. </div>
  4698. <div class="grid grid-cols-3 gap-3">
  4699. <div>
  4700. <label class="block font-semibold text-slate-300 mb-1.5">PVID</label>
  4701. <input type="number" id="bridge-port-modal-pvid" value="1" min="1" max="4094" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4702. </div>
  4703. <div>
  4704. <label class="block font-semibold text-slate-300 mb-1.5">Path Cost</label>
  4705. <input type="number" id="bridge-port-modal-pathcost" value="10" min="1" max="65535" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4706. </div>
  4707. <div>
  4708. <label class="block font-semibold text-slate-300 mb-1.5">Horizon (Split)</label>
  4709. <input type="number" id="bridge-port-modal-horizon" value="0" min="0" max="65535" title="0=none. Ports with identical horizon > 0 cannot communicate (split-horizon isolation for EoIP / VPLS)" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4710. </div>
  4711. </div>
  4712. <div class="grid grid-cols-2 gap-4">
  4713. <div>
  4714. <label class="block font-semibold text-slate-300 mb-1.5">Frame Types</label>
  4715. <select id="bridge-port-modal-frametypes" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4716. <option value="admit-all" selected>admit all</option>
  4717. <option value="admit-only-vlan-tagged">admit only VLAN tagged</option>
  4718. <option value="admit-only-untagged-and-priority-tagged">admit only untagged</option>
  4719. </select>
  4720. </div>
  4721. <div>
  4722. <label class="block font-semibold text-slate-300 mb-1.5">Priority</label>
  4723. <input type="number" id="bridge-port-modal-priority" value="128" min="0" max="240" step="16" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4724. </div>
  4725. </div>
  4726. <div class="grid grid-cols-2 gap-3 p-3 bg-slate-950/60 border border-slate-800 rounded-xl">
  4727. <label class="flex items-center space-x-2 cursor-pointer">
  4728. <input type="checkbox" id="bridge-port-modal-learn" checked class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4729. <span class="text-white font-semibold">MAC Learning</span>
  4730. </label>
  4731. <label class="flex items-center space-x-2 cursor-pointer">
  4732. <input type="checkbox" id="bridge-port-modal-ingressfiltering" class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4733. <span class="text-white font-semibold">Ingress Filtering</span>
  4734. </label>
  4735. </div>
  4736. <div>
  4737. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4738. <input type="text" id="bridge-port-modal-comment" placeholder="e.g. Uplink to switch" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4739. </div>
  4740. <div class="pt-1">
  4741. <label class="flex items-center space-x-2 cursor-pointer">
  4742. <input type="checkbox" id="bridge-port-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  4743. <span class="font-medium text-slate-300">Disabled (X)</span>
  4744. </label>
  4745. </div>
  4746. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4747. <button type="button" onclick="closeBridgePortModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4748. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-sky-600 hover:bg-sky-500 text-white shadow-lg shadow-sky-500/20">Save Port</button>
  4749. </div>
  4750. </form>
  4751. </div>
  4752. </div>
  4753. <!-- ================= MODAL: ADD / EDIT BRIDGE VLAN ================= -->
  4754. <div id="bridge-vlan-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4755. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4756. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4757. <h3 id="bridge-vlan-modal-title" class="text-sm font-bold text-white">Add Bridge VLAN Entry</h3>
  4758. <button onclick="closeBridgeVlanModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4759. </div>
  4760. <form onsubmit="submitSaveBridgeVLAN(event)" class="p-6 space-y-4 text-xs">
  4761. <input type="hidden" id="bridge-vlan-modal-id">
  4762. <div class="grid grid-cols-2 gap-4">
  4763. <div>
  4764. <label class="block font-semibold text-slate-300 mb-1.5">Target Bridge *</label>
  4765. <select id="bridge-vlan-modal-bridge" onchange="updateBridgeVlanPortCheckboxes()" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono"></select>
  4766. </div>
  4767. <div>
  4768. <label class="block font-semibold text-slate-300 mb-1.5">VLAN IDs *</label>
  4769. <input type="text" id="bridge-vlan-modal-vlanids" required placeholder="e.g. 10 or 10,20,30 or 10-20" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4770. </div>
  4771. </div>
  4772. <div>
  4773. <label class="block font-semibold text-slate-300 mb-1.5">Tagged Member Ports (Trunk)</label>
  4774. <div id="bridge-vlan-tagged-ports" class="max-h-36 overflow-y-auto p-2.5 bg-slate-950/60 border border-slate-800 rounded-xl space-y-1 font-mono text-slate-300">
  4775. <span class="text-slate-500 text-xs font-sans">Select a bridge above to view member ports</span>
  4776. </div>
  4777. </div>
  4778. <div>
  4779. <label class="block font-semibold text-slate-300 mb-1.5">Untagged Member Ports (Access)</label>
  4780. <div id="bridge-vlan-untagged-ports" class="max-h-36 overflow-y-auto p-2.5 bg-slate-950/60 border border-slate-800 rounded-xl space-y-1 font-mono text-slate-300">
  4781. <span class="text-slate-500 text-xs font-sans">Select a bridge above to view member ports</span>
  4782. </div>
  4783. </div>
  4784. <div>
  4785. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4786. <input type="text" id="bridge-vlan-modal-comment" placeholder="e.g. Office & Guest VLANs" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white">
  4787. </div>
  4788. <div class="pt-1">
  4789. <label class="flex items-center space-x-2 cursor-pointer">
  4790. <input type="checkbox" id="bridge-vlan-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  4791. <span class="font-medium text-slate-300">Disabled (X)</span>
  4792. </label>
  4793. </div>
  4794. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4795. <button type="button" onclick="closeBridgeVlanModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4796. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-sky-600 hover:bg-sky-500 text-white shadow-lg shadow-sky-500/20">Save VLAN Entry</button>
  4797. </div>
  4798. </form>
  4799. </div>
  4800. </div>
  4801. <!-- ================= MODAL: ADD IP ADDRESS TO BRIDGE ================= -->
  4802. <div id="bridge-ip-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 hidden flex items-center justify-center p-4">
  4803. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-sm shadow-2xl overflow-hidden animate-in">
  4804. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4805. <div>
  4806. <h3 class="text-sm font-bold text-white">Assign IP Address to Bridge</h3>
  4807. <span id="bridge-ip-modal-sub" class="text-[11px] font-mono text-sky-400">bridge1</span>
  4808. </div>
  4809. <button onclick="closeBridgeIPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4810. </div>
  4811. <form onsubmit="submitAddBridgeIP(event)" class="p-6 space-y-4 text-xs">
  4812. <input type="hidden" id="bridge-ip-modal-id">
  4813. <div>
  4814. <label class="block font-semibold text-slate-300 mb-1.5">IPv4 / Subnet (CIDR) *</label>
  4815. <input type="text" id="bridge-ip-modal-cidr" required placeholder="e.g. 192.168.88.1/24" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white font-mono">
  4816. </div>
  4817. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4818. <button type="button" onclick="closeBridgeIPModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4819. <button type="submit" class="px-5 py-2 rounded-lg font-semibold bg-sky-600 hover:bg-sky-500 text-white shadow-lg shadow-sky-500/20">Assign IP</button>
  4820. </div>
  4821. </form>
  4822. </div>
  4823. </div>
  4824. <script src="app.js?v=4.5"></script>
  4825. </body>
  4826. </html>