index.html 339 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205
  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 sm:grid-cols-2 lg:grid-cols-4 gap-4">
  320. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  321. <div class="flex items-center justify-between mb-3">
  322. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Interfaces</span>
  323. <div class="p-2 bg-brand-500/10 text-brand-400 rounded-lg">
  324. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  325. <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" />
  326. </svg>
  327. </div>
  328. </div>
  329. <div class="flex items-baseline space-x-2">
  330. <span id="stat-ifaces-up" class="text-2xl font-bold text-white">0</span>
  331. <span class="text-xs text-slate-400">UP /</span>
  332. <span id="stat-ifaces-total" class="text-sm font-semibold text-slate-400">0 Total</span>
  333. </div>
  334. <div class="mt-2 text-xs text-slate-400 flex items-center">
  335. <span id="stat-ifaces-down" class="text-rose-400 font-medium mr-1.5">0 DOWN</span>
  336. <span class="text-slate-500">•</span>
  337. <span class="text-slate-400 ml-1.5">Plug & Play</span>
  338. </div>
  339. </div>
  340. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  341. <div class="flex items-center justify-between mb-3">
  342. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">802.1Q VLANs</span>
  343. <div class="p-2 bg-cyan-500/10 text-cyan-400 rounded-lg">
  344. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  345. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z" />
  346. </svg>
  347. </div>
  348. </div>
  349. <div class="flex items-baseline space-x-2">
  350. <span id="stat-vlans-count" class="text-2xl font-bold text-cyan-400">0</span>
  351. <span class="text-xs text-slate-400">Virtual Subnets</span>
  352. </div>
  353. <div class="mt-2 text-xs text-slate-400">Kernel Tagging Active</div>
  354. </div>
  355. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  356. <div class="flex items-center justify-between mb-3">
  357. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">WAN & VPN Services</span>
  358. <div class="p-2 bg-violet-500/10 text-violet-400 rounded-lg">
  359. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  360. <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" />
  361. </svg>
  362. </div>
  363. </div>
  364. <div class="flex items-baseline space-x-2">
  365. <span id="stat-vpn-active" class="text-2xl font-bold text-violet-400">0</span>
  366. <span class="text-xs text-slate-400">Connected Tunnels</span>
  367. </div>
  368. <div class="mt-2 text-[11px] text-slate-400 flex items-center gap-1.5 font-mono">
  369. <span>WG • IPSec • PPPoE • L2TP</span>
  370. </div>
  371. </div>
  372. <div class="bg-slate-900/80 border border-slate-800 rounded-xl p-5 relative overflow-hidden group hover:border-slate-700 transition">
  373. <div class="flex items-center justify-between mb-3">
  374. <span class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Live Traffic</span>
  375. <div class="p-2 bg-amber-500/10 text-amber-400 rounded-lg">
  376. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  377. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  378. </svg>
  379. </div>
  380. </div>
  381. <div class="space-y-1">
  382. <div class="flex items-center justify-between text-xs">
  383. <span class="text-slate-400 flex items-center gap-1"><span class="text-emerald-400 font-bold">↓</span> RX:</span>
  384. <span id="stat-traffic-rx" class="font-mono font-semibold text-emerald-400">0 B/s</span>
  385. </div>
  386. <div class="flex items-center justify-between text-xs">
  387. <span class="text-slate-400 flex items-center gap-1"><span class="text-cyan-400 font-bold">↑</span> TX:</span>
  388. <span id="stat-traffic-tx" class="font-mono font-semibold text-cyan-400">0 B/s</span>
  389. </div>
  390. </div>
  391. </div>
  392. </div>
  393. <!-- Port Matrix -->
  394. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  395. <div class="flex items-center justify-between mb-4">
  396. <div>
  397. <h3 class="text-sm font-bold text-white uppercase tracking-wider flex items-center gap-2">
  398. <span>Hardware & Virtual Port Matrix</span>
  399. <span class="text-[10px] bg-slate-800 text-slate-400 font-normal px-2 py-0.5 rounded-full">Live Hardware State</span>
  400. </h3>
  401. </div>
  402. </div>
  403. <div id="port-matrix" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3"></div>
  404. </div>
  405. <!-- Quick Overview Tables -->
  406. <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
  407. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  408. <div class="flex items-center justify-between mb-4">
  409. <h3 class="text-sm font-bold text-white">Interfaces Overview</h3>
  410. <button onclick="navigate('interfaces')" class="text-xs text-brand-400 hover:text-brand-300 font-medium">View All →</button>
  411. </div>
  412. <div class="overflow-x-auto">
  413. <table class="w-full text-left text-xs">
  414. <thead class="text-slate-400 border-b border-slate-800">
  415. <tr><th class="pb-2">Interface</th><th class="pb-2">Role</th><th class="pb-2">IP</th><th class="pb-2 text-right">Status</th></tr>
  416. </thead>
  417. <tbody id="quick-interfaces-table" class="divide-y divide-slate-800/60 font-mono"></tbody>
  418. </table>
  419. </div>
  420. </div>
  421. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  422. <div class="flex items-center justify-between mb-4">
  423. <h3 class="text-sm font-bold text-white">Active VLANs</h3>
  424. <button onclick="navigate('vlans')" class="text-xs text-cyan-400 hover:text-cyan-300 font-medium">Manage →</button>
  425. </div>
  426. <div class="overflow-x-auto">
  427. <table class="w-full text-left text-xs">
  428. <thead class="text-slate-400 border-b border-slate-800">
  429. <tr><th class="pb-2">VLAN</th><th class="pb-2">Device</th><th class="pb-2">Subnet</th><th class="pb-2 text-right">Parent</th></tr>
  430. </thead>
  431. <tbody id="quick-vlans-table" class="divide-y divide-slate-800/60 font-mono"></tbody>
  432. </table>
  433. </div>
  434. </div>
  435. </div>
  436. </section>
  437. <!-- ================= SECTION: INTERFACES (HIERARCHICAL TREE) ================= -->
  438. <section id="section-interfaces" class="hidden space-y-6">
  439. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
  440. <div class="flex items-center space-x-2">
  441. <span class="text-xs font-semibold text-slate-400 mr-2">Filter:</span>
  442. <button onclick="filterIfaces('all')" id="filter-all" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium bg-slate-800 text-white border border-slate-700">All Interfaces</button>
  443. <button onclick="filterIfaces('has_vlans')" id="filter-has_vlans" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">With VLANs</button>
  444. <button onclick="filterIfaces('physical')" id="filter-physical" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">Physical Only</button>
  445. <button onclick="filterIfaces('up')" id="filter-up" class="filter-btn px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800 hover:text-white">Only UP</button>
  446. </div>
  447. <div class="flex items-center space-x-3">
  448. <button onclick="expandAllIfaces(true)" class="text-xs text-cyan-400 hover:text-cyan-300 font-medium px-2.5 py-1.5 rounded bg-cyan-950/50 border border-cyan-800/60">Expand All</button>
  449. <button onclick="expandAllIfaces(false)" class="text-xs text-slate-400 hover:text-slate-300 font-medium px-2.5 py-1.5 rounded bg-slate-800 border border-slate-700">Collapse All</button>
  450. <input type="text" id="iface-search" oninput="renderInterfacesList()" placeholder="Search interfaces..."
  451. class="bg-slate-800/80 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-brand-500 w-48">
  452. </div>
  453. </div>
  454. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden shadow-2xl">
  455. <div class="p-4 border-b border-slate-800 bg-slate-950/40 flex items-center justify-between">
  456. <div>
  457. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  458. <span>Interface Hierarchy & VLAN Sub-interfaces</span>
  459. <span class="text-[10px] bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-2 py-0.5 rounded font-mono">Expandable Tree</span>
  460. </h3>
  461. </div>
  462. <div class="text-xs text-slate-400">
  463. <span id="ifaces-list-summary" class="font-mono">Loading interfaces...</span>
  464. </div>
  465. </div>
  466. <div class="overflow-x-auto">
  467. <table class="w-full text-left text-xs">
  468. <thead class="text-slate-400 bg-slate-950/80 border-b border-slate-800 uppercase tracking-wider text-[11px]">
  469. <tr>
  470. <th class="py-3 px-3 font-semibold w-8 text-center"></th>
  471. <th class="py-3 px-4 font-semibold">Interface / Type</th>
  472. <th class="py-3 px-4 font-semibold">Role & Alias</th>
  473. <th class="py-3 px-4 font-semibold">IP Address (CIDR)</th>
  474. <th class="py-3 px-4 font-semibold">MAC & MTU</th>
  475. <th class="py-3 px-4 font-semibold">Throughput (RX/TX)</th>
  476. <th class="py-3 px-4 font-semibold">Link State</th>
  477. <th class="py-3 px-4 font-semibold text-right">Actions</th>
  478. </tr>
  479. </thead>
  480. <tbody id="interfaces-tree-tbody" class="divide-y divide-slate-800 font-mono"></tbody>
  481. </table>
  482. </div>
  483. <div id="interfaces-empty-state" class="hidden p-12 text-center text-slate-500">
  484. No interfaces found matching your search.
  485. </div>
  486. </div>
  487. </section>
  488. <!-- ================= SECTION: DHCP CLIENT (/ip dhcp-client) ================= -->
  489. <section id="section-dhcp-client" class="hidden space-y-6">
  490. <!-- Top Banner -->
  491. <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">
  492. <div>
  493. <div class="flex items-center gap-2 mb-1">
  494. <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>
  495. <h2 class="text-base font-bold text-white">DHCP Client Configuration</h2>
  496. </div>
  497. <p class="text-xs text-slate-400">RouterOS-style dynamic IP configuration on any physical interface, bridge or VLAN sub-interface.</p>
  498. </div>
  499. <div class="flex items-center gap-2">
  500. <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">
  501. <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>
  502. <span>Add DHCP Client</span>
  503. </button>
  504. <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">
  505. <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>
  506. </button>
  507. </div>
  508. </div>
  509. <!-- KPI Summary Cards -->
  510. <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
  511. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  512. <div class="text-xs text-slate-400">Total Configured</div>
  513. <div id="dhcp-stat-total" class="text-xl font-bold text-white font-mono mt-1">0</div>
  514. </div>
  515. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  516. <div class="text-xs text-slate-400">Bound Leases</div>
  517. <div id="dhcp-stat-bound" class="text-xl font-bold text-emerald-400 font-mono mt-1">0</div>
  518. </div>
  519. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  520. <div class="text-xs text-slate-400">Searching / Requesting</div>
  521. <div id="dhcp-stat-searching" class="text-xl font-bold text-amber-400 font-mono mt-1">0</div>
  522. </div>
  523. <div class="bg-slate-900 border border-slate-800 rounded-xl p-4">
  524. <div class="text-xs text-slate-400">Disabled</div>
  525. <div id="dhcp-stat-disabled" class="text-xl font-bold text-slate-500 font-mono mt-1">0</div>
  526. </div>
  527. </div>
  528. <!-- DHCP Clients Table -->
  529. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  530. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  531. <div>
  532. <h3 class="text-xs font-bold text-white">DHCP Client Interfaces</h3>
  533. <p class="text-[11px] text-slate-400 mt-0.5">Active leases, assigned IP addresses, default gateways and lease duration</p>
  534. </div>
  535. </div>
  536. <div class="overflow-x-auto">
  537. <table class="w-full text-left text-xs">
  538. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px]">
  539. <tr>
  540. <th class="py-3 px-4">Interface</th>
  541. <th class="py-3 px-4">Status</th>
  542. <th class="py-3 px-4">IP Address / Netmask</th>
  543. <th class="py-3 px-4">Gateway</th>
  544. <th class="py-3 px-4">DHCP Server</th>
  545. <th class="py-3 px-4">DNS Servers</th>
  546. <th class="py-3 px-4">Expires In</th>
  547. <th class="py-3 px-4">Options</th>
  548. <th class="py-3 px-4 text-right">Actions</th>
  549. </tr>
  550. </thead>
  551. <tbody id="dhcp-clients-tbody" class="divide-y divide-slate-800 font-mono"></tbody>
  552. </table>
  553. </div>
  554. <div id="dhcp-clients-empty" class="hidden p-12 text-center text-slate-500">
  555. <div class="text-3xl mb-2">⚡</div>
  556. <div class="font-semibold text-slate-400 text-sm">No DHCP Clients Configured</div>
  557. <div class="text-xs mt-1 text-slate-500">Click &ldquo;Add DHCP Client&rdquo; to automatically obtain an IP on any interface.</div>
  558. </div>
  559. </div>
  560. </section>
  561. <!-- ================= SECTION: BRIDGE (/interface bridge) ================= -->
  562. <section id="section-bridge" class="hidden space-y-6">
  563. <!-- Bridge Navigation Header -->
  564. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
  565. <div class="flex items-center space-x-3">
  566. <div class="p-2.5 rounded-lg bg-sky-500/10 border border-sky-500/20 text-sky-400">
  567. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  568. <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" />
  569. </svg>
  570. </div>
  571. <div>
  572. <div class="flex items-center gap-2">
  573. <h2 class="text-base font-bold text-white">Bridge Interfaces</h2>
  574. <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>
  575. </div>
  576. <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>
  577. </div>
  578. </div>
  579. <div class="flex items-center space-x-3">
  580. <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">
  581. <span>+ Add Bridge</span>
  582. </button>
  583. </div>
  584. </div>
  585. <!-- Bridge Subtabs Nav -->
  586. <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">
  587. <div class="flex items-center space-x-1">
  588. <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">
  589. <span>Bridges</span>
  590. <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>
  591. </button>
  592. <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">
  593. <span>Ports</span>
  594. <span id="bridge-badge-ports" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  595. </button>
  596. <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">
  597. <span>VLANs</span>
  598. <span id="bridge-badge-vlans" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  599. </button>
  600. <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">
  601. <span>Hosts (MAC Table)</span>
  602. <span id="bridge-badge-hosts" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  603. </button>
  604. </div>
  605. <!-- Stats Bar -->
  606. <div class="flex items-center space-x-4 px-3 text-xs font-mono text-slate-400">
  607. <div>Bridges: <span id="bridge-stat-bridges" class="font-bold text-white">0</span></div>
  608. <div>Ports: <span id="bridge-stat-ports" class="font-bold text-sky-400">0</span></div>
  609. <div>Learned MACs: <span id="bridge-stat-hosts" class="font-bold text-emerald-400">0</span></div>
  610. </div>
  611. </div>
  612. <!-- ================= SUBTAB 1: BRIDGES ================= -->
  613. <div id="bridge-subtab-bridges" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  614. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  615. <h3 class="text-sm font-bold text-white">Configured Bridges</h3>
  616. <span id="bridge-count-badge" class="text-xs font-mono text-slate-400">0 Bridges</span>
  617. </div>
  618. <div class="overflow-x-auto">
  619. <table class="w-full text-left text-xs font-mono">
  620. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  621. <tr>
  622. <th class="py-2.5 px-3 w-10 text-center">#</th>
  623. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  624. <th class="py-2.5 px-3">Name</th>
  625. <th class="py-2.5 px-3">MTU</th>
  626. <th class="py-2.5 px-3">MAC Address</th>
  627. <th class="py-2.5 px-3">STP</th>
  628. <th class="py-2.5 px-3">VLAN Filtering</th>
  629. <th class="py-2.5 px-3">PVID</th>
  630. <th class="py-2.5 px-3">Ports</th>
  631. <th class="py-2.5 px-3">IP Addresses</th>
  632. <th class="py-2.5 px-3">Traffic</th>
  633. <th class="py-2.5 px-3">Comment</th>
  634. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  635. </tr>
  636. </thead>
  637. <tbody id="bridge-table-body" class="divide-y divide-slate-800/80"></tbody>
  638. </table>
  639. </div>
  640. <div id="bridge-empty-bridges" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  641. No bridge interfaces configured. Click "+ Add Bridge" to create one.
  642. </div>
  643. </div>
  644. <!-- ================= SUBTAB 2: PORTS ================= -->
  645. <div id="bridge-subtab-ports" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  646. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  647. <div class="flex items-center gap-3">
  648. <h3 class="text-sm font-bold text-white">Bridge Ports</h3>
  649. <span id="bridge-ports-count-badge" class="text-xs font-mono text-slate-400">0 Ports</span>
  650. </div>
  651. <div class="flex items-center space-x-2">
  652. <label class="text-xs text-slate-400">Filter Bridge:</label>
  653. <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">
  654. <option value="">All Bridges</option>
  655. </select>
  656. </div>
  657. </div>
  658. <div class="overflow-x-auto">
  659. <table class="w-full text-left text-xs font-mono">
  660. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  661. <tr>
  662. <th class="py-2.5 px-3 w-10 text-center">#</th>
  663. <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled">Flag</th>
  664. <th class="py-2.5 px-3">Interface</th>
  665. <th class="py-2.5 px-3">Bridge</th>
  666. <th class="py-2.5 px-3">PVID</th>
  667. <th class="py-2.5 px-3">Frame Types</th>
  668. <th class="py-2.5 px-3">Ingress Filter</th>
  669. <th class="py-2.5 px-3">Horizon</th>
  670. <th class="py-2.5 px-3">Role / Status</th>
  671. <th class="py-2.5 px-3">Comment</th>
  672. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  673. </tr>
  674. </thead>
  675. <tbody id="bridge-ports-table-body" class="divide-y divide-slate-800/80"></tbody>
  676. </table>
  677. </div>
  678. <div id="bridge-empty-ports" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  679. No bridge ports configured. Click "+ Add Port" to attach a physical NIC, VLAN or EoIP tunnel.
  680. </div>
  681. </div>
  682. <!-- ================= SUBTAB 3: VLANS ================= -->
  683. <div id="bridge-subtab-vlans" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  684. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  685. <div class="flex items-center gap-3">
  686. <h3 class="text-sm font-bold text-white">Bridge VLAN Filtering Table</h3>
  687. <span id="bridge-vlans-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
  688. </div>
  689. <div class="flex items-center space-x-2">
  690. <label class="text-xs text-slate-400">Filter Bridge:</label>
  691. <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">
  692. <option value="">All Bridges</option>
  693. </select>
  694. </div>
  695. </div>
  696. <div class="overflow-x-auto">
  697. <table class="w-full text-left text-xs font-mono">
  698. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  699. <tr>
  700. <th class="py-2.5 px-3 w-10 text-center">#</th>
  701. <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled">Flag</th>
  702. <th class="py-2.5 px-3">Bridge</th>
  703. <th class="py-2.5 px-3">VLAN IDs</th>
  704. <th class="py-2.5 px-3">Tagged Member Ports</th>
  705. <th class="py-2.5 px-3">Untagged Member Ports</th>
  706. <th class="py-2.5 px-3">Comment</th>
  707. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  708. </tr>
  709. </thead>
  710. <tbody id="bridge-vlans-table-body" class="divide-y divide-slate-800/80"></tbody>
  711. </table>
  712. </div>
  713. <div id="bridge-empty-vlans" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  714. No bridge VLAN filtering entries configured. Click "+ Add VLAN Entry" to configure 802.1Q tagged ports.
  715. </div>
  716. </div>
  717. <!-- ================= SUBTAB 4: HOSTS (MAC TABLE) ================= -->
  718. <div id="bridge-subtab-hosts" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  719. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  720. <div class="flex items-center gap-3">
  721. <h3 class="text-sm font-bold text-white">Forwarding Database (MAC Table)</h3>
  722. <span id="bridge-hosts-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
  723. </div>
  724. <div class="flex items-center space-x-2">
  725. <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">
  726. <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">
  727. <option value="">All Bridges</option>
  728. </select>
  729. <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>
  730. <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>
  731. </div>
  732. </div>
  733. <div class="overflow-x-auto">
  734. <table class="w-full text-left text-xs font-mono">
  735. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  736. <tr>
  737. <th class="py-2.5 px-3">MAC Address</th>
  738. <th class="py-2.5 px-3">Interface / Port</th>
  739. <th class="py-2.5 px-3">Bridge</th>
  740. <th class="py-2.5 px-3">VLAN</th>
  741. <th class="py-2.5 px-3">Age (s)</th>
  742. <th class="py-2.5 px-3">Flags (L=Local, S=Static, D=Dynamic)</th>
  743. </tr>
  744. </thead>
  745. <tbody id="bridge-hosts-table-body" class="divide-y divide-slate-800/80"></tbody>
  746. </table>
  747. </div>
  748. <div id="bridge-empty-hosts" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  749. No MAC addresses learned in the forwarding database.
  750. </div>
  751. </div>
  752. </section>
  753. <!-- ================= SECTION: PPPoE CLIENTS (MikroTik style) ================= -->
  754. <section id="section-pppoe" class="hidden space-y-6">
  755. <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">
  756. <div>
  757. <div class="flex items-center gap-2 mb-1">
  758. <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>
  759. <h2 class="text-base font-bold text-white">PPPoE Client Sessions</h2>
  760. </div>
  761. <p class="text-xs text-slate-400">Manage multiple Point-to-Point Protocol over Ethernet WAN connections (MikroTik RouterOS style).</p>
  762. </div>
  763. <div class="flex items-center gap-2">
  764. <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">
  765. <span>⚙ Server Settings</span>
  766. </button>
  767. <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">
  768. <span>+ Add PPPoE Client</span>
  769. </button>
  770. </div>
  771. </div>
  772. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  773. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  774. <h3 class="text-sm font-bold text-white">Configured PPPoE Interfaces</h3>
  775. <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>
  776. </div>
  777. <div class="overflow-x-auto">
  778. <table class="w-full text-left text-xs font-mono">
  779. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  780. <tr>
  781. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  782. <th class="py-2.5 px-3">Name</th>
  783. <th class="py-2.5 px-3">Interface</th>
  784. <th class="py-2.5 px-3">User</th>
  785. <th class="py-2.5 px-3">Assigned IP</th>
  786. <th class="py-2.5 px-3">Device</th>
  787. <th class="py-2.5 px-3 text-center">Def. Route</th>
  788. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  789. </tr>
  790. </thead>
  791. <tbody id="pppoe-table-body" class="divide-y divide-slate-800/80"></tbody>
  792. </table>
  793. </div>
  794. <div id="pppoe-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  795. No PPPoE clients configured. Click "+ Add PPPoE Client" to add a connection.
  796. </div>
  797. </div>
  798. </section>
  799. <!-- ================= SECTION: WIREGUARD (MikroTik style) ================= -->
  800. <section id="section-wireguard" class="hidden space-y-6">
  801. <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">
  802. <div>
  803. <div class="flex items-center gap-2 mb-1">
  804. <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>
  805. <h2 class="text-base font-bold text-white">WireGuard VPN Suite</h2>
  806. </div>
  807. <p class="text-xs text-slate-400">High-performance multi-interface WireGuard server and peer controller (MikroTik RouterOS v7 style).</p>
  808. </div>
  809. <div class="flex items-center space-x-2.5">
  810. <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">
  811. + Add Interface
  812. </button>
  813. <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">
  814. + Add Peer
  815. </button>
  816. </div>
  817. </div>
  818. <!-- Sub Tabs: Interfaces / Peers -->
  819. <div class="flex border-b border-slate-800 space-x-2">
  820. <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">
  821. <span>Interfaces</span>
  822. <span id="wg-subtab-badge-ifaces" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  823. </button>
  824. <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">
  825. <span>Peers</span>
  826. <span id="wg-subtab-badge-peers" class="px-1.5 py-0.5 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  827. </button>
  828. </div>
  829. <!-- Sub-Tab 1: Interfaces -->
  830. <div id="wg-subtab-ifaces" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  831. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  832. <h3 class="text-sm font-bold text-white">WireGuard Interfaces</h3>
  833. <span id="wg-ifaces-count" class="text-xs font-mono text-slate-400">0 Interfaces</span>
  834. </div>
  835. <div class="overflow-x-auto">
  836. <table class="w-full text-left text-xs font-mono">
  837. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  838. <tr>
  839. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  840. <th class="py-2.5 px-3">Name</th>
  841. <th class="py-2.5 px-3">Listen Port</th>
  842. <th class="py-2.5 px-3">Tunnel Address</th>
  843. <th class="py-2.5 px-3">Public Key</th>
  844. <th class="py-2.5 px-3">MTU</th>
  845. <th class="py-2.5 px-3 text-center">Peers</th>
  846. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  847. </tr>
  848. </thead>
  849. <tbody id="wg-ifaces-table-body" class="divide-y divide-slate-800/80"></tbody>
  850. </table>
  851. </div>
  852. <div id="wg-ifaces-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  853. No WireGuard interfaces configured. Click "+ Add Interface" to create wg0.
  854. </div>
  855. </div>
  856. <!-- Sub-Tab 2: Peers -->
  857. <div id="wg-subtab-peers" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  858. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  859. <div class="flex items-center gap-3">
  860. <h3 class="text-sm font-bold text-white">WireGuard Peers</h3>
  861. <span id="wg-peers-count" class="text-xs font-mono text-slate-400">0 Peers</span>
  862. </div>
  863. <div class="flex items-center gap-2">
  864. <label class="text-xs text-slate-400 font-sans">Filter Interface:</label>
  865. <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">
  866. <option value="">All Interfaces</option>
  867. </select>
  868. </div>
  869. </div>
  870. <div class="overflow-x-auto">
  871. <table class="w-full text-left text-xs font-mono">
  872. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  873. <tr>
  874. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Active, X=Disabled">Flag</th>
  875. <th class="py-2.5 px-3">Interface</th>
  876. <th class="py-2.5 px-3">Peer Name</th>
  877. <th class="py-2.5 px-3">Public Key</th>
  878. <th class="py-2.5 px-3">Allowed IPs</th>
  879. <th class="py-2.5 px-3">Endpoint</th>
  880. <th class="py-2.5 px-3">Latest Handshake</th>
  881. <th class="py-2.5 px-3">Traffic (RX/TX)</th>
  882. <th class="py-2.5 px-3 text-right font-sans">Action</th>
  883. </tr>
  884. </thead>
  885. <tbody id="wg-peers-table-body" class="divide-y divide-slate-800/80"></tbody>
  886. </table>
  887. </div>
  888. <div id="wg-peers-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  889. No peers found for the selected interface. Click "+ Add Peer" to add a client or branch.
  890. </div>
  891. </div>
  892. </section>
  893. <!-- ================= SECTION: IPSEC (MikroTik style) ================= -->
  894. <section id="section-ipsec" class="hidden space-y-6">
  895. <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">
  896. <div>
  897. <div class="flex items-center gap-2 mb-1">
  898. <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>
  899. <h2 class="text-base font-bold text-white">IPSec (IKEv2) Tunnels</h2>
  900. </div>
  901. <p class="text-xs text-slate-400">Enterprise strongSwan 6 Site-to-Site and Remote Gateway connections.</p>
  902. </div>
  903. <div class="flex items-center gap-2">
  904. <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">
  905. <span>⚙ Roadwarrior Server</span>
  906. </button>
  907. <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">
  908. + Add IPSec Tunnel
  909. </button>
  910. </div>
  911. </div>
  912. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  913. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  914. <h3 class="text-sm font-bold text-white">Configured IPSec Tunnels</h3>
  915. <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>
  916. </div>
  917. <div class="overflow-x-auto">
  918. <table class="w-full text-left text-xs font-mono">
  919. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  920. <tr>
  921. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Established, X=Disabled">Flag</th>
  922. <th class="py-2.5 px-4">Connection Name</th>
  923. <th class="py-2.5 px-4">Local Subnet</th>
  924. <th class="py-2.5 px-4">Remote Gateway</th>
  925. <th class="py-2.5 px-4">Remote Subnet</th>
  926. <th class="py-2.5 px-4">Status</th>
  927. <th class="py-2.5 px-4 text-right font-sans">Actions</th>
  928. </tr>
  929. </thead>
  930. <tbody id="ipsec-table-body" class="divide-y divide-slate-800"></tbody>
  931. </table>
  932. </div>
  933. <div id="ipsec-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  934. No IPSec tunnels configured. Click "+ Add IPSec Tunnel" to set up site-to-site networking.
  935. </div>
  936. </div>
  937. </section>
  938. <!-- ================= SECTION: L2TP CLIENT (MikroTik style) ================= -->
  939. <section id="section-l2tp" class="hidden space-y-6">
  940. <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">
  941. <div>
  942. <div class="flex items-center gap-2 mb-1">
  943. <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>
  944. <h2 class="text-base font-bold text-white">L2TP Client Sessions</h2>
  945. </div>
  946. <p class="text-xs text-slate-400">Multiple Layer 2 Tunneling Protocol clients with optional IPSec PSK encryption.</p>
  947. </div>
  948. <div class="flex items-center gap-2">
  949. <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">
  950. <span>⚙ Server Settings</span>
  951. </button>
  952. <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">
  953. + Add L2TP Client
  954. </button>
  955. </div>
  956. </div>
  957. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  958. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  959. <h3 class="text-sm font-bold text-white">Configured L2TP Clients</h3>
  960. <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>
  961. </div>
  962. <div class="overflow-x-auto">
  963. <table class="w-full text-left text-xs font-mono">
  964. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  965. <tr>
  966. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  967. <th class="py-2.5 px-3">Name</th>
  968. <th class="py-2.5 px-3">Server Address</th>
  969. <th class="py-2.5 px-3">User</th>
  970. <th class="py-2.5 px-3">Assigned IP</th>
  971. <th class="py-2.5 px-3">Device</th>
  972. <th class="py-2.5 px-3 text-center">Def. Route</th>
  973. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  974. </tr>
  975. </thead>
  976. <tbody id="l2tp-table-body" class="divide-y divide-slate-800/80"></tbody>
  977. </table>
  978. </div>
  979. <div id="l2tp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  980. No L2TP clients configured. Click "+ Add L2TP Client" to add a tunnel.
  981. </div>
  982. </div>
  983. </section>
  984. <!-- ================= SECTION: PPTP CLIENT (MikroTik style) ================= -->
  985. <section id="section-pptp" class="hidden space-y-6">
  986. <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">
  987. <div>
  988. <div class="flex items-center gap-2 mb-1">
  989. <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>
  990. <h2 class="text-base font-bold text-white">PPTP Client Sessions</h2>
  991. </div>
  992. <p class="text-xs text-slate-400">Multiple Point-to-Point Tunneling Protocol clients with MPPE-128 encryption.</p>
  993. </div>
  994. <div class="flex items-center gap-2">
  995. <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">
  996. <span>⚙ Server Settings</span>
  997. </button>
  998. <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">
  999. + Add PPTP Client
  1000. </button>
  1001. </div>
  1002. </div>
  1003. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1004. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1005. <h3 class="text-sm font-bold text-white">Configured PPTP Clients</h3>
  1006. <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>
  1007. </div>
  1008. <div class="overflow-x-auto">
  1009. <table class="w-full text-left text-xs font-mono">
  1010. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1011. <tr>
  1012. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  1013. <th class="py-2.5 px-3">Name</th>
  1014. <th class="py-2.5 px-3">Server Address</th>
  1015. <th class="py-2.5 px-3">User</th>
  1016. <th class="py-2.5 px-3">Assigned IP</th>
  1017. <th class="py-2.5 px-3">Device</th>
  1018. <th class="py-2.5 px-3 text-center">MPPE</th>
  1019. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1020. </tr>
  1021. </thead>
  1022. <tbody id="pptp-table-body" class="divide-y divide-slate-800/80"></tbody>
  1023. </table>
  1024. </div>
  1025. <div id="pptp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1026. No PPTP clients configured. Click "+ Add PPTP Client" to add a tunnel.
  1027. </div>
  1028. </div>
  1029. </section>
  1030. <!-- ================= SECTION: PPP SERVERS & SECRETS (/ppp) ================= -->
  1031. <section id="section-ppp" class="hidden space-y-6">
  1032. <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">
  1033. <div>
  1034. <div class="flex items-center gap-2 mb-1">
  1035. <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>
  1036. <h2 class="text-base font-bold text-white">PPP Servers, Secrets & Profiles</h2>
  1037. </div>
  1038. <p class="text-xs text-slate-400">MikroTik RouterOS centralized user authentication database, IP pools and VPN server concentrators.</p>
  1039. </div>
  1040. <div class="flex items-center space-x-2.5">
  1041. <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">
  1042. <span>+ Add User (Secret)</span>
  1043. </button>
  1044. </div>
  1045. </div>
  1046. <!-- Sub Tabs: Secrets / Profiles / PPPoE Server / PPTP Server / L2TP Server / Active Sessions -->
  1047. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  1048. <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">
  1049. <span>Secrets (Users)</span>
  1050. <span id="ppp-badge-secrets" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1051. </button>
  1052. <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">
  1053. <span>Profiles (Pools)</span>
  1054. <span id="ppp-badge-profiles" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1055. </button>
  1056. <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">
  1057. <span>PPPoE Server</span>
  1058. <span id="ppp-badge-pppoe-state" class="w-2 h-2 rounded-full bg-slate-600"></span>
  1059. </button>
  1060. <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">
  1061. <span>PPTP Server</span>
  1062. <span id="ppp-badge-pptp-state" class="w-2 h-2 rounded-full bg-slate-600"></span>
  1063. </button>
  1064. <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">
  1065. <span>L2TP Server</span>
  1066. <span id="ppp-badge-l2tp-state" class="w-2 h-2 rounded-full bg-slate-600"></span>
  1067. </button>
  1068. <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">
  1069. <span>Active Sessions</span>
  1070. <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>
  1071. </button>
  1072. </div>
  1073. <!-- TAB 1: SECRETS (USERS) -->
  1074. <div id="ppp-subtab-secrets" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1075. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1076. <h3 class="text-sm font-bold text-white">PPP Secrets (/ppp secret)</h3>
  1077. <span id="secrets-count-badge" class="text-xs font-mono text-slate-400">0 Users</span>
  1078. </div>
  1079. <div class="overflow-x-auto">
  1080. <table class="w-full text-left text-xs font-mono">
  1081. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1082. <tr>
  1083. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1084. <th class="py-2.5 px-3">Name (Username)</th>
  1085. <th class="py-2.5 px-3">Service</th>
  1086. <th class="py-2.5 px-3">Profile</th>
  1087. <th class="py-2.5 px-3">Local Address</th>
  1088. <th class="py-2.5 px-3">Remote Address</th>
  1089. <th class="py-2.5 px-3">Comment</th>
  1090. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1091. </tr>
  1092. </thead>
  1093. <tbody id="secrets-table-body" class="divide-y divide-slate-800/80"></tbody>
  1094. </table>
  1095. </div>
  1096. <div id="secrets-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1097. No PPP secrets configured. Click "+ Add User" to define an account.
  1098. </div>
  1099. </div>
  1100. <!-- TAB 2: PROFILES (POOLS) -->
  1101. <div id="ppp-subtab-profiles" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1102. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1103. <h3 class="text-sm font-bold text-white">PPP Profiles (/ppp profile)</h3>
  1104. <span id="profiles-count-badge" class="text-xs font-mono text-slate-400">0 Profiles</span>
  1105. </div>
  1106. <div class="overflow-x-auto">
  1107. <table class="w-full text-left text-xs font-mono">
  1108. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1109. <tr>
  1110. <th class="py-2.5 px-3">Profile Name</th>
  1111. <th class="py-2.5 px-3">Local Address</th>
  1112. <th class="py-2.5 px-3">Remote Address (Pool)</th>
  1113. <th class="py-2.5 px-3">DNS Servers</th>
  1114. <th class="py-2.5 px-3">Encryption</th>
  1115. <th class="py-2.5 px-3 text-center">Only One</th>
  1116. <th class="py-2.5 px-3">Comment</th>
  1117. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1118. </tr>
  1119. </thead>
  1120. <tbody id="profiles-table-body" class="divide-y divide-slate-800/80"></tbody>
  1121. </table>
  1122. </div>
  1123. </div>
  1124. <!-- TAB 3: PPPoE SERVER -->
  1125. <div id="ppp-subtab-pppoe" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl p-6">
  1126. <form onsubmit="savePPPoEServerConfig(event)" class="max-w-2xl space-y-5">
  1127. <div class="flex items-center justify-between border-b border-slate-800 pb-4">
  1128. <div>
  1129. <h3 class="text-sm font-bold text-white">PPPoE Access Concentrator Server</h3>
  1130. <p class="text-xs text-slate-400">Listens on physical interface or VLAN for PPPoE Discovery (PADI) packets</p>
  1131. </div>
  1132. <div class="flex items-center gap-3">
  1133. <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>
  1134. <label class="relative inline-flex items-center cursor-pointer">
  1135. <input type="checkbox" id="pppoe-server-enabled" class="sr-only peer">
  1136. <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>
  1137. </label>
  1138. </div>
  1139. </div>
  1140. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs font-sans">
  1141. <div>
  1142. <label class="block text-slate-300 font-medium mb-1">Service Name</label>
  1143. <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">
  1144. </div>
  1145. <div>
  1146. <label class="block text-slate-300 font-medium mb-1">Listen Interface</label>
  1147. <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>
  1148. </div>
  1149. <div>
  1150. <label class="block text-slate-300 font-medium mb-1">Default Profile</label>
  1151. <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>
  1152. </div>
  1153. <div>
  1154. <label class="block text-slate-300 font-medium mb-1">Max MTU / MRU</label>
  1155. <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">
  1156. </div>
  1157. </div>
  1158. <div class="flex items-center space-x-2 pt-2">
  1159. <input type="checkbox" id="pppoe-server-onesession" class="rounded bg-slate-800 border-slate-700 text-blue-600">
  1160. <label for="pppoe-server-onesession" class="text-xs text-slate-300">One Session Per Host (limit 1 PPPoE session per client MAC)</label>
  1161. </div>
  1162. <div class="pt-4 border-t border-slate-800 flex justify-end">
  1163. <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">
  1164. Apply PPPoE Server Settings
  1165. </button>
  1166. </div>
  1167. </form>
  1168. </div>
  1169. <!-- TAB 4: PPTP SERVER -->
  1170. <div id="ppp-subtab-pptp" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl p-6">
  1171. <form onsubmit="savePPTPServerConfig(event)" class="max-w-2xl space-y-5">
  1172. <div class="flex items-center justify-between border-b border-slate-800 pb-4">
  1173. <div>
  1174. <h3 class="text-sm font-bold text-white">PPTP Server (/interface pptp-server server)</h3>
  1175. <p class="text-xs text-slate-400">Point-to-Point Tunneling Server listening on TCP port 1723 with MPPE-128 encryption</p>
  1176. </div>
  1177. <div class="flex items-center gap-3">
  1178. <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>
  1179. <label class="relative inline-flex items-center cursor-pointer">
  1180. <input type="checkbox" id="pptp-server-enabled" class="sr-only peer">
  1181. <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>
  1182. </label>
  1183. </div>
  1184. </div>
  1185. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs font-sans">
  1186. <div>
  1187. <label class="block text-slate-300 font-medium mb-1">Port</label>
  1188. <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">
  1189. </div>
  1190. <div>
  1191. <label class="block text-slate-300 font-medium mb-1">Default Profile</label>
  1192. <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>
  1193. </div>
  1194. </div>
  1195. <div class="flex items-center space-x-2 pt-2">
  1196. <input type="checkbox" id="pptp-server-mppe" checked class="rounded bg-slate-800 border-slate-700 text-purple-600">
  1197. <label for="pptp-server-mppe" class="text-xs text-slate-300">Require 128-bit MPPE Encryption (MS-CHAPv2)</label>
  1198. </div>
  1199. <div class="pt-4 border-t border-slate-800 flex justify-end">
  1200. <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">
  1201. Apply PPTP Server Settings
  1202. </button>
  1203. </div>
  1204. </form>
  1205. </div>
  1206. <!-- TAB 5: L2TP SERVER -->
  1207. <div id="ppp-subtab-l2tp" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl p-6">
  1208. <form onsubmit="saveL2TPServerConfig(event)" class="max-w-2xl space-y-5">
  1209. <div class="flex items-center justify-between border-b border-slate-800 pb-4">
  1210. <div>
  1211. <h3 class="text-sm font-bold text-white">L2TP Server (/interface l2tp-server server)</h3>
  1212. <p class="text-xs text-slate-400">Layer 2 Tunneling Protocol Server listening on UDP port 1701 with optional IPSec</p>
  1213. </div>
  1214. <div class="flex items-center gap-3">
  1215. <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>
  1216. <label class="relative inline-flex items-center cursor-pointer">
  1217. <input type="checkbox" id="l2tp-server-enabled" class="sr-only peer">
  1218. <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>
  1219. </label>
  1220. </div>
  1221. </div>
  1222. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs font-sans">
  1223. <div>
  1224. <label class="block text-slate-300 font-medium mb-1">Port</label>
  1225. <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">
  1226. </div>
  1227. <div>
  1228. <label class="block text-slate-300 font-medium mb-1">Default Profile</label>
  1229. <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>
  1230. </div>
  1231. <div>
  1232. <label class="block text-slate-300 font-medium mb-1">Use IPSec</label>
  1233. <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">
  1234. <option value="no">no</option>
  1235. <option value="yes">yes</option>
  1236. <option value="required">required</option>
  1237. </select>
  1238. </div>
  1239. <div>
  1240. <label class="block text-slate-300 font-medium mb-1">IPSec Secret (PSK)</label>
  1241. <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">
  1242. </div>
  1243. </div>
  1244. <div class="pt-4 border-t border-slate-800 flex justify-end">
  1245. <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">
  1246. Apply L2TP Server Settings
  1247. </button>
  1248. </div>
  1249. </form>
  1250. </div>
  1251. <!-- TAB 6: ACTIVE SESSIONS -->
  1252. <div id="ppp-subtab-active" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1253. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1254. <h3 class="text-sm font-bold text-white">Active PPP Connections (/ppp active)</h3>
  1255. <button onclick="loadPPPSessions()" class="text-xs text-slate-400 hover:text-white px-2 py-1 rounded bg-slate-800">Refresh</button>
  1256. </div>
  1257. <div class="overflow-x-auto">
  1258. <table class="w-full text-left text-xs font-mono">
  1259. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1260. <tr>
  1261. <th class="py-2.5 px-3">Interface</th>
  1262. <th class="py-2.5 px-3">Username</th>
  1263. <th class="py-2.5 px-3">Service</th>
  1264. <th class="py-2.5 px-3">Client IP Address</th>
  1265. <th class="py-2.5 px-3">Uptime</th>
  1266. <th class="py-2.5 px-3">RX / TX Traffic</th>
  1267. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1268. </tr>
  1269. </thead>
  1270. <tbody id="active-ppp-table-body" class="divide-y divide-slate-800/80"></tbody>
  1271. </table>
  1272. </div>
  1273. <div id="active-ppp-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1274. No active PPP sessions currently connected.
  1275. </div>
  1276. </div>
  1277. </section>
  1278. <!-- ================= SECTION: EoIP TUNNELS (/interface eoip) ================= -->
  1279. <section id="section-eoip" class="hidden space-y-6">
  1280. <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">
  1281. <div>
  1282. <div class="flex items-center gap-2 mb-1">
  1283. <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>
  1284. <h2 class="text-base font-bold text-white">EoIP Tunnels (Ethernet over IP)</h2>
  1285. </div>
  1286. <p class="text-xs text-slate-400">MikroTik RouterOS Layer 2 GRETAP tunneling over IP. Transparently bridge Ethernet subnets across the Internet.</p>
  1287. </div>
  1288. <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">
  1289. <span>+ Add EoIP Tunnel</span>
  1290. </button>
  1291. </div>
  1292. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1293. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1294. <h3 class="text-sm font-bold text-white">Configured EoIP Interfaces</h3>
  1295. <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>
  1296. </div>
  1297. <div class="overflow-x-auto">
  1298. <table class="w-full text-left text-xs font-mono">
  1299. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1300. <tr>
  1301. <th class="py-2.5 px-3 w-12 text-center" title="Flags: R=Running, X=Disabled">Flag</th>
  1302. <th class="py-2.5 px-3">Name</th>
  1303. <th class="py-2.5 px-3">Tunnel ID</th>
  1304. <th class="py-2.5 px-3">Tunnel IP</th>
  1305. <th class="py-2.5 px-3">Remote Address</th>
  1306. <th class="py-2.5 px-3">Local Address</th>
  1307. <th class="py-2.5 px-3">MAC Address</th>
  1308. <th class="py-2.5 px-3">MTU</th>
  1309. <th class="py-2.5 px-3">RX / TX Traffic</th>
  1310. <th class="py-2.5 px-3">Comment</th>
  1311. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1312. </tr>
  1313. </thead>
  1314. <tbody id="eoip-table-body" class="divide-y divide-slate-800/80"></tbody>
  1315. </table>
  1316. </div>
  1317. <div id="eoip-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1318. No EoIP tunnels configured. Click "+ Add EoIP Tunnel" to create one.
  1319. </div>
  1320. </div>
  1321. </section>
  1322. <!-- ================= SECTION: FIREWALL (/ip firewall) ================= -->
  1323. <section id="section-firewall" class="hidden space-y-6">
  1324. <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">
  1325. <div>
  1326. <div class="flex items-center gap-2 mb-1">
  1327. <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>
  1328. <h2 class="text-base font-bold text-white">Firewall & Traffic Controller</h2>
  1329. </div>
  1330. <p class="text-xs text-slate-400">Complete MikroTik-grade stateful filter, NAT, packet/connection marking (Mangle), address lists and live connection tracker.</p>
  1331. </div>
  1332. <div class="flex items-center space-x-2.5">
  1333. <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">
  1334. <span>+ Add Rule</span>
  1335. </button>
  1336. <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">
  1337. Reset Counters
  1338. </button>
  1339. </div>
  1340. </div>
  1341. <!-- Sub Tabs: Filter / NAT / Mangle / Address Lists / Connections -->
  1342. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  1343. <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">
  1344. <span>Filter Rules</span>
  1345. <span id="fw-badge-filter" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1346. </button>
  1347. <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">
  1348. <span>NAT</span>
  1349. <span id="fw-badge-nat" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1350. </button>
  1351. <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">
  1352. <span>Mangle</span>
  1353. <span id="fw-badge-mangle" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1354. </button>
  1355. <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">
  1356. <span>Address Lists</span>
  1357. <span id="fw-badge-addrlist" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1358. </button>
  1359. <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">
  1360. <span>Geo-Location</span>
  1361. <span id="fw-badge-geo" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1362. </button>
  1363. <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">
  1364. <span>Connections</span>
  1365. <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>
  1366. </button>
  1367. </div>
  1368. <!-- ================= TAB 1: FILTER RULES ================= -->
  1369. <div id="fw-subtab-filter" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1370. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1371. <div class="flex items-center gap-3">
  1372. <h3 class="text-sm font-bold text-white">Firewall Filter Rules</h3>
  1373. <span id="filter-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1374. </div>
  1375. <div class="flex items-center gap-2">
  1376. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  1377. <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">
  1378. <option value="">All Chains</option>
  1379. <option value="input">input</option>
  1380. <option value="forward">forward</option>
  1381. <option value="output">output</option>
  1382. </select>
  1383. </div>
  1384. </div>
  1385. <div class="overflow-x-auto">
  1386. <table class="w-full text-left text-xs font-mono">
  1387. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1388. <tr>
  1389. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1390. <th class="py-2.5 px-3 w-12 text-center" title="Flags: X=Disabled, C=Comment">Flag</th>
  1391. <th class="py-2.5 px-3">Chain</th>
  1392. <th class="py-2.5 px-3">Src. Address</th>
  1393. <th class="py-2.5 px-3">Dst. Address</th>
  1394. <th class="py-2.5 px-3">Protocol</th>
  1395. <th class="py-2.5 px-3">Ports</th>
  1396. <th class="py-2.5 px-3">In / Out</th>
  1397. <th class="py-2.5 px-3">Action</th>
  1398. <th class="py-2.5 px-3">Packets / Bytes</th>
  1399. <th class="py-2.5 px-3">Comment</th>
  1400. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  1401. </tr>
  1402. </thead>
  1403. <tbody id="filter-table-body" class="divide-y divide-slate-800/80"></tbody>
  1404. </table>
  1405. </div>
  1406. <div id="filter-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1407. No filter rules found in this chain. Click "+ Add Rule" to create one.
  1408. </div>
  1409. </div>
  1410. <!-- ================= TAB 2: NAT RULES ================= -->
  1411. <div id="fw-subtab-nat" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1412. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1413. <div class="flex items-center gap-3">
  1414. <h3 class="text-sm font-bold text-white">NAT Rules</h3>
  1415. <span id="nat-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1416. </div>
  1417. <div class="flex items-center gap-2">
  1418. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  1419. <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">
  1420. <option value="">All Chains</option>
  1421. <option value="srcnat">srcnat (SNAT / Masquerade)</option>
  1422. <option value="dstnat">dstnat (Port Forwarding)</option>
  1423. </select>
  1424. </div>
  1425. </div>
  1426. <div class="overflow-x-auto">
  1427. <table class="w-full text-left text-xs font-mono">
  1428. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1429. <tr>
  1430. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1431. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1432. <th class="py-2.5 px-3">Chain</th>
  1433. <th class="py-2.5 px-3">Src. Address</th>
  1434. <th class="py-2.5 px-3">Dst. Address</th>
  1435. <th class="py-2.5 px-3">Proto/Port</th>
  1436. <th class="py-2.5 px-3">Out / In</th>
  1437. <th class="py-2.5 px-3">Action</th>
  1438. <th class="py-2.5 px-3">To Address:Port</th>
  1439. <th class="py-2.5 px-3">Packets / Bytes</th>
  1440. <th class="py-2.5 px-3">Comment</th>
  1441. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  1442. </tr>
  1443. </thead>
  1444. <tbody id="nat-table-body" class="divide-y divide-slate-800/80"></tbody>
  1445. </table>
  1446. </div>
  1447. <div id="nat-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1448. No NAT rules configured. Click "+ Add Rule" to add masquerade or port forwarding.
  1449. </div>
  1450. </div>
  1451. <!-- ================= TAB 3: MANGLE RULES ================= -->
  1452. <div id="fw-subtab-mangle" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1453. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1454. <div class="flex items-center gap-3">
  1455. <h3 class="text-sm font-bold text-white">Mangle Packet & Connection Marking</h3>
  1456. <span id="mangle-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1457. </div>
  1458. <div class="flex items-center gap-2">
  1459. <label class="text-xs text-slate-400 font-sans">Chain:</label>
  1460. <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">
  1461. <option value="">All Chains</option>
  1462. <option value="prerouting">prerouting</option>
  1463. <option value="forward">forward</option>
  1464. <option value="postrouting">postrouting</option>
  1465. <option value="input">input</option>
  1466. <option value="output">output</option>
  1467. </select>
  1468. </div>
  1469. </div>
  1470. <div class="overflow-x-auto">
  1471. <table class="w-full text-left text-xs font-mono">
  1472. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1473. <tr>
  1474. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1475. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1476. <th class="py-2.5 px-3">Chain</th>
  1477. <th class="py-2.5 px-3">Src. Address</th>
  1478. <th class="py-2.5 px-3">Dst. Address</th>
  1479. <th class="py-2.5 px-3">Action</th>
  1480. <th class="py-2.5 px-3">New Mark / Value</th>
  1481. <th class="py-2.5 px-3 text-center">Pass</th>
  1482. <th class="py-2.5 px-3">Packets / Bytes</th>
  1483. <th class="py-2.5 px-3">Comment</th>
  1484. <th class="py-2.5 px-3 text-right font-sans">Order & Actions</th>
  1485. </tr>
  1486. </thead>
  1487. <tbody id="mangle-table-body" class="divide-y divide-slate-800/80"></tbody>
  1488. </table>
  1489. </div>
  1490. <div id="mangle-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1491. No mangle rules configured. Click "+ Add Rule" to mark connections or routing for Multi-WAN.
  1492. </div>
  1493. </div>
  1494. <!-- ================= TAB 4: ADDRESS LISTS ================= -->
  1495. <div id="fw-subtab-addrlist" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1496. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1497. <div class="flex items-center gap-3">
  1498. <h3 class="text-sm font-bold text-white">Address Lists (ipset)</h3>
  1499. <span id="addrlist-count-badge" class="text-xs font-mono text-slate-400">0 Entries</span>
  1500. </div>
  1501. <div class="flex items-center gap-2">
  1502. <label class="text-xs text-slate-400 font-sans">List:</label>
  1503. <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">
  1504. <option value="">All Lists</option>
  1505. </select>
  1506. </div>
  1507. </div>
  1508. <div class="overflow-x-auto">
  1509. <table class="w-full text-left text-xs font-mono">
  1510. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1511. <tr>
  1512. <th class="py-2.5 px-3 w-10 text-center">#</th>
  1513. <th class="py-2.5 px-3 w-12 text-center">Flag</th>
  1514. <th class="py-2.5 px-3">List Name</th>
  1515. <th class="py-2.5 px-3">IP Address / CIDR</th>
  1516. <th class="py-2.5 px-3">Comment</th>
  1517. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1518. </tr>
  1519. </thead>
  1520. <tbody id="addrlist-table-body" class="divide-y divide-slate-800/80"></tbody>
  1521. </table>
  1522. </div>
  1523. <div id="addrlist-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1524. No address list entries configured. Click "+ Add Item" to define a group of IPs/subnets.
  1525. </div>
  1526. </div>
  1527. <!-- ================= TAB 5: ACTIVE CONNECTIONS ================= -->
  1528. <div id="fw-subtab-connections" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1529. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1530. <div class="flex items-center gap-3">
  1531. <h3 class="text-sm font-bold text-white">Active Conntrack Connections</h3>
  1532. <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>
  1533. </div>
  1534. <div class="flex items-center gap-2 flex-wrap">
  1535. <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">
  1536. <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">
  1537. <option value="">All Proto</option>
  1538. <option value="TCP">TCP</option>
  1539. <option value="UDP">UDP</option>
  1540. <option value="ICMP">ICMP</option>
  1541. </select>
  1542. <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>
  1543. </div>
  1544. </div>
  1545. <div class="overflow-x-auto max-h-[550px] overflow-y-auto">
  1546. <table class="w-full text-left text-xs font-mono">
  1547. <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">
  1548. <tr>
  1549. <th class="py-2.5 px-3">Proto</th>
  1550. <th class="py-2.5 px-3">Source Address</th>
  1551. <th class="py-2.5 px-3">Destination Address</th>
  1552. <th class="py-2.5 px-3">Reply Source</th>
  1553. <th class="py-2.5 px-3">Reply Dest</th>
  1554. <th class="py-2.5 px-3">TCP State</th>
  1555. <th class="py-2.5 px-3">Mark</th>
  1556. <th class="py-2.5 px-3">Timeout</th>
  1557. <th class="py-2.5 px-3 text-right font-sans">Action</th>
  1558. </tr>
  1559. </thead>
  1560. <tbody id="conns-table-body" class="divide-y divide-slate-800/60"></tbody>
  1561. </table>
  1562. </div>
  1563. <div id="conns-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1564. No active connections found matching your search.
  1565. </div>
  1566. </div>
  1567. <!-- ================= TAB 5: GEO-LOCATION ================= -->
  1568. <div id="fw-subtab-geo" class="hidden space-y-4">
  1569. <!-- Geo Header & Scheduler Status -->
  1570. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-4 flex flex-wrap items-center justify-between gap-4">
  1571. <div class="flex items-center space-x-3">
  1572. <div class="p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/20 text-emerald-400">
  1573. <span class="text-xl">🌍</span>
  1574. </div>
  1575. <div>
  1576. <div class="flex items-center gap-2">
  1577. <h3 class="text-sm font-bold text-white">Geo-Location IP Filtering</h3>
  1578. <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>
  1579. </div>
  1580. <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>
  1581. </div>
  1582. </div>
  1583. <!-- Controls -->
  1584. <div class="flex items-center flex-wrap gap-2">
  1585. <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">
  1586. <span class="text-slate-400">Schedule:</span>
  1587. <span id="geo-interval-label" class="font-bold text-white">Every 24h</span>
  1588. </div>
  1589. <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">
  1590. ⚙️ Settings
  1591. </button>
  1592. <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">
  1593. <span id="geo-update-spinner" class="hidden animate-spin text-xs">⏳</span>
  1594. <span>🔄 Update Now</span>
  1595. </button>
  1596. </div>
  1597. </div>
  1598. <!-- Stats Bar -->
  1599. <div class="grid grid-cols-2 sm:grid-cols-4 gap-3">
  1600. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1601. <span class="text-[10px] uppercase font-bold text-slate-500 block">Countries in Rules</span>
  1602. <span id="geo-stat-active-countries" class="text-base font-bold font-mono text-emerald-400">0</span>
  1603. </div>
  1604. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1605. <span class="text-[10px] uppercase font-bold text-slate-500 block">Total Subnets in Kernel</span>
  1606. <span id="geo-stat-total-subnets" class="text-base font-bold font-mono text-cyan-400">0</span>
  1607. </div>
  1608. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1609. <span class="text-[10px] uppercase font-bold text-slate-500 block">Last Synced</span>
  1610. <span id="geo-stat-last-sync" class="text-xs font-mono text-slate-300">-</span>
  1611. </div>
  1612. <div class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3">
  1613. <span class="text-[10px] uppercase font-bold text-slate-500 block">Next Scheduled Run</span>
  1614. <span id="geo-stat-next-sync" class="text-xs font-mono text-slate-300">-</span>
  1615. </div>
  1616. </div>
  1617. <!-- Filters & Country Table -->
  1618. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1619. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1620. <div class="flex items-center flex-wrap gap-2">
  1621. <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">
  1622. <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">
  1623. <option value="">All Continents</option>
  1624. <option value="Europe">Europe</option>
  1625. <option value="Asia">Asia</option>
  1626. <option value="Americas">Americas</option>
  1627. <option value="Africa">Africa</option>
  1628. <option value="Oceania">Oceania</option>
  1629. </select>
  1630. <label class="flex items-center space-x-1.5 text-xs text-slate-300 cursor-pointer ml-2">
  1631. <input type="checkbox" id="geo-filter-inuse-only" onchange="renderGeoCountries()" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  1632. <span>In Use by Rules only</span>
  1633. </label>
  1634. <label class="flex items-center space-x-1.5 text-xs text-slate-300 cursor-pointer ml-2">
  1635. <input type="checkbox" id="geo-filter-cached-only" onchange="renderGeoCountries()" class="rounded bg-slate-800 border-slate-700 text-cyan-500">
  1636. <span>Cached Only</span>
  1637. </label>
  1638. </div>
  1639. <div class="flex items-center space-x-2">
  1640. <span class="text-xs text-slate-400 font-sans">Quick Filter:</span>
  1641. <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>
  1642. <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>
  1643. <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>
  1644. <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>
  1645. </div>
  1646. </div>
  1647. <div class="overflow-x-auto max-h-[600px] overflow-y-auto">
  1648. <table class="w-full text-left text-xs font-mono">
  1649. <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">
  1650. <tr>
  1651. <th class="py-2.5 px-3 w-16 text-center">Code</th>
  1652. <th class="py-2.5 px-3">Country Name</th>
  1653. <th class="py-2.5 px-3">Continent</th>
  1654. <th class="py-2.5 px-3">Subnets</th>
  1655. <th class="py-2.5 px-3">Kernel IPSet</th>
  1656. <th class="py-2.5 px-3">Rule Usage</th>
  1657. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1658. </tr>
  1659. </thead>
  1660. <tbody id="geo-table-body" class="divide-y divide-slate-800/60"></tbody>
  1661. </table>
  1662. </div>
  1663. <div id="geo-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1664. No countries found matching your search.
  1665. </div>
  1666. </div>
  1667. </div>
  1668. </section>
  1669. <!-- ================= SECTION: ROUTES & POLICY (/ip route & rules) ================= -->
  1670. <section id="section-routes" class="hidden space-y-6">
  1671. <!-- Top Routing Switcher Bar -->
  1672. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  1673. <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">
  1674. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1675. <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" />
  1676. </svg>
  1677. <span>Routes & Policy (/ip route)</span>
  1678. </button>
  1679. <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">
  1680. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1681. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  1682. </svg>
  1683. <span>BGP (/routing bgp)</span>
  1684. </button>
  1685. <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">
  1686. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1687. <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" />
  1688. </svg>
  1689. <span>OSPF (/routing ospf)</span>
  1690. </button>
  1691. <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">
  1692. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1693. <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" />
  1694. </svg>
  1695. <span>Filters (/routing filter)</span>
  1696. </button>
  1697. </div>
  1698. <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">
  1699. <div>
  1700. <div class="flex items-center gap-2 mb-1">
  1701. <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>
  1702. <h2 class="text-base font-bold text-white">IP Routes & Policy Rules</h2>
  1703. </div>
  1704. <p class="text-xs text-slate-400">Kernel FIB/RIB routing tables, static gateways, multipath uplinks, and policy routing (ip rule / fwmark lookup).</p>
  1705. </div>
  1706. <div class="flex items-center space-x-2.5">
  1707. <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">
  1708. + Add Route
  1709. </button>
  1710. <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">
  1711. + Add Rule
  1712. </button>
  1713. <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">
  1714. + New Table
  1715. </button>
  1716. </div>
  1717. </div>
  1718. <!-- Sub Tabs: Routes / Policy Rules / Tables -->
  1719. <div class="flex border-b border-slate-800 space-x-1">
  1720. <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">
  1721. <span>Routes</span>
  1722. <span id="routes-badge-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1723. </button>
  1724. <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">
  1725. <span>Policy Rules (/ip route rule)</span>
  1726. <span id="routes-badge-rules" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1727. </button>
  1728. <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">
  1729. <span>Routing Tables</span>
  1730. <span id="routes-badge-tables" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1731. </button>
  1732. </div>
  1733. <!-- Sub-Tab 1: Routes Table -->
  1734. <div id="routes-subtab-routes" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1735. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1736. <div class="flex items-center gap-3">
  1737. <h3 class="text-sm font-bold text-white">Active Routing Table (RIB)</h3>
  1738. <span id="routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
  1739. </div>
  1740. <div class="flex items-center gap-2">
  1741. <label class="text-xs text-slate-400 font-sans">Table Filter:</label>
  1742. <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">
  1743. <option value="">All Tables</option>
  1744. <option value="main">main</option>
  1745. </select>
  1746. <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>
  1747. </div>
  1748. </div>
  1749. <div class="overflow-x-auto">
  1750. <table class="w-full text-left text-xs font-mono">
  1751. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1752. <tr>
  1753. <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>
  1754. <th class="py-2.5 px-3">Dst. Address</th>
  1755. <th class="py-2.5 px-3">Gateway</th>
  1756. <th class="py-2.5 px-3">Distance</th>
  1757. <th class="py-2.5 px-3">Table / Mark</th>
  1758. <th class="py-2.5 px-3">Interface</th>
  1759. <th class="py-2.5 px-3">Comment</th>
  1760. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1761. </tr>
  1762. </thead>
  1763. <tbody id="routes-table-body" class="divide-y divide-slate-800/80"></tbody>
  1764. </table>
  1765. </div>
  1766. <div id="routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1767. No routes found.
  1768. </div>
  1769. </div>
  1770. <!-- Sub-Tab 2: Policy Rules (/ip route rule) -->
  1771. <div id="routes-subtab-rules" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1772. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1773. <h3 class="text-sm font-bold text-white">Policy Routing Rules (ip rule)</h3>
  1774. <span id="rules-count-badge" class="text-xs font-mono text-slate-400">0 Rules</span>
  1775. </div>
  1776. <div class="overflow-x-auto">
  1777. <table class="w-full text-left text-xs font-mono">
  1778. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1779. <tr>
  1780. <th class="py-2.5 px-3 w-16">Pref</th>
  1781. <th class="py-2.5 px-3">Src. Address</th>
  1782. <th class="py-2.5 px-3">Dst. Address</th>
  1783. <th class="py-2.5 px-3">Routing Mark (fwmark)</th>
  1784. <th class="py-2.5 px-3">Lookup Table</th>
  1785. <th class="py-2.5 px-3">Action</th>
  1786. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1787. </tr>
  1788. </thead>
  1789. <tbody id="rules-table-body" class="divide-y divide-slate-800/80"></tbody>
  1790. </table>
  1791. </div>
  1792. <div id="rules-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1793. No policy rules configured. Click "+ Add Rule" to route traffic based on routing-mark or source IP.
  1794. </div>
  1795. </div>
  1796. <!-- Sub-Tab 3: Routing Tables -->
  1797. <div id="routes-subtab-tables" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1798. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1799. <h3 class="text-sm font-bold text-white">Defined Routing Tables (/etc/iproute2/rt_tables)</h3>
  1800. <span id="tables-count-badge" class="text-xs font-mono text-slate-400">0 Tables</span>
  1801. </div>
  1802. <div class="overflow-x-auto">
  1803. <table class="w-full text-left text-xs font-mono">
  1804. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1805. <tr>
  1806. <th class="py-2.5 px-3 w-20">FIB ID</th>
  1807. <th class="py-2.5 px-3">Table Name</th>
  1808. <th class="py-2.5 px-3">Comment / Purpose</th>
  1809. </tr>
  1810. </thead>
  1811. <tbody id="tables-table-body" class="divide-y divide-slate-800/80"></tbody>
  1812. </table>
  1813. </div>
  1814. </div>
  1815. </section>
  1816. <!-- ================= SECTION: BGP ROUTING (/routing bgp) ================= -->
  1817. <section id="section-bgp" class="hidden space-y-6">
  1818. <!-- Top Routing Switcher Bar -->
  1819. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  1820. <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">
  1821. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1822. <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" />
  1823. </svg>
  1824. <span>Routes & Policy (/ip route)</span>
  1825. </button>
  1826. <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">
  1827. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1828. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  1829. </svg>
  1830. <span>BGP (/routing bgp)</span>
  1831. </button>
  1832. <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">
  1833. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1834. <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" />
  1835. </svg>
  1836. <span>OSPF (/routing ospf)</span>
  1837. </button>
  1838. <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">
  1839. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1840. <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" />
  1841. </svg>
  1842. <span>Filters (/routing filter)</span>
  1843. </button>
  1844. </div>
  1845. <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">
  1846. <div>
  1847. <div class="flex items-center gap-2 mb-1">
  1848. <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>
  1849. <h2 class="text-base font-bold text-white">BGP Dynamic Routing</h2>
  1850. <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>
  1851. </div>
  1852. <p class="text-xs text-slate-400">Enterprise FRRouting BGP stack: Autonomous System peering sessions, prefix announcements, and BGP routing table (RIB).</p>
  1853. </div>
  1854. <div class="flex items-center space-x-2 flex-wrap gap-y-2">
  1855. <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">
  1856. <span>⚙ BGP Settings</span>
  1857. </button>
  1858. <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">
  1859. + Add BGP Peer
  1860. </button>
  1861. <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">
  1862. + Add Network
  1863. </button>
  1864. <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">
  1865. Refresh
  1866. </button>
  1867. </div>
  1868. </div>
  1869. <!-- BGP Sub-Tabs -->
  1870. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  1871. <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">
  1872. <span>BGP Peers (/routing bgp connection)</span>
  1873. <span id="dyn-badge-bgp-peers" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1874. </button>
  1875. <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">
  1876. <span>Advertised Networks (/routing bgp network)</span>
  1877. <span id="dyn-badge-bgp-nets" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1878. </button>
  1879. <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">
  1880. <span>BGP Routes (RIB)</span>
  1881. <span id="dyn-badge-bgp-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  1882. </button>
  1883. </div>
  1884. <!-- Sub-Tab 1: BGP Peers -->
  1885. <div id="dyn-subtab-bgp-peers" class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1886. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  1887. <div class="flex items-center gap-3">
  1888. <h3 class="text-sm font-bold text-white">Configured BGP Peers</h3>
  1889. <span id="bgp-peers-count-badge" class="text-xs font-mono text-slate-400">0 Peers</span>
  1890. <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>
  1891. </div>
  1892. <div class="flex items-center gap-2">
  1893. <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>
  1894. </div>
  1895. </div>
  1896. <div class="overflow-x-auto">
  1897. <table class="w-full text-left text-xs font-mono">
  1898. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1899. <tr>
  1900. <th class="py-2.5 px-3 w-16 text-center">Flags</th>
  1901. <th class="py-2.5 px-3">Name</th>
  1902. <th class="py-2.5 px-3">Remote Address</th>
  1903. <th class="py-2.5 px-3">Remote AS</th>
  1904. <th class="py-2.5 px-3">State</th>
  1905. <th class="py-2.5 px-3">Uptime</th>
  1906. <th class="py-2.5 px-3">Prefixes (RX/TX)</th>
  1907. <th class="py-2.5 px-3">Routing Filters</th>
  1908. <th class="py-2.5 px-3">Comment</th>
  1909. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1910. </tr>
  1911. </thead>
  1912. <tbody id="bgp-peers-table-body" class="divide-y divide-slate-800/80"></tbody>
  1913. </table>
  1914. </div>
  1915. <div id="bgp-peers-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1916. No BGP peers configured. Click "+ Add BGP Peer" to establish an eBGP or iBGP peering session.
  1917. </div>
  1918. </div>
  1919. <!-- Sub-Tab 2: BGP Networks -->
  1920. <div id="dyn-subtab-bgp-nets" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1921. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1922. <div class="flex items-center gap-3">
  1923. <h3 class="text-sm font-bold text-white">Advertised BGP Networks (/routing bgp network)</h3>
  1924. <span id="bgp-nets-count-badge" class="text-xs font-mono text-slate-400">0 Networks</span>
  1925. </div>
  1926. <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">
  1927. + Add Network
  1928. </button>
  1929. </div>
  1930. <div class="overflow-x-auto">
  1931. <table class="w-full text-left text-xs font-mono">
  1932. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1933. <tr>
  1934. <th class="py-2.5 px-3">Network (CIDR)</th>
  1935. <th class="py-2.5 px-3">Status</th>
  1936. <th class="py-2.5 px-3">Comment</th>
  1937. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  1938. </tr>
  1939. </thead>
  1940. <tbody id="bgp-nets-table-body" class="divide-y divide-slate-800/80"></tbody>
  1941. </table>
  1942. </div>
  1943. <div id="bgp-nets-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1944. No networks advertised. Click "+ Add Network" to announce your IP prefixes to BGP peers.
  1945. </div>
  1946. </div>
  1947. <!-- Sub-Tab 3: BGP Routes -->
  1948. <div id="dyn-subtab-bgp-routes" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  1949. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  1950. <h3 class="text-sm font-bold text-white">BGP Routing Information Base (show ip bgp)</h3>
  1951. <span id="bgp-routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
  1952. </div>
  1953. <div class="overflow-x-auto">
  1954. <table class="w-full text-left text-xs font-mono">
  1955. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  1956. <tr>
  1957. <th class="py-2.5 px-3">Prefix</th>
  1958. <th class="py-2.5 px-3">Next Hop</th>
  1959. <th class="py-2.5 px-3">Metric</th>
  1960. <th class="py-2.5 px-3">Weight</th>
  1961. <th class="py-2.5 px-3">AS Path</th>
  1962. <th class="py-2.5 px-3">Origin</th>
  1963. </tr>
  1964. </thead>
  1965. <tbody id="bgp-routes-table-body" class="divide-y divide-slate-800/80"></tbody>
  1966. </table>
  1967. </div>
  1968. <div id="bgp-routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  1969. No active routes in BGP table. Check peer connections and ensure BGP is enabled.
  1970. </div>
  1971. </div>
  1972. </section>
  1973. <!-- ================= SECTION: OSPF ROUTING (/routing ospf) ================= -->
  1974. <section id="section-ospf" class="hidden space-y-6">
  1975. <!-- Top Routing Switcher Bar -->
  1976. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  1977. <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">
  1978. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1979. <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" />
  1980. </svg>
  1981. <span>Routes & Policy (/ip route)</span>
  1982. </button>
  1983. <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">
  1984. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1985. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  1986. </svg>
  1987. <span>BGP (/routing bgp)</span>
  1988. </button>
  1989. <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">
  1990. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1991. <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" />
  1992. </svg>
  1993. <span>OSPF (/routing ospf)</span>
  1994. </button>
  1995. <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">
  1996. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  1997. <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" />
  1998. </svg>
  1999. <span>Filters (/routing filter)</span>
  2000. </button>
  2001. </div>
  2002. <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">
  2003. <div>
  2004. <div class="flex items-center gap-2 mb-1">
  2005. <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>
  2006. <h2 class="text-base font-bold text-white">OSPF Dynamic Routing</h2>
  2007. <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>
  2008. </div>
  2009. <p class="text-xs text-slate-400">Enterprise FRRouting OSPFv2 stack: Link-state interior gateway routing, multi-area topologies, and neighbor adjacencies.</p>
  2010. </div>
  2011. <div class="flex items-center space-x-2 flex-wrap gap-y-2">
  2012. <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">
  2013. <span>⚙ OSPF Settings</span>
  2014. </button>
  2015. <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">
  2016. + Add OSPF Interface
  2017. </button>
  2018. <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">
  2019. + Add Area
  2020. </button>
  2021. <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">
  2022. Refresh
  2023. </button>
  2024. </div>
  2025. </div>
  2026. <!-- OSPF Sub-Tabs -->
  2027. <div class="flex border-b border-slate-800 space-x-1 overflow-x-auto">
  2028. <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">
  2029. <span>OSPF Interfaces</span>
  2030. <span id="dyn-badge-ospf-ifaces" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2031. </button>
  2032. <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">
  2033. <span>OSPF Areas</span>
  2034. <span id="dyn-badge-ospf-areas" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2035. </button>
  2036. <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">
  2037. <span>OSPF Neighbors</span>
  2038. <span id="dyn-badge-ospf-nbrs" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2039. </button>
  2040. <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">
  2041. <span>OSPF Routes</span>
  2042. <span id="dyn-badge-ospf-routes" class="px-1.5 py-0.2 rounded text-[10px] bg-slate-800 text-slate-300">0</span>
  2043. </button>
  2044. </div>
  2045. <!-- Sub-Tab 4: OSPF Interfaces -->
  2046. <div id="dyn-subtab-ospf-ifaces" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2047. <div class="p-4 border-b border-slate-800 flex items-center justify-between flex-wrap gap-3">
  2048. <div class="flex items-center gap-3">
  2049. <h3 class="text-sm font-bold text-white">OSPF Interface Templates (/routing ospf interface-template)</h3>
  2050. <span id="ospf-ifaces-count-badge" class="text-xs font-mono text-slate-400">0 Interfaces</span>
  2051. <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>
  2052. </div>
  2053. <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">
  2054. + Add Interface
  2055. </button>
  2056. </div>
  2057. <div class="overflow-x-auto">
  2058. <table class="w-full text-left text-xs font-mono">
  2059. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2060. <tr>
  2061. <th class="py-2.5 px-3 w-16 text-center">Flags</th>
  2062. <th class="py-2.5 px-3">Network (CIDR)</th>
  2063. <th class="py-2.5 px-3">Area</th>
  2064. <th class="py-2.5 px-3">Interface</th>
  2065. <th class="py-2.5 px-3">Cost</th>
  2066. <th class="py-2.5 px-3">Priority</th>
  2067. <th class="py-2.5 px-3">Timers (H/D)</th>
  2068. <th class="py-2.5 px-3">Auth</th>
  2069. <th class="py-2.5 px-3">Comment</th>
  2070. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  2071. </tr>
  2072. </thead>
  2073. <tbody id="ospf-ifaces-table-body" class="divide-y divide-slate-800/80"></tbody>
  2074. </table>
  2075. </div>
  2076. <div id="ospf-ifaces-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2077. No OSPF interfaces configured. Click "+ Add OSPF Interface" to enable OSPF on local subnets.
  2078. </div>
  2079. </div>
  2080. <!-- Sub-Tab 5: OSPF Areas -->
  2081. <div id="dyn-subtab-ospf-areas" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2082. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2083. <div class="flex items-center gap-3">
  2084. <h3 class="text-sm font-bold text-white">OSPF Areas (/routing ospf area)</h3>
  2085. <span id="ospf-areas-count-badge" class="text-xs font-mono text-slate-400">0 Areas</span>
  2086. </div>
  2087. <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">
  2088. + Add Area
  2089. </button>
  2090. </div>
  2091. <div class="overflow-x-auto">
  2092. <table class="w-full text-left text-xs font-mono">
  2093. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2094. <tr>
  2095. <th class="py-2.5 px-3">Name</th>
  2096. <th class="py-2.5 px-3">Area ID</th>
  2097. <th class="py-2.5 px-3">Type</th>
  2098. <th class="py-2.5 px-3">Comment</th>
  2099. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  2100. </tr>
  2101. </thead>
  2102. <tbody id="ospf-areas-table-body" class="divide-y divide-slate-800/80"></tbody>
  2103. </table>
  2104. </div>
  2105. </div>
  2106. <!-- Sub-Tab 6: OSPF Neighbors -->
  2107. <div id="dyn-subtab-ospf-nbrs" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2108. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2109. <h3 class="text-sm font-bold text-white">Live OSPF Neighbors (show ip ospf neighbor)</h3>
  2110. <span id="ospf-nbrs-count-badge" class="text-xs font-mono text-slate-400">0 Neighbors</span>
  2111. </div>
  2112. <div class="overflow-x-auto">
  2113. <table class="w-full text-left text-xs font-mono">
  2114. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2115. <tr>
  2116. <th class="py-2.5 px-3">Neighbor ID</th>
  2117. <th class="py-2.5 px-3">IP Address</th>
  2118. <th class="py-2.5 px-3">Interface</th>
  2119. <th class="py-2.5 px-3">Area</th>
  2120. <th class="py-2.5 px-3">State</th>
  2121. <th class="py-2.5 px-3">Dead Timer</th>
  2122. </tr>
  2123. </thead>
  2124. <tbody id="ospf-nbrs-table-body" class="divide-y divide-slate-800/80"></tbody>
  2125. </table>
  2126. </div>
  2127. <div id="ospf-nbrs-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2128. No active OSPF neighbors discovered. Ensure neighbors are in the same subnet and hello/dead timers match.
  2129. </div>
  2130. </div>
  2131. <!-- Sub-Tab 7: OSPF Routes -->
  2132. <div id="dyn-subtab-ospf-routes" class="hidden bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2133. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2134. <h3 class="text-sm font-bold text-white">OSPF Routing Table (show ip ospf route)</h3>
  2135. <span id="ospf-routes-count-badge" class="text-xs font-mono text-slate-400">0 Routes</span>
  2136. </div>
  2137. <div class="overflow-x-auto">
  2138. <table class="w-full text-left text-xs font-mono">
  2139. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2140. <tr>
  2141. <th class="py-2.5 px-3">Prefix</th>
  2142. <th class="py-2.5 px-3">Type</th>
  2143. <th class="py-2.5 px-3">Cost</th>
  2144. <th class="py-2.5 px-3">Area</th>
  2145. <th class="py-2.5 px-3">Next Hop / Dev</th>
  2146. </tr>
  2147. </thead>
  2148. <tbody id="ospf-routes-table-body" class="divide-y divide-slate-800/80"></tbody>
  2149. </table>
  2150. </div>
  2151. <div id="ospf-routes-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2152. No OSPF routes calculated.
  2153. </div>
  2154. </div>
  2155. </section>
  2156. <!-- ================= SECTION: ROUTING FILTERS (/routing filter) ================= -->
  2157. <section id="section-routing-filters" class="hidden space-y-6">
  2158. <!-- Top Routing Switcher Bar -->
  2159. <div class="flex items-center gap-1.5 p-1 bg-slate-900/90 border border-slate-800 rounded-xl w-fit">
  2160. <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">
  2161. <svg class="w-3.5 h-3.5 text-cyan-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2162. <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" />
  2163. </svg>
  2164. <span>Routes & Policy (/ip route)</span>
  2165. </button>
  2166. <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">
  2167. <svg class="w-3.5 h-3.5 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2168. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6" />
  2169. </svg>
  2170. <span>BGP (/routing bgp)</span>
  2171. </button>
  2172. <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">
  2173. <svg class="w-3.5 h-3.5 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2174. <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" />
  2175. </svg>
  2176. <span>OSPF (/routing ospf)</span>
  2177. </button>
  2178. <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">
  2179. <svg class="w-3.5 h-3.5 text-emerald-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2180. <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" />
  2181. </svg>
  2182. <span>Filters (/routing filter)</span>
  2183. </button>
  2184. </div>
  2185. <!-- Top Banner -->
  2186. <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">
  2187. <div>
  2188. <div class="flex items-center gap-2 mb-1">
  2189. <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>
  2190. <h2 class="text-base font-bold text-white">Routing Filters & Policy Maps</h2>
  2191. </div>
  2192. <p class="text-xs text-slate-400">RouterOS-style filter chains (in-filter / out-filter), prefix-lists, community matching, and BGP attribute modifications</p>
  2193. </div>
  2194. <div class="flex items-center gap-2.5">
  2195. <div class="flex items-center gap-2">
  2196. <label class="text-[11px] text-slate-400 font-medium">Chain:</label>
  2197. <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">
  2198. <option value="all">All Chains</option>
  2199. </select>
  2200. </div>
  2201. <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">
  2202. <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  2203. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
  2204. </svg>
  2205. <span>+ Add Filter Rule</span>
  2206. </button>
  2207. <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">
  2208. ↻
  2209. </button>
  2210. </div>
  2211. </div>
  2212. <!-- Filter Rules Table -->
  2213. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2214. <div class="p-4 border-b border-slate-800 flex items-center justify-between">
  2215. <div class="flex items-center gap-2">
  2216. <h3 class="text-sm font-bold text-white">Filter Rules</h3>
  2217. <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>
  2218. </div>
  2219. <span class="text-xs text-slate-500 font-sans">Evaluated sequentially by order</span>
  2220. </div>
  2221. <div class="overflow-x-auto">
  2222. <table class="w-full text-left text-xs font-mono">
  2223. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2224. <tr>
  2225. <th class="py-2.5 px-3 text-center w-12">Flags</th>
  2226. <th class="py-2.5 px-3 w-16">#</th>
  2227. <th class="py-2.5 px-3">Chain</th>
  2228. <th class="py-2.5 px-3">Action</th>
  2229. <th class="py-2.5 px-3">Match Prefix / Length</th>
  2230. <th class="py-2.5 px-3">Match AS-Path / Community</th>
  2231. <th class="py-2.5 px-3">Set Modifications</th>
  2232. <th class="py-2.5 px-3">Comment</th>
  2233. <th class="py-2.5 px-3 text-right font-sans">Actions</th>
  2234. </tr>
  2235. </thead>
  2236. <tbody id="routing-filters-table-body" class="divide-y divide-slate-800/80"></tbody>
  2237. </table>
  2238. </div>
  2239. <div id="routing-filters-empty" class="hidden p-10 text-center text-slate-500 text-xs font-sans">
  2240. No routing filter rules configured. Click "+ Add Filter Rule" to create a filter chain.
  2241. </div>
  2242. </div>
  2243. </section>
  2244. <!-- ================= SECTION: DEBIAN CONFIG PERSISTENCE ================= -->
  2245. <section id="section-persistence" class="hidden space-y-6">
  2246. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2247. <div class="flex flex-wrap items-center justify-between gap-4 mb-4">
  2248. <div>
  2249. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  2250. <span>Debian /etc/network/interfaces.d/ Persistence</span>
  2251. <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>
  2252. </h3>
  2253. <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>
  2254. </div>
  2255. <div class="flex items-center space-x-3">
  2256. <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>
  2257. <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">
  2258. <span>Save to Debian Config</span>
  2259. </button>
  2260. </div>
  2261. </div>
  2262. <div class="relative">
  2263. <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>
  2264. </div>
  2265. </div>
  2266. </section>
  2267. <!-- ================= SECTION: TROUBLESHOOT TOOLS (/tool) ================= -->
  2268. <section id="section-tools" class="hidden space-y-6">
  2269. <!-- Top Banner -->
  2270. <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">
  2271. <div>
  2272. <div class="flex items-center gap-2 mb-1">
  2273. <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>
  2274. <h2 class="text-base font-bold text-white">Troubleshoot & Diagnostic Tools</h2>
  2275. </div>
  2276. <p class="text-xs text-slate-400">RouterOS-style network diagnostics: ICMP Ping, Traceroute, MTR telemetry, DNS Resolution, and TCP Port Probing</p>
  2277. </div>
  2278. </div>
  2279. <!-- Tools Subtabs Navigation -->
  2280. <div class="flex items-center gap-1 border-b border-slate-800 pb-0 overflow-x-auto">
  2281. <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">
  2282. <span>Ping (/tool ping)</span>
  2283. </button>
  2284. <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">
  2285. <span>Traceroute (/tool traceroute)</span>
  2286. </button>
  2287. <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">
  2288. <span>MTR Telemetry</span>
  2289. </button>
  2290. <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">
  2291. <span>DNS Lookup (/tool resolve)</span>
  2292. </button>
  2293. <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">
  2294. <span>Port Probe (TCP Check)</span>
  2295. </button>
  2296. </div>
  2297. <!-- ================= SUBTAB: PING ================= -->
  2298. <div id="tools-view-ping" class="space-y-5">
  2299. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2300. <form id="tools-ping-form" onsubmit="executePing(event)" class="space-y-4">
  2301. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  2302. <div class="md:col-span-2">
  2303. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2304. <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">
  2305. </div>
  2306. <div>
  2307. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Count</label>
  2308. <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">
  2309. <option value="0">Continuous (Until Stopped)</option>
  2310. <option value="4" selected>4 packets</option>
  2311. <option value="5">5 packets</option>
  2312. <option value="10">10 packets</option>
  2313. <option value="20">20 packets</option>
  2314. <option value="50">50 packets</option>
  2315. <option value="100">100 packets</option>
  2316. </select>
  2317. </div>
  2318. <div>
  2319. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Source Interface</label>
  2320. <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">
  2321. <option value="">Auto (Default Route)</option>
  2322. </select>
  2323. </div>
  2324. </div>
  2325. <div class="flex flex-wrap items-center justify-between gap-4 pt-2">
  2326. <div class="flex items-center space-x-6 text-xs">
  2327. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  2328. <input type="checkbox" id="tools-ping-df" class="rounded text-amber-500 bg-slate-800 border-slate-700">
  2329. <span>Don't Fragment (DF bit)</span>
  2330. </label>
  2331. <div class="flex items-center space-x-2">
  2332. <span class="text-slate-400">Size (bytes):</span>
  2333. <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">
  2334. </div>
  2335. </div>
  2336. <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">
  2337. <span id="tools-ping-spinner" class="hidden animate-spin">↻</span>
  2338. <span id="tools-ping-btn-text">Start Ping</span>
  2339. </button>
  2340. </div>
  2341. </form>
  2342. </div>
  2343. <!-- Ping Results Container -->
  2344. <div id="tools-ping-results" class="hidden space-y-4">
  2345. <!-- KPI Summary Cards -->
  2346. <div class="grid grid-cols-2 md:grid-cols-5 gap-3">
  2347. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2348. <div class="text-[10px] text-slate-400 uppercase">Packets Sent</div>
  2349. <div id="tools-ping-stat-sent" class="text-base font-bold text-white font-mono mt-1">0</div>
  2350. </div>
  2351. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2352. <div class="text-[10px] text-slate-400 uppercase">Received</div>
  2353. <div id="tools-ping-stat-recv" class="text-base font-bold text-emerald-400 font-mono mt-1">0</div>
  2354. </div>
  2355. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2356. <div class="text-[10px] text-slate-400 uppercase">Packet Loss</div>
  2357. <div id="tools-ping-stat-loss" class="text-base font-bold font-mono mt-1">0%</div>
  2358. </div>
  2359. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2360. <div class="text-[10px] text-slate-400 uppercase">Avg RTT</div>
  2361. <div id="tools-ping-stat-avg" class="text-base font-bold text-cyan-400 font-mono mt-1">0 ms</div>
  2362. </div>
  2363. <div class="bg-slate-900 border border-slate-800 rounded-xl p-3 text-center">
  2364. <div class="text-[10px] text-slate-400 uppercase">Min / Max</div>
  2365. <div id="tools-ping-stat-minmax" class="text-xs font-bold text-purple-300 font-mono mt-1.5">-</div>
  2366. </div>
  2367. </div>
  2368. <!-- Replies Table -->
  2369. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2370. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2371. <div class="flex items-center gap-2.5">
  2372. <span class="text-xs font-bold text-white">ICMP Echo Replies</span>
  2373. <span id="tools-ping-status-badge" class="px-2 py-0.5 rounded text-[10px] font-mono font-semibold"></span>
  2374. </div>
  2375. <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>
  2376. </div>
  2377. <div class="overflow-x-auto">
  2378. <table class="w-full text-left text-xs font-mono">
  2379. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2380. <tr>
  2381. <th class="py-2 px-3"># Seq</th>
  2382. <th class="py-2 px-3">Responder</th>
  2383. <th class="py-2 px-3">Bytes</th>
  2384. <th class="py-2 px-3">TTL</th>
  2385. <th class="py-2 px-3">Latency (RTT)</th>
  2386. <th class="py-2 px-3 text-right">Status</th>
  2387. </tr>
  2388. </thead>
  2389. <tbody id="tools-ping-tbody" class="divide-y divide-slate-800/80"></tbody>
  2390. </table>
  2391. </div>
  2392. </div>
  2393. <!-- Raw CLI Drawer -->
  2394. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2395. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2396. <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>
  2397. </details>
  2398. </div>
  2399. </div>
  2400. <!-- ================= SUBTAB: TRACEROUTE ================= -->
  2401. <div id="tools-view-traceroute" class="hidden space-y-5">
  2402. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2403. <form id="tools-traceroute-form" onsubmit="executeTraceroute(event)" class="space-y-4">
  2404. <div class="grid grid-cols-1 md:grid-cols-5 gap-4">
  2405. <div class="md:col-span-2">
  2406. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2407. <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">
  2408. </div>
  2409. <div>
  2410. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Max Hops</label>
  2411. <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">
  2412. </div>
  2413. <div>
  2414. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Protocol</label>
  2415. <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">
  2416. <option value="icmp" selected>ICMP Echo (-I)</option>
  2417. <option value="udp">UDP Probe</option>
  2418. </select>
  2419. </div>
  2420. <div>
  2421. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Source Interface</label>
  2422. <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">
  2423. <option value="">Auto (Default Route)</option>
  2424. </select>
  2425. </div>
  2426. </div>
  2427. <div class="flex items-center justify-between pt-2">
  2428. <label class="flex items-center space-x-2 text-xs text-slate-300 cursor-pointer">
  2429. <input type="checkbox" id="tools-tr-resolve" class="rounded text-amber-500 bg-slate-800 border-slate-700">
  2430. <span>Resolve Hostnames (Reverse DNS)</span>
  2431. </label>
  2432. <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">
  2433. <span id="tools-tr-spinner" class="hidden animate-spin">↻</span>
  2434. <span id="tools-tr-btn-text">Start Traceroute</span>
  2435. </button>
  2436. </div>
  2437. </form>
  2438. </div>
  2439. <div id="tools-tr-results" class="hidden space-y-4">
  2440. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2441. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2442. <div class="flex items-center gap-2.5">
  2443. <span class="text-xs font-bold text-white">Route Hops</span>
  2444. <span id="tools-tr-hops-count" class="text-xs font-mono text-slate-400">0 Hops</span>
  2445. </div>
  2446. <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>
  2447. </div>
  2448. <div class="overflow-x-auto">
  2449. <table class="w-full text-left text-xs font-mono">
  2450. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2451. <tr>
  2452. <th class="py-2.5 px-3 w-16">Hop #</th>
  2453. <th class="py-2.5 px-3">Gateway Host / IP</th>
  2454. <th class="py-2.5 px-3">RTT 1</th>
  2455. <th class="py-2.5 px-3">RTT 2</th>
  2456. <th class="py-2.5 px-3 text-right">Status</th>
  2457. </tr>
  2458. </thead>
  2459. <tbody id="tools-tr-tbody" class="divide-y divide-slate-800/80"></tbody>
  2460. </table>
  2461. </div>
  2462. </div>
  2463. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2464. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2465. <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>
  2466. </details>
  2467. </div>
  2468. </div>
  2469. <!-- ================= SUBTAB: MTR ================= -->
  2470. <div id="tools-view-mtr" class="hidden space-y-5">
  2471. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2472. <form id="tools-mtr-form" onsubmit="executeMTR(event)" class="space-y-4">
  2473. <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
  2474. <div class="md:col-span-2">
  2475. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2476. <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">
  2477. </div>
  2478. <div>
  2479. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Cycle Count</label>
  2480. <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">
  2481. <option value="2">2 cycles (Fast)</option>
  2482. <option value="3" selected>3 cycles</option>
  2483. <option value="5">5 cycles</option>
  2484. <option value="10">10 cycles (Deep)</option>
  2485. </select>
  2486. </div>
  2487. </div>
  2488. <div class="flex justify-end pt-2">
  2489. <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">
  2490. <span id="tools-mtr-spinner" class="hidden">↻</span>
  2491. <span>Start MTR Report</span>
  2492. </button>
  2493. </div>
  2494. </form>
  2495. </div>
  2496. <div id="tools-mtr-results" class="hidden space-y-4">
  2497. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2498. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2499. <span class="text-xs font-bold text-white">MTR Route Telemetry</span>
  2500. <span id="tools-mtr-hops-count" class="text-xs font-mono text-slate-400">0 Hops</span>
  2501. </div>
  2502. <div class="overflow-x-auto">
  2503. <table class="w-full text-left text-xs font-mono">
  2504. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2505. <tr>
  2506. <th class="py-2.5 px-3 w-16">Hop #</th>
  2507. <th class="py-2.5 px-3">Host / Router</th>
  2508. <th class="py-2.5 px-3">Loss %</th>
  2509. <th class="py-2.5 px-3">Sent</th>
  2510. <th class="py-2.5 px-3">Last (ms)</th>
  2511. <th class="py-2.5 px-3">Avg (ms)</th>
  2512. <th class="py-2.5 px-3">Best (ms)</th>
  2513. <th class="py-2.5 px-3">Worst (ms)</th>
  2514. <th class="py-2.5 px-3">StDev</th>
  2515. </tr>
  2516. </thead>
  2517. <tbody id="tools-mtr-tbody" class="divide-y divide-slate-800/80"></tbody>
  2518. </table>
  2519. </div>
  2520. </div>
  2521. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2522. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2523. <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>
  2524. </details>
  2525. </div>
  2526. </div>
  2527. <!-- ================= SUBTAB: DNS LOOKUP ================= -->
  2528. <div id="tools-view-dns" class="hidden space-y-5">
  2529. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2530. <form id="tools-dns-form" onsubmit="executeDNS(event)" class="space-y-4">
  2531. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  2532. <div class="md:col-span-2">
  2533. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Domain Name *</label>
  2534. <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">
  2535. </div>
  2536. <div>
  2537. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Record Type</label>
  2538. <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">
  2539. <option value="A" selected>A (IPv4)</option>
  2540. <option value="AAAA">AAAA (IPv6)</option>
  2541. <option value="CNAME">CNAME</option>
  2542. <option value="MX">MX (Mail)</option>
  2543. <option value="TXT">TXT</option>
  2544. <option value="NS">NS (Nameserver)</option>
  2545. <option value="SOA">SOA</option>
  2546. <option value="ANY">ANY</option>
  2547. </select>
  2548. </div>
  2549. <div>
  2550. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Custom DNS Server (Optional)</label>
  2551. <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">
  2552. </div>
  2553. </div>
  2554. <div class="flex justify-end pt-2">
  2555. <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">
  2556. <span id="tools-dns-spinner" class="hidden">↻</span>
  2557. <span>Resolve Domain</span>
  2558. </button>
  2559. </div>
  2560. </form>
  2561. </div>
  2562. <div id="tools-dns-results" class="hidden space-y-4">
  2563. <div class="bg-slate-900/90 border border-slate-800 rounded-xl overflow-hidden">
  2564. <div class="p-3 border-b border-slate-800 flex items-center justify-between">
  2565. <div class="flex items-center gap-2">
  2566. <span class="text-xs font-bold text-white">DNS Answer Records</span>
  2567. <span id="tools-dns-meta" class="text-[11px] font-mono text-cyan-300"></span>
  2568. </div>
  2569. </div>
  2570. <div class="overflow-x-auto">
  2571. <table class="w-full text-left text-xs font-mono">
  2572. <thead class="text-slate-400 bg-slate-950/60 border-b border-slate-800 uppercase tracking-wider text-[10px] font-sans">
  2573. <tr>
  2574. <th class="py-2.5 px-3">Name</th>
  2575. <th class="py-2.5 px-3">TTL (s)</th>
  2576. <th class="py-2.5 px-3">Class</th>
  2577. <th class="py-2.5 px-3">Type</th>
  2578. <th class="py-2.5 px-3">Value / Target</th>
  2579. </tr>
  2580. </thead>
  2581. <tbody id="tools-dns-tbody" class="divide-y divide-slate-800/80"></tbody>
  2582. </table>
  2583. </div>
  2584. </div>
  2585. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2586. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Raw CLI Console Output</summary>
  2587. <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>
  2588. </details>
  2589. </div>
  2590. </div>
  2591. <!-- ================= SUBTAB: PORT PROBE ================= -->
  2592. <div id="tools-view-port" class="hidden space-y-5">
  2593. <div class="bg-slate-900/90 border border-slate-800 rounded-xl p-5">
  2594. <form id="tools-port-form" onsubmit="executePortProbe(event)" class="space-y-4">
  2595. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  2596. <div class="md:col-span-2">
  2597. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Target Host or IP *</label>
  2598. <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">
  2599. </div>
  2600. <div>
  2601. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Port (TCP) *</label>
  2602. <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">
  2603. </div>
  2604. <div>
  2605. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Timeout (s)</label>
  2606. <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">
  2607. </div>
  2608. </div>
  2609. <!-- Quick Presets -->
  2610. <div class="flex flex-wrap items-center gap-2 pt-1">
  2611. <span class="text-[11px] text-slate-400">Quick Ports:</span>
  2612. <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>
  2613. <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>
  2614. <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>
  2615. <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>
  2616. <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>
  2617. <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>
  2618. <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>
  2619. </div>
  2620. <div class="flex justify-end pt-2">
  2621. <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">
  2622. <span id="tools-port-spinner" class="hidden">↻</span>
  2623. <span>Probe Port</span>
  2624. </button>
  2625. </div>
  2626. </form>
  2627. </div>
  2628. <div id="tools-port-results" class="hidden space-y-4">
  2629. <div id="tools-port-banner" class="rounded-xl p-5 border flex items-center justify-between">
  2630. <div class="flex items-center gap-3">
  2631. <span id="tools-port-icon" class="w-8 h-8 rounded-full flex items-center justify-center font-bold text-sm"></span>
  2632. <div>
  2633. <h3 id="tools-port-title" class="text-sm font-bold"></h3>
  2634. <p id="tools-port-sub" class="text-xs mt-0.5 font-mono"></p>
  2635. </div>
  2636. </div>
  2637. <div class="text-right">
  2638. <div class="text-[10px] uppercase text-slate-400">Handshake Latency</div>
  2639. <div id="tools-port-latency" class="text-base font-bold font-mono text-white"></div>
  2640. </div>
  2641. </div>
  2642. <details class="bg-slate-900/60 border border-slate-800/80 rounded-xl p-3 text-xs">
  2643. <summary class="cursor-pointer text-slate-400 font-medium hover:text-white">Handshake Details</summary>
  2644. <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>
  2645. </details>
  2646. </div>
  2647. </div>
  2648. </section>
  2649. </main>
  2650. </div>
  2651. </div>
  2652. <!-- ================= MODAL: CREATE VLAN ================= -->
  2653. <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">
  2654. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2655. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2656. <h3 class="text-sm font-bold text-white">Create New VLAN Interface</h3>
  2657. <button onclick="closeVlanModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2658. </div>
  2659. <form id="vlan-form" onsubmit="submitCreateVlan(event)" class="p-6 space-y-4">
  2660. <div>
  2661. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Parent Interface *</label>
  2662. <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>
  2663. </div>
  2664. <div class="grid grid-cols-2 gap-4">
  2665. <div>
  2666. <label class="block text-xs font-semibold text-slate-300 mb-1.5">VLAN ID (1-4094) *</label>
  2667. <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">
  2668. </div>
  2669. <div>
  2670. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface Name</label>
  2671. <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">
  2672. </div>
  2673. </div>
  2674. <div>
  2675. <div class="flex items-center justify-between mb-1.5">
  2676. <label class="text-xs font-semibold text-slate-300">Router IP Address & CIDR</label>
  2677. <div class="flex space-x-1">
  2678. <button type="button" onclick="setSubnetPreset('/24')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/24</button>
  2679. <button type="button" onclick="setSubnetPreset('/23')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/23</button>
  2680. <button type="button" onclick="setSubnetPreset('/16')" class="text-[10px] bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded">/16</button>
  2681. </div>
  2682. </div>
  2683. <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">
  2684. </div>
  2685. <div class="grid grid-cols-2 gap-4">
  2686. <div>
  2687. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
  2688. <select id="vlan-role" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-white">
  2689. <option value="LAN">LAN</option>
  2690. <option value="GUEST">Guest Network</option>
  2691. <option value="IOT">IoT / Smart Home</option>
  2692. <option value="DMZ">DMZ / Isolated</option>
  2693. <option value="MGMT">Management</option>
  2694. <option value="WAN">WAN / Uplink</option>
  2695. </select>
  2696. </div>
  2697. <div>
  2698. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description / Alias</label>
  2699. <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">
  2700. </div>
  2701. </div>
  2702. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2703. <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>
  2704. <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>
  2705. </div>
  2706. </form>
  2707. </div>
  2708. </div>
  2709. <!-- ================= MODAL: EDIT INTERFACE ================= -->
  2710. <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">
  2711. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2712. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2713. <div>
  2714. <h3 class="text-sm font-bold text-white flex items-center gap-2">
  2715. <span id="modal-iface-name">eth0</span>
  2716. <span id="modal-iface-badge" class="text-[10px] font-mono px-2 py-0.5 rounded bg-slate-800 text-slate-300">Ethernet</span>
  2717. </h3>
  2718. </div>
  2719. <button onclick="closeIfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2720. </div>
  2721. <div class="p-6 space-y-5">
  2722. <div class="grid grid-cols-2 gap-4 p-3 bg-slate-950/60 rounded-xl border border-slate-800/80">
  2723. <div>
  2724. <span class="block text-[11px] text-slate-400 mb-1">Administrative Link</span>
  2725. <div class="flex items-center space-x-2">
  2726. <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>
  2727. <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>
  2728. </div>
  2729. </div>
  2730. <div>
  2731. <span class="block text-[11px] text-slate-400 mb-1">MTU Size</span>
  2732. <div class="flex items-center space-x-2">
  2733. <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">
  2734. <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>
  2735. </div>
  2736. </div>
  2737. </div>
  2738. <div>
  2739. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Assigned IP Addresses</label>
  2740. <div id="modal-ip-list" class="space-y-1.5 mb-3 font-mono text-xs"></div>
  2741. <div class="flex space-x-2">
  2742. <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">
  2743. <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>
  2744. </div>
  2745. </div>
  2746. <div class="grid grid-cols-2 gap-4">
  2747. <div>
  2748. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Role Tag</label>
  2749. <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">
  2750. <option value="WAN">WAN / Uplink</option>
  2751. <option value="LAN">LAN</option>
  2752. <option value="DMZ">DMZ</option>
  2753. <option value="GUEST">Guest</option>
  2754. <option value="IOT">IoT</option>
  2755. <option value="MGMT">Management</option>
  2756. </select>
  2757. </div>
  2758. <div>
  2759. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Description</label>
  2760. <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">
  2761. </div>
  2762. </div>
  2763. <div class="pt-4 border-t border-slate-800 flex justify-between items-center">
  2764. <button id="modal-delete-vlan-btn" onclick="confirmDeleteVlan(currentModalIface)" class="hidden text-xs text-rose-400 hover:text-rose-300">Delete VLAN</button>
  2765. <div class="flex space-x-3">
  2766. <button onclick="closeIfaceModal()" class="px-4 py-2 rounded-lg text-xs font-medium text-slate-400 hover:bg-slate-800">Close</button>
  2767. <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>
  2768. </div>
  2769. </div>
  2770. </div>
  2771. </div>
  2772. </div>
  2773. <!-- ================= MODAL: PPPoE CLIENT ================= -->
  2774. <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">
  2775. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2776. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2777. <h3 id="pppoe-modal-title" class="text-sm font-bold text-white">Add PPPoE Client Interface</h3>
  2778. <button onclick="closePPPoEModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2779. </div>
  2780. <form onsubmit="submitSavePPPoE(event)" class="p-6 space-y-4">
  2781. <input type="hidden" id="pppoe-modal-edit-orig">
  2782. <div class="grid grid-cols-2 gap-4">
  2783. <div>
  2784. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Name *</label>
  2785. <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">
  2786. </div>
  2787. <div>
  2788. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Interface *</label>
  2789. <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>
  2790. </div>
  2791. </div>
  2792. <div class="grid grid-cols-2 gap-4">
  2793. <div>
  2794. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  2795. <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">
  2796. </div>
  2797. <div>
  2798. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  2799. <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">
  2800. </div>
  2801. </div>
  2802. <div class="grid grid-cols-2 gap-4">
  2803. <div>
  2804. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Service Name (Optional)</label>
  2805. <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">
  2806. </div>
  2807. <div>
  2808. <label class="block text-xs font-semibold text-slate-300 mb-1.5">MTU</label>
  2809. <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">
  2810. </div>
  2811. </div>
  2812. <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
  2813. <label class="flex items-center space-x-2 cursor-pointer">
  2814. <input type="checkbox" id="pppoe-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
  2815. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  2816. </label>
  2817. <label class="flex items-center space-x-2 cursor-pointer">
  2818. <input type="checkbox" id="pppoe-modal-reconnect" checked class="rounded bg-slate-800 border-slate-700 text-blue-500">
  2819. <span class="text-xs text-slate-300 font-medium">Auto-Reconnect</span>
  2820. </label>
  2821. <label class="flex items-center space-x-2 cursor-pointer">
  2822. <input type="checkbox" id="pppoe-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  2823. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  2824. </label>
  2825. </div>
  2826. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2827. <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>
  2828. <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>
  2829. </div>
  2830. </form>
  2831. </div>
  2832. </div>
  2833. <!-- ================= MODAL: WIREGUARD INTERFACE ================= -->
  2834. <!-- ================= MODAL: ADD / EDIT WIREGUARD INTERFACE ================= -->
  2835. <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">
  2836. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2837. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2838. <div class="flex items-center gap-2">
  2839. <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>
  2840. <h3 id="wg-iface-modal-title" class="text-sm font-bold text-white">Add WireGuard Interface</h3>
  2841. </div>
  2842. <button onclick="closeAddWGInterfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2843. </div>
  2844. <form onsubmit="submitSaveWGInterface(event)" class="p-6 space-y-4 text-xs">
  2845. <input type="hidden" id="wg-iface-modal-edit-orig">
  2846. <div class="grid grid-cols-2 gap-4">
  2847. <div>
  2848. <label class="block font-semibold text-slate-300 mb-1.5">Interface Name *</label>
  2849. <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">
  2850. <p class="text-[10px] text-slate-500 mt-1">e.g. wg0, wg-office, wgx-Space</p>
  2851. </div>
  2852. <div>
  2853. <label class="block font-semibold text-slate-300 mb-1.5">Listen Port *</label>
  2854. <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">
  2855. </div>
  2856. </div>
  2857. <div class="grid grid-cols-2 gap-4">
  2858. <div>
  2859. <label class="block font-semibold text-slate-300 mb-1.5">Tunnel IP (CIDR)</label>
  2860. <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">
  2861. <p class="text-[10px] text-slate-500 mt-1">Assigned IP/mask, or leave blank</p>
  2862. </div>
  2863. <div>
  2864. <label class="block font-semibold text-slate-300 mb-1.5">MTU</label>
  2865. <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">
  2866. </div>
  2867. </div>
  2868. <div>
  2869. <label class="block font-semibold text-slate-300 mb-1.5">Comment / Alias</label>
  2870. <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">
  2871. </div>
  2872. <div class="bg-slate-950/60 border border-slate-800/80 rounded-xl p-3.5 space-y-3">
  2873. <div class="flex items-center justify-between">
  2874. <span class="text-[11px] font-bold text-slate-400 uppercase tracking-wider font-mono">Cryptographic Keypair</span>
  2875. <button type="button" onclick="generateWGInterfaceKeys()" class="text-[11px] text-rose-400 hover:text-rose-300 font-semibold flex items-center gap-1">
  2876. <span>⚡ Generate New Keypair</span>
  2877. </button>
  2878. </div>
  2879. <div>
  2880. <div class="flex items-center justify-between mb-1">
  2881. <label class="text-[11px] font-semibold text-slate-300">Public Key</label>
  2882. <button type="button" onclick="copyWGInterfacePubKey()" class="text-[10px] text-cyan-400 hover:text-cyan-300">📋 Copy Public Key</button>
  2883. </div>
  2884. <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]">
  2885. </div>
  2886. <div>
  2887. <div class="flex items-center justify-between mb-1">
  2888. <label class="text-[11px] font-semibold text-slate-300">Private Key (Secret) *</label>
  2889. <button type="button" onclick="toggleWGPrivKeyVisibility()" id="btn-toggle-wg-privkey" class="text-[10px] text-slate-400 hover:text-white">👁️ Show</button>
  2890. </div>
  2891. <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">
  2892. <p class="text-[10px] text-slate-500 mt-1">You can paste any existing base64 private key; the public key will update automatically.</p>
  2893. </div>
  2894. </div>
  2895. <div class="pt-1">
  2896. <label class="flex items-center space-x-2.5 cursor-pointer">
  2897. <input type="checkbox" id="wg-iface-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500 focus:ring-rose-500">
  2898. <span class="font-medium text-slate-300">Disabled (X)</span>
  2899. </label>
  2900. </div>
  2901. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2902. <button type="button" onclick="closeAddWGInterfaceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800 transition">Cancel</button>
  2903. <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>
  2904. </div>
  2905. </form>
  2906. </div>
  2907. </div>
  2908. <!-- ================= MODAL: ADD / EDIT WIREGUARD PEER ================= -->
  2909. <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">
  2910. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2911. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2912. <div class="flex items-center gap-2">
  2913. <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>
  2914. <h3 id="wg-peer-modal-title" class="text-sm font-bold text-white">Add WireGuard Peer</h3>
  2915. </div>
  2916. <button onclick="closeAddWGPeerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  2917. </div>
  2918. <form onsubmit="submitSaveWGPeer(event)" class="p-6 space-y-4 text-xs">
  2919. <input type="hidden" id="wg-peer-modal-edit-orig-iface">
  2920. <input type="hidden" id="wg-peer-modal-edit-orig-pubkey">
  2921. <div class="grid grid-cols-2 gap-4">
  2922. <div>
  2923. <label class="block font-semibold text-slate-300 mb-1.5">WireGuard Interface *</label>
  2924. <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>
  2925. </div>
  2926. <div>
  2927. <label class="block font-semibold text-slate-300 mb-1.5">Peer Name / Alias *</label>
  2928. <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">
  2929. </div>
  2930. </div>
  2931. <div>
  2932. <div class="flex items-center justify-between mb-1.5">
  2933. <label class="font-semibold text-slate-300">Peer Public Key *</label>
  2934. <button type="button" onclick="generatePeerKeypairHelper()" class="text-[11px] text-cyan-400 hover:text-cyan-300 font-semibold flex items-center gap-1">
  2935. <span>⚡ Generate Client Keypair</span>
  2936. </button>
  2937. </div>
  2938. <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">
  2939. <!-- Warning if user tries to paste interface's own public key -->
  2940. <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">
  2941. ⚠️ <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!
  2942. </div>
  2943. <!-- Box showing generated client secret key if generated here -->
  2944. <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">
  2945. <div class="flex items-center justify-between text-[11px] text-cyan-300 font-bold font-sans">
  2946. <span>Generated Client Private Key (Secret):</span>
  2947. <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>
  2948. </div>
  2949. <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">
  2950. <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>
  2951. </div>
  2952. </div>
  2953. <div>
  2954. <label class="block font-semibold text-slate-300 mb-1.5">Allowed IPs (CIDR) *</label>
  2955. <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">
  2956. <p class="text-[10px] text-slate-500 mt-1">IP ranges routed to/from this peer (comma-separated)</p>
  2957. </div>
  2958. <div class="grid grid-cols-3 gap-3">
  2959. <div class="col-span-2">
  2960. <label class="block font-semibold text-slate-300 mb-1.5">Endpoint Host/IP (Optional)</label>
  2961. <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">
  2962. </div>
  2963. <div>
  2964. <label class="block font-semibold text-slate-300 mb-1.5">Endpoint Port</label>
  2965. <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">
  2966. </div>
  2967. </div>
  2968. <div class="grid grid-cols-2 gap-4">
  2969. <div>
  2970. <label class="block font-semibold text-slate-300 mb-1.5">Keepalive (seconds)</label>
  2971. <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">
  2972. <p class="text-[10px] text-slate-500 mt-1">25s recommended for NAT traversal</p>
  2973. </div>
  2974. <div>
  2975. <div class="flex items-center justify-between mb-1.5">
  2976. <label class="font-semibold text-slate-300">Preshared Key</label>
  2977. <button type="button" onclick="generatePeerPSK()" class="text-[10px] text-purple-400 hover:text-purple-300 font-semibold">Generate</button>
  2978. </div>
  2979. <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">
  2980. </div>
  2981. </div>
  2982. <div class="pt-1">
  2983. <label class="flex items-center space-x-2.5 cursor-pointer">
  2984. <input type="checkbox" id="wg-peer-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500 focus:ring-rose-500">
  2985. <span class="font-medium text-slate-300">Disabled (X)</span>
  2986. </label>
  2987. </div>
  2988. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  2989. <button type="button" onclick="closeAddWGPeerModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800 transition">Cancel</button>
  2990. <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>
  2991. </div>
  2992. </form>
  2993. </div>
  2994. </div>
  2995. <!-- ================= MODAL: IPSEC TUNNEL ================= -->
  2996. <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">
  2997. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  2998. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  2999. <h3 id="ipsec-modal-title" class="text-sm font-bold text-white">Configure IPSec IKEv2 Tunnel</h3>
  3000. <button onclick="closeAddIPSecModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3001. </div>
  3002. <form onsubmit="submitSaveIPSec(event)" class="p-6 space-y-4">
  3003. <div>
  3004. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connection Name *</label>
  3005. <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">
  3006. </div>
  3007. <div class="grid grid-cols-2 gap-4">
  3008. <div>
  3009. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Local Subnet *</label>
  3010. <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">
  3011. </div>
  3012. <div>
  3013. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Subnet *</label>
  3014. <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">
  3015. </div>
  3016. </div>
  3017. <div>
  3018. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Remote Gateway IP / FQDN *</label>
  3019. <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">
  3020. </div>
  3021. <div>
  3022. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Pre-Shared Key (PSK) *</label>
  3023. <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">
  3024. </div>
  3025. <div class="grid grid-cols-2 gap-4">
  3026. <div>
  3027. <label class="block text-xs font-semibold text-slate-300 mb-1.5">IKE Proposals</label>
  3028. <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">
  3029. </div>
  3030. <div>
  3031. <label class="block text-xs font-semibold text-slate-300 mb-1.5">ESP Proposals</label>
  3032. <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">
  3033. </div>
  3034. </div>
  3035. <div class="grid grid-cols-2 gap-4 pt-2">
  3036. <label class="flex items-center space-x-2 cursor-pointer">
  3037. <input type="checkbox" id="ipsec-modal-autostart" checked class="rounded bg-slate-800 border-slate-700 text-amber-500">
  3038. <span class="text-xs text-slate-300 font-medium">Auto-start on boot</span>
  3039. </label>
  3040. <label class="flex items-center space-x-2 cursor-pointer">
  3041. <input type="checkbox" id="ipsec-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3042. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  3043. </label>
  3044. </div>
  3045. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3046. <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>
  3047. <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>
  3048. </div>
  3049. </form>
  3050. </div>
  3051. </div>
  3052. <!-- ================= MODAL: L2TP CLIENT ================= -->
  3053. <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">
  3054. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3055. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3056. <h3 id="l2tp-modal-title" class="text-sm font-bold text-white">Add L2TP Client Interface</h3>
  3057. <button onclick="closeL2TPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3058. </div>
  3059. <form onsubmit="submitSaveL2TP(event)" class="p-6 space-y-4">
  3060. <div>
  3061. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
  3062. <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">
  3063. </div>
  3064. <div>
  3065. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
  3066. <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">
  3067. </div>
  3068. <div class="grid grid-cols-2 gap-4">
  3069. <div>
  3070. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  3071. <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">
  3072. </div>
  3073. <div>
  3074. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  3075. <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">
  3076. </div>
  3077. </div>
  3078. <div>
  3079. <label class="block text-xs font-semibold text-slate-300 mb-1.5">IPSec Secret / PSK (Optional for L2TP/IPsec)</label>
  3080. <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">
  3081. </div>
  3082. <div class="grid grid-cols-2 gap-4 pt-2">
  3083. <label class="flex items-center space-x-2 cursor-pointer">
  3084. <input type="checkbox" id="l2tp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-cyan-500">
  3085. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  3086. </label>
  3087. <label class="flex items-center space-x-2 cursor-pointer">
  3088. <input type="checkbox" id="l2tp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3089. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  3090. </label>
  3091. </div>
  3092. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3093. <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>
  3094. <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>
  3095. </div>
  3096. </form>
  3097. </div>
  3098. </div>
  3099. <!-- ================= MODAL: PPTP CLIENT ================= -->
  3100. <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">
  3101. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3102. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3103. <h3 id="pptp-modal-title" class="text-sm font-bold text-white">Add PPTP Client Interface</h3>
  3104. <button onclick="closePPTPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3105. </div>
  3106. <form onsubmit="submitSavePPTP(event)" class="p-6 space-y-4">
  3107. <div>
  3108. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Client Interface Name *</label>
  3109. <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">
  3110. </div>
  3111. <div>
  3112. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Connect To (Server IP / Host) *</label>
  3113. <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">
  3114. </div>
  3115. <div class="grid grid-cols-2 gap-4">
  3116. <div>
  3117. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Username *</label>
  3118. <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">
  3119. </div>
  3120. <div>
  3121. <label class="block text-xs font-semibold text-slate-300 mb-1.5">Password *</label>
  3122. <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">
  3123. </div>
  3124. </div>
  3125. <div class="grid grid-cols-3 gap-2 pt-2 border-t border-slate-800/80">
  3126. <label class="flex items-center space-x-2 cursor-pointer">
  3127. <input type="checkbox" id="pptp-modal-mppe" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
  3128. <span class="text-xs text-slate-300 font-medium">MPPE-128</span>
  3129. </label>
  3130. <label class="flex items-center space-x-2 cursor-pointer">
  3131. <input type="checkbox" id="pptp-modal-defroute" checked class="rounded bg-slate-800 border-slate-700 text-purple-500">
  3132. <span class="text-xs text-slate-300 font-medium">Default Route</span>
  3133. </label>
  3134. <label class="flex items-center space-x-2 cursor-pointer">
  3135. <input type="checkbox" id="pptp-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3136. <span class="text-xs text-slate-300 font-medium">Disabled (X)</span>
  3137. </label>
  3138. </div>
  3139. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3140. <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>
  3141. <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>
  3142. </div>
  3143. </form>
  3144. </div>
  3145. </div>
  3146. <!-- ================= MODAL: FIREWALL FILTER RULE ================= -->
  3147. <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">
  3148. <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">
  3149. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3150. <h3 id="filter-modal-title" class="text-sm font-bold text-white">Add Firewall Filter Rule</h3>
  3151. <button onclick="closeFilterModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3152. </div>
  3153. <form onsubmit="submitSaveFilterRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  3154. <input type="hidden" id="filter-modal-id">
  3155. <div class="grid grid-cols-2 gap-4">
  3156. <div>
  3157. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  3158. <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">
  3159. <option value="input">input (traffic to router)</option>
  3160. <option value="forward" selected>forward (routed traffic)</option>
  3161. <option value="output">output (traffic from router)</option>
  3162. </select>
  3163. </div>
  3164. <div>
  3165. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  3166. <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">
  3167. <option value="accept" selected>accept</option>
  3168. <option value="drop">drop</option>
  3169. <option value="reject">reject</option>
  3170. <option value="log">log</option>
  3171. <option value="jump">jump</option>
  3172. <option value="return">return</option>
  3173. </select>
  3174. </div>
  3175. </div>
  3176. <div id="filter-action-reject-box" class="hidden p-3 bg-rose-950/20 border border-rose-900/30 rounded-lg">
  3177. <label class="block font-semibold text-rose-300 mb-1">Reject With</label>
  3178. <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">
  3179. <option value="icmp-network-unreachable">icmp-network-unreachable</option>
  3180. <option value="icmp-host-unreachable">icmp-host-unreachable</option>
  3181. <option value="icmp-port-unreachable">icmp-port-unreachable</option>
  3182. <option value="tcp-reset">tcp-reset (TCP RST)</option>
  3183. </select>
  3184. </div>
  3185. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3186. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
  3187. <div class="grid grid-cols-2 gap-3">
  3188. <div>
  3189. <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
  3190. <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">
  3191. <option value="all">all</option>
  3192. <option value="tcp">tcp (6)</option>
  3193. <option value="udp">udp (17)</option>
  3194. <option value="icmp">icmp (1)</option>
  3195. <option value="gre">gre (47)</option>
  3196. <option value="esp">esp (50)</option>
  3197. </select>
  3198. </div>
  3199. <div>
  3200. <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
  3201. <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">
  3202. </div>
  3203. </div>
  3204. <div class="grid grid-cols-2 gap-3">
  3205. <div>
  3206. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  3207. <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">
  3208. </div>
  3209. <div>
  3210. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  3211. <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">
  3212. </div>
  3213. </div>
  3214. <div class="grid grid-cols-2 gap-3">
  3215. <div>
  3216. <label class="block font-semibold text-slate-300 mb-1">Src. Port(s)</label>
  3217. <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">
  3218. </div>
  3219. <div>
  3220. <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
  3221. <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">
  3222. </div>
  3223. </div>
  3224. <div class="grid grid-cols-2 gap-3">
  3225. <div>
  3226. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  3227. <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>
  3228. </div>
  3229. <div>
  3230. <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
  3231. <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>
  3232. </div>
  3233. </div>
  3234. <div>
  3235. <label class="block font-semibold text-slate-300 mb-1.5">Connection State</label>
  3236. <div class="flex flex-wrap gap-3">
  3237. <label class="flex items-center space-x-1.5 cursor-pointer">
  3238. <input type="checkbox" id="filter-modal-cs-established" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3239. <span class="text-slate-300">established</span>
  3240. </label>
  3241. <label class="flex items-center space-x-1.5 cursor-pointer">
  3242. <input type="checkbox" id="filter-modal-cs-related" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3243. <span class="text-slate-300">related</span>
  3244. </label>
  3245. <label class="flex items-center space-x-1.5 cursor-pointer">
  3246. <input type="checkbox" id="filter-modal-cs-new" class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3247. <span class="text-slate-300">new</span>
  3248. </label>
  3249. <label class="flex items-center space-x-1.5 cursor-pointer">
  3250. <input type="checkbox" id="filter-modal-cs-invalid" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3251. <span class="text-slate-300">invalid</span>
  3252. </label>
  3253. </div>
  3254. </div>
  3255. <div class="grid grid-cols-2 gap-3">
  3256. <div>
  3257. <div class="flex items-center justify-between mb-1">
  3258. <label class="font-semibold text-slate-300">Src. Address List</label>
  3259. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3260. <input type="checkbox" id="filter-modal-srclist-inv" class="rounded bg-slate-800 border-slate-700">
  3261. <span>! Invert</span>
  3262. </label>
  3263. </div>
  3264. <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">
  3265. <option value="">(None)</option>
  3266. </select>
  3267. </div>
  3268. <div>
  3269. <div class="flex items-center justify-between mb-1">
  3270. <label class="font-semibold text-slate-300">Dst. Address List</label>
  3271. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3272. <input type="checkbox" id="filter-modal-dstlist-inv" class="rounded bg-slate-800 border-slate-700">
  3273. <span>! Invert</span>
  3274. </label>
  3275. </div>
  3276. <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">
  3277. <option value="">(None)</option>
  3278. </select>
  3279. </div>
  3280. </div>
  3281. <div class="grid grid-cols-2 gap-3">
  3282. <div>
  3283. <div class="flex items-center justify-between mb-1">
  3284. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Source GEO IP List</span></label>
  3285. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3286. <input type="checkbox" id="filter-modal-srcgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3287. <span>! Invert</span>
  3288. </label>
  3289. </div>
  3290. <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">
  3291. <option value="">(None)</option>
  3292. </select>
  3293. </div>
  3294. <div>
  3295. <div class="flex items-center justify-between mb-1">
  3296. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Destination GEO IP List</span></label>
  3297. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3298. <input type="checkbox" id="filter-modal-dstgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3299. <span>! Invert</span>
  3300. </label>
  3301. </div>
  3302. <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">
  3303. <option value="">(None)</option>
  3304. </select>
  3305. </div>
  3306. </div>
  3307. </div>
  3308. <div>
  3309. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  3310. <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">
  3311. </div>
  3312. <div class="pt-2">
  3313. <label class="flex items-center space-x-2 cursor-pointer">
  3314. <input type="checkbox" id="filter-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3315. <span class="font-medium text-slate-300">Disabled (X)</span>
  3316. </label>
  3317. </div>
  3318. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3319. <button type="button" onclick="closeFilterModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3320. <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>
  3321. </div>
  3322. </form>
  3323. </div>
  3324. </div>
  3325. <!-- ================= MODAL: FIREWALL NAT RULE ================= -->
  3326. <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">
  3327. <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">
  3328. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3329. <h3 id="nat-modal-title" class="text-sm font-bold text-white">Add NAT Rule</h3>
  3330. <button onclick="closeNATModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3331. </div>
  3332. <form onsubmit="submitSaveNATRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  3333. <input type="hidden" id="nat-modal-id">
  3334. <div class="grid grid-cols-2 gap-4">
  3335. <div>
  3336. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  3337. <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">
  3338. <option value="srcnat" selected>srcnat (Outgoing / Masquerade)</option>
  3339. <option value="dstnat">dstnat (Incoming / Port Forwarding)</option>
  3340. </select>
  3341. </div>
  3342. <div>
  3343. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  3344. <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">
  3345. <option value="masquerade" selected>masquerade</option>
  3346. <option value="src-nat">src-nat</option>
  3347. <option value="dst-nat">dst-nat</option>
  3348. <option value="redirect">redirect</option>
  3349. <option value="accept">accept</option>
  3350. </select>
  3351. </div>
  3352. </div>
  3353. <div id="nat-action-to-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3354. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">NAT Target (To Addresses / Ports)</span>
  3355. <div class="grid grid-cols-2 gap-3">
  3356. <div>
  3357. <label class="block font-semibold text-slate-300 mb-1">To Addresses</label>
  3358. <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">
  3359. </div>
  3360. <div>
  3361. <label class="block font-semibold text-slate-300 mb-1">To Ports</label>
  3362. <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">
  3363. </div>
  3364. </div>
  3365. </div>
  3366. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3367. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Properties</span>
  3368. <div class="grid grid-cols-2 gap-3">
  3369. <div>
  3370. <label class="block font-semibold text-slate-300 mb-1">Protocol</label>
  3371. <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">
  3372. <option value="all">all</option>
  3373. <option value="tcp">tcp</option>
  3374. <option value="udp">udp</option>
  3375. <option value="icmp">icmp</option>
  3376. </select>
  3377. </div>
  3378. <div>
  3379. <label class="block font-semibold text-slate-300 mb-1">Dst. Port(s)</label>
  3380. <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">
  3381. </div>
  3382. </div>
  3383. <div class="grid grid-cols-2 gap-3">
  3384. <div>
  3385. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  3386. <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">
  3387. </div>
  3388. <div>
  3389. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  3390. <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">
  3391. </div>
  3392. </div>
  3393. <div class="grid grid-cols-2 gap-3">
  3394. <div>
  3395. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  3396. <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>
  3397. </div>
  3398. <div>
  3399. <label class="block font-semibold text-slate-300 mb-1">Out. Interface</label>
  3400. <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>
  3401. </div>
  3402. </div>
  3403. <div class="grid grid-cols-2 gap-3">
  3404. <div>
  3405. <div class="flex items-center justify-between mb-1">
  3406. <label class="font-semibold text-slate-300">Src. Address List</label>
  3407. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3408. <input type="checkbox" id="nat-modal-srclist-inv" class="rounded bg-slate-800 border-slate-700">
  3409. <span>! Invert</span>
  3410. </label>
  3411. </div>
  3412. <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>
  3413. </div>
  3414. <div>
  3415. <div class="flex items-center justify-between mb-1">
  3416. <label class="font-semibold text-slate-300">Dst. Address List</label>
  3417. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3418. <input type="checkbox" id="nat-modal-dstlist-inv" class="rounded bg-slate-800 border-slate-700">
  3419. <span>! Invert</span>
  3420. </label>
  3421. </div>
  3422. <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>
  3423. </div>
  3424. </div>
  3425. <div class="grid grid-cols-2 gap-3">
  3426. <div>
  3427. <div class="flex items-center justify-between mb-1">
  3428. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Source GEO IP List</span></label>
  3429. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3430. <input type="checkbox" id="nat-modal-srcgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3431. <span>! Invert</span>
  3432. </label>
  3433. </div>
  3434. <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">
  3435. <option value="">(None)</option>
  3436. </select>
  3437. </div>
  3438. <div>
  3439. <div class="flex items-center justify-between mb-1">
  3440. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Destination GEO IP List</span></label>
  3441. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3442. <input type="checkbox" id="nat-modal-dstgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3443. <span>! Invert</span>
  3444. </label>
  3445. </div>
  3446. <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">
  3447. <option value="">(None)</option>
  3448. </select>
  3449. </div>
  3450. </div>
  3451. </div>
  3452. <div>
  3453. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  3454. <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">
  3455. </div>
  3456. <div class="pt-2">
  3457. <label class="flex items-center space-x-2 cursor-pointer">
  3458. <input type="checkbox" id="nat-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3459. <span class="font-medium text-slate-300">Disabled (X)</span>
  3460. </label>
  3461. </div>
  3462. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3463. <button type="button" onclick="closeNATModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3464. <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>
  3465. </div>
  3466. </form>
  3467. </div>
  3468. </div>
  3469. <!-- ================= MODAL: FIREWALL MANGLE RULE ================= -->
  3470. <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">
  3471. <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">
  3472. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3473. <h3 id="mangle-modal-title" class="text-sm font-bold text-white">Add Mangle Rule</h3>
  3474. <button onclick="closeMangleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3475. </div>
  3476. <form onsubmit="submitSaveMangleRule(event)" class="p-6 space-y-4 overflow-y-auto flex-1 text-xs">
  3477. <input type="hidden" id="mangle-modal-id">
  3478. <div class="grid grid-cols-2 gap-4">
  3479. <div>
  3480. <label class="block font-semibold text-slate-300 mb-1">Chain *</label>
  3481. <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">
  3482. <option value="prerouting" selected>prerouting (Policy Routing / Marks)</option>
  3483. <option value="forward">forward</option>
  3484. <option value="postrouting">postrouting</option>
  3485. <option value="input">input</option>
  3486. <option value="output">output</option>
  3487. </select>
  3488. </div>
  3489. <div>
  3490. <label class="block font-semibold text-slate-300 mb-1">Action *</label>
  3491. <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">
  3492. <option value="mark-connection" selected>mark-connection</option>
  3493. <option value="mark-routing">mark-routing (Policy Routing)</option>
  3494. <option value="mark-packet">mark-packet (QoS / Queues)</option>
  3495. <option value="change-mss">change-mss (TCP MSS Clamp)</option>
  3496. <option value="set-dscp">set-dscp</option>
  3497. <option value="accept">accept</option>
  3498. </select>
  3499. </div>
  3500. </div>
  3501. <div id="mangle-target-box" class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3502. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Mark Target & Passthrough</span>
  3503. <div class="grid grid-cols-2 gap-3">
  3504. <div id="mangle-field-newmark">
  3505. <label class="block font-semibold text-slate-300 mb-1">New Mark Name</label>
  3506. <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">
  3507. </div>
  3508. <div class="flex items-center pt-5">
  3509. <label class="flex items-center space-x-2 cursor-pointer">
  3510. <input type="checkbox" id="mangle-modal-passthrough" checked class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3511. <span class="font-medium text-slate-300">Passthrough</span>
  3512. </label>
  3513. </div>
  3514. </div>
  3515. </div>
  3516. <div class="p-3 bg-slate-950/60 border border-slate-800/80 rounded-xl space-y-3">
  3517. <span class="block font-bold text-slate-400 uppercase tracking-wider text-[10px]">Match Criteria</span>
  3518. <div class="grid grid-cols-2 gap-3">
  3519. <div>
  3520. <label class="block font-semibold text-slate-300 mb-1">Src. Address / CIDR</label>
  3521. <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">
  3522. </div>
  3523. <div>
  3524. <label class="block font-semibold text-slate-300 mb-1">Dst. Address / CIDR</label>
  3525. <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">
  3526. </div>
  3527. </div>
  3528. <div class="grid grid-cols-2 gap-3">
  3529. <div>
  3530. <label class="block font-semibold text-slate-300 mb-1">Connection Mark</label>
  3531. <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">
  3532. </div>
  3533. <div>
  3534. <label class="block font-semibold text-slate-300 mb-1">In. Interface</label>
  3535. <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>
  3536. </div>
  3537. </div>
  3538. <div class="grid grid-cols-2 gap-3">
  3539. <div>
  3540. <div class="flex items-center justify-between mb-1">
  3541. <label class="font-semibold text-slate-300">Src. Address List</label>
  3542. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3543. <input type="checkbox" id="mangle-modal-srclist-inv" class="rounded bg-slate-800 border-slate-700">
  3544. <span>! Invert</span>
  3545. </label>
  3546. </div>
  3547. <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>
  3548. </div>
  3549. <div>
  3550. <div class="flex items-center justify-between mb-1">
  3551. <label class="font-semibold text-slate-300">Dst. Address List</label>
  3552. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3553. <input type="checkbox" id="mangle-modal-dstlist-inv" class="rounded bg-slate-800 border-slate-700">
  3554. <span>! Invert</span>
  3555. </label>
  3556. </div>
  3557. <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>
  3558. </div>
  3559. </div>
  3560. <div class="grid grid-cols-2 gap-3">
  3561. <div>
  3562. <div class="flex items-center justify-between mb-1">
  3563. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Source GEO IP List</span></label>
  3564. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3565. <input type="checkbox" id="mangle-modal-srcgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3566. <span>! Invert</span>
  3567. </label>
  3568. </div>
  3569. <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">
  3570. <option value="">(None)</option>
  3571. </select>
  3572. </div>
  3573. <div>
  3574. <div class="flex items-center justify-between mb-1">
  3575. <label class="font-semibold text-emerald-400 flex items-center gap-1"><span>🌍</span> <span>Destination GEO IP List</span></label>
  3576. <label class="flex items-center space-x-1 cursor-pointer text-[10px] text-amber-400 font-mono">
  3577. <input type="checkbox" id="mangle-modal-dstgeoip-inv" class="rounded bg-slate-800 border-slate-700">
  3578. <span>! Invert</span>
  3579. </label>
  3580. </div>
  3581. <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">
  3582. <option value="">(None)</option>
  3583. </select>
  3584. </div>
  3585. </div>
  3586. </div>
  3587. <div>
  3588. <label class="block font-semibold text-slate-300 mb-1">Comment</label>
  3589. <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">
  3590. </div>
  3591. <div class="pt-2">
  3592. <label class="flex items-center space-x-2 cursor-pointer">
  3593. <input type="checkbox" id="mangle-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3594. <span class="font-medium text-slate-300">Disabled (X)</span>
  3595. </label>
  3596. </div>
  3597. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3598. <button type="button" onclick="closeMangleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3599. <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>
  3600. </div>
  3601. </form>
  3602. </div>
  3603. </div>
  3604. <!-- ================= MODAL: ADDRESS LIST ENTRY ================= -->
  3605. <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">
  3606. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  3607. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3608. <h3 id="addrlist-modal-title" class="text-sm font-bold text-white">Add Address List Entry</h3>
  3609. <button onclick="closeAddrListModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3610. </div>
  3611. <form onsubmit="submitSaveAddrList(event)" class="p-6 space-y-4 text-xs">
  3612. <input type="hidden" id="addrlist-modal-id">
  3613. <div>
  3614. <label class="block font-semibold text-slate-300 mb-1.5">List Name *</label>
  3615. <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">
  3616. </div>
  3617. <div>
  3618. <label class="block font-semibold text-slate-300 mb-1.5">IP Address / Subnet (CIDR) *</label>
  3619. <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">
  3620. </div>
  3621. <div>
  3622. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3623. <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">
  3624. </div>
  3625. <div class="pt-2">
  3626. <label class="flex items-center space-x-2 cursor-pointer">
  3627. <input type="checkbox" id="addrlist-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3628. <span class="font-medium text-slate-300">Disabled (X)</span>
  3629. </label>
  3630. </div>
  3631. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3632. <button type="button" onclick="closeAddrListModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3633. <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>
  3634. </div>
  3635. </form>
  3636. </div>
  3637. </div>
  3638. <!-- ================= MODAL: GEO INTERVAL SETTINGS ================= -->
  3639. <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">
  3640. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  3641. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3642. <h3 class="text-sm font-bold text-white">Geo-Location Auto-Update Settings</h3>
  3643. <button onclick="closeGeoIntervalModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3644. </div>
  3645. <form onsubmit="submitGeoIntervalSettings(event)" class="p-6 space-y-4 text-xs">
  3646. <div class="p-3 bg-slate-950/60 border border-slate-800 rounded-xl space-y-2">
  3647. <label class="flex items-center space-x-2.5 cursor-pointer">
  3648. <input type="checkbox" id="geo-cfg-autoupdate" checked class="rounded bg-slate-800 border-slate-700 text-emerald-500">
  3649. <span class="font-semibold text-white">Enable Automatic Background Updates</span>
  3650. </label>
  3651. <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>
  3652. </div>
  3653. <div>
  3654. <label class="block font-semibold text-slate-300 mb-1.5">Update Interval *</label>
  3655. <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">
  3656. <option value="12">Every 12 Hours</option>
  3657. <option value="24" selected>Every 24 Hours (Daily - Recommended)</option>
  3658. <option value="48">Every 48 Hours (2 Days)</option>
  3659. <option value="72">Every 3 Days</option>
  3660. <option value="168">Every 7 Days (Weekly)</option>
  3661. <option value="720">Every 30 Days (Monthly)</option>
  3662. <option value="custom">Custom Hours...</option>
  3663. </select>
  3664. </div>
  3665. <div id="geo-cfg-custom-box" class="hidden">
  3666. <label class="block font-semibold text-slate-300 mb-1.5">Custom Interval (Hours)</label>
  3667. <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">
  3668. </div>
  3669. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3670. <button type="button" onclick="closeGeoIntervalModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3671. <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>
  3672. </div>
  3673. </form>
  3674. </div>
  3675. </div>
  3676. <!-- ================= MODAL: GEO SUBNETS PREVIEW ================= -->
  3677. <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">
  3678. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3679. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3680. <div>
  3681. <h3 id="geo-subnets-title" class="text-sm font-bold text-white">Country Subnets</h3>
  3682. <span id="geo-subnets-subtitle" class="text-[11px] font-mono text-slate-400">CIDR Blocks</span>
  3683. </div>
  3684. <button onclick="closeGeoSubnetsModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3685. </div>
  3686. <div class="p-6 space-y-3 text-xs">
  3687. <p class="text-slate-400">Showing first 100 subnets in this country zone:</p>
  3688. <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>
  3689. <div class="pt-3 border-t border-slate-800 flex justify-end">
  3690. <button type="button" onclick="closeGeoSubnetsModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Close</button>
  3691. </div>
  3692. </div>
  3693. </div>
  3694. </div>
  3695. <!-- ================= MODAL: ADD / EDIT ROUTE ================= -->
  3696. <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">
  3697. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3698. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3699. <h3 id="route-modal-title" class="text-sm font-bold text-white">Add Static Route</h3>
  3700. <button onclick="closeRouteModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3701. </div>
  3702. <form onsubmit="submitSaveRoute(event)" class="p-6 space-y-4 text-xs">
  3703. <input type="hidden" id="route-modal-id">
  3704. <input type="hidden" id="route-modal-old-dst">
  3705. <input type="hidden" id="route-modal-old-gw">
  3706. <input type="hidden" id="route-modal-old-distance">
  3707. <input type="hidden" id="route-modal-old-table">
  3708. <input type="hidden" id="route-modal-old-iface">
  3709. <div>
  3710. <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR) *</label>
  3711. <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">
  3712. </div>
  3713. <div class="grid grid-cols-2 gap-4">
  3714. <div>
  3715. <label class="block font-semibold text-slate-300 mb-1.5">Gateway (IP or Interface)</label>
  3716. <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">
  3717. </div>
  3718. <div>
  3719. <label class="block font-semibold text-slate-300 mb-1.5">Routing Table / Mark</label>
  3720. <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">
  3721. <option value="main" selected>main</option>
  3722. </select>
  3723. </div>
  3724. </div>
  3725. <div class="grid grid-cols-2 gap-4">
  3726. <div>
  3727. <label class="block font-semibold text-slate-300 mb-1.5">Distance (Metric)</label>
  3728. <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">
  3729. </div>
  3730. <div>
  3731. <label class="block font-semibold text-slate-300 mb-1.5">Interface (Optional)</label>
  3732. <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>
  3733. </div>
  3734. </div>
  3735. <div>
  3736. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3737. <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">
  3738. </div>
  3739. <div class="pt-2">
  3740. <label class="flex items-center space-x-2 cursor-pointer">
  3741. <input type="checkbox" id="route-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  3742. <span class="font-medium text-slate-300">Disabled (X)</span>
  3743. </label>
  3744. </div>
  3745. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3746. <button type="button" onclick="closeRouteModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3747. <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>
  3748. </div>
  3749. </form>
  3750. </div>
  3751. </div>
  3752. <!-- ================= MODAL: ADD POLICY ROUTING RULE ================= -->
  3753. <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">
  3754. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3755. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3756. <h3 id="prule-modal-title" class="text-sm font-bold text-white">Add Policy Routing Rule (/ip route rule)</h3>
  3757. <button onclick="closePolicyRuleModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3758. </div>
  3759. <form onsubmit="submitSavePolicyRule(event)" class="p-6 space-y-4 text-xs">
  3760. <input type="hidden" id="prule-modal-id">
  3761. <div class="grid grid-cols-2 gap-4">
  3762. <div>
  3763. <label class="block font-semibold text-slate-300 mb-1.5">Priority / Preference</label>
  3764. <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">
  3765. </div>
  3766. <div>
  3767. <label class="block font-semibold text-slate-300 mb-1.5">Routing Mark (fwmark)</label>
  3768. <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">
  3769. </div>
  3770. </div>
  3771. <div class="grid grid-cols-2 gap-4">
  3772. <div>
  3773. <label class="block font-semibold text-slate-300 mb-1.5">Src. Address (CIDR)</label>
  3774. <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">
  3775. </div>
  3776. <div>
  3777. <label class="block font-semibold text-slate-300 mb-1.5">Dst. Address (CIDR)</label>
  3778. <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">
  3779. </div>
  3780. </div>
  3781. <div class="grid grid-cols-2 gap-4">
  3782. <div>
  3783. <label class="block font-semibold text-slate-300 mb-1.5">Lookup Table *</label>
  3784. <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>
  3785. </div>
  3786. <div>
  3787. <label class="block font-semibold text-slate-300 mb-1.5">Action</label>
  3788. <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">
  3789. <option value="lookup" selected>lookup (standard)</option>
  3790. <option value="unreachable">unreachable</option>
  3791. <option value="blackhole">blackhole</option>
  3792. </select>
  3793. </div>
  3794. </div>
  3795. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3796. <button type="button" onclick="closePolicyRuleModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3797. <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>
  3798. </div>
  3799. </form>
  3800. </div>
  3801. </div>
  3802. <!-- ================= MODAL: CREATE ROUTING TABLE ================= -->
  3803. <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">
  3804. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  3805. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3806. <h3 class="text-sm font-bold text-white">Create New Routing Table</h3>
  3807. <button onclick="closeTableModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3808. </div>
  3809. <form onsubmit="submitSaveTable(event)" class="p-6 space-y-4 text-xs">
  3810. <div>
  3811. <label class="block font-semibold text-slate-300 mb-1.5">Table Name *</label>
  3812. <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">
  3813. </div>
  3814. <div>
  3815. <label class="block font-semibold text-slate-300 mb-1.5">FIB Table ID (Optional)</label>
  3816. <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">
  3817. </div>
  3818. <div>
  3819. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3820. <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">
  3821. </div>
  3822. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3823. <button type="button" onclick="closeTableModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3824. <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>
  3825. </div>
  3826. </form>
  3827. </div>
  3828. </div>
  3829. <!-- ================= MODAL: ADD/EDIT EoIP TUNNEL ================= -->
  3830. <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">
  3831. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3832. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3833. <div>
  3834. <h3 id="eoip-modal-title" class="text-sm font-bold text-white">Add EoIP Tunnel</h3>
  3835. <p class="text-[11px] text-slate-400">MikroTik RouterOS Layer 2 GRETAP Tunnel</p>
  3836. </div>
  3837. <button onclick="closeEoIPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3838. </div>
  3839. <form onsubmit="submitSaveEoIP(event)" class="p-6 space-y-4 text-xs font-sans">
  3840. <input type="hidden" id="eoip-modal-id">
  3841. <div class="grid grid-cols-2 gap-4">
  3842. <div>
  3843. <label class="block font-semibold text-slate-300 mb-1.5">Interface Name *</label>
  3844. <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">
  3845. </div>
  3846. <div>
  3847. <label class="block font-semibold text-slate-300 mb-1.5">Tunnel ID (1 - 65535) *</label>
  3848. <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">
  3849. </div>
  3850. </div>
  3851. <div class="grid grid-cols-2 gap-4">
  3852. <div>
  3853. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (Remote Router IP) *</label>
  3854. <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">
  3855. <span class="text-[10px] text-slate-400">Underlay IP of the remote MikroTik router</span>
  3856. </div>
  3857. <div>
  3858. <label class="block font-semibold text-slate-300 mb-1.5">Tunnel IP / Subnet (CIDR)</label>
  3859. <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">
  3860. <span class="text-[10px] text-slate-400">Overlay IPv4 assigned directly to tunnel (/30, /24)</span>
  3861. </div>
  3862. </div>
  3863. <div class="grid grid-cols-2 gap-4">
  3864. <div>
  3865. <label class="block font-semibold text-slate-300 mb-1.5">Underlay Local IP (GRE Source)</label>
  3866. <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">
  3867. <span class="text-[10px] text-slate-400">Local router IP for outer GRE packets</span>
  3868. </div>
  3869. <div>
  3870. <label class="block font-semibold text-slate-300 mb-1.5">MAC Address (Auto if empty)</label>
  3871. <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">
  3872. </div>
  3873. </div>
  3874. <div class="grid grid-cols-2 gap-4">
  3875. <div>
  3876. <label class="block font-semibold text-slate-300 mb-1.5">MTU</label>
  3877. <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">
  3878. </div>
  3879. <div>
  3880. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3881. <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">
  3882. </div>
  3883. </div>
  3884. <div class="flex items-center justify-between pt-1">
  3885. <label class="flex items-center space-x-2 text-slate-300">
  3886. <input type="checkbox" id="eoip-modal-clampmss" checked class="rounded bg-slate-800 border-slate-700 text-emerald-600">
  3887. <span>Clamp TCP MSS (PMTUD protection)</span>
  3888. </label>
  3889. <label class="flex items-center space-x-2 text-slate-300">
  3890. <input type="checkbox" id="eoip-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-600">
  3891. <span>Disabled</span>
  3892. </label>
  3893. </div>
  3894. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3895. <button type="button" onclick="closeEoIPModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3896. <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>
  3897. </div>
  3898. </form>
  3899. </div>
  3900. </div>
  3901. <!-- ================= MODAL: ADD/EDIT PPP SECRET (USER) ================= -->
  3902. <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">
  3903. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3904. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3905. <div>
  3906. <h3 id="secret-modal-title" class="text-sm font-bold text-white">Add PPP Secret</h3>
  3907. <p class="text-[11px] text-slate-400">User account for PPPoE, PPTP, and L2TP authentication</p>
  3908. </div>
  3909. <button onclick="closePPPSecretModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3910. </div>
  3911. <form onsubmit="submitSavePPPSecret(event)" class="p-6 space-y-4 text-xs font-sans">
  3912. <input type="hidden" id="secret-modal-id">
  3913. <div class="grid grid-cols-2 gap-4">
  3914. <div>
  3915. <label class="block font-semibold text-slate-300 mb-1.5">Username (Name) *</label>
  3916. <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">
  3917. </div>
  3918. <div>
  3919. <label class="block font-semibold text-slate-300 mb-1.5">Password *</label>
  3920. <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">
  3921. </div>
  3922. </div>
  3923. <div class="grid grid-cols-2 gap-4">
  3924. <div>
  3925. <label class="block font-semibold text-slate-300 mb-1.5">Service</label>
  3926. <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">
  3927. <option value="any">any</option>
  3928. <option value="pppoe">pppoe</option>
  3929. <option value="pptp">pptp</option>
  3930. <option value="l2tp">l2tp</option>
  3931. </select>
  3932. </div>
  3933. <div>
  3934. <label class="block font-semibold text-slate-300 mb-1.5">Profile</label>
  3935. <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>
  3936. </div>
  3937. </div>
  3938. <div class="grid grid-cols-2 gap-4">
  3939. <div>
  3940. <label class="block font-semibold text-slate-300 mb-1.5">Local Address (Optional)</label>
  3941. <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">
  3942. </div>
  3943. <div>
  3944. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (Optional Static IP)</label>
  3945. <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">
  3946. </div>
  3947. </div>
  3948. <div>
  3949. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  3950. <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">
  3951. </div>
  3952. <div class="flex items-center space-x-2 pt-1">
  3953. <input type="checkbox" id="secret-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-600">
  3954. <label for="secret-modal-disabled" class="text-slate-300">Disabled</label>
  3955. </div>
  3956. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  3957. <button type="button" onclick="closePPPSecretModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  3958. <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>
  3959. </div>
  3960. </form>
  3961. </div>
  3962. </div>
  3963. <!-- ================= MODAL: ADD/EDIT PPP PROFILE ================= -->
  3964. <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">
  3965. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  3966. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  3967. <div>
  3968. <h3 id="profile-modal-title" class="text-sm font-bold text-white">Add PPP Profile</h3>
  3969. <p class="text-[11px] text-slate-400">IP pool and encryption settings for PPP servers</p>
  3970. </div>
  3971. <button onclick="closePPPProfileModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  3972. </div>
  3973. <form onsubmit="submitSavePPPProfile(event)" class="p-6 space-y-4 text-xs font-sans">
  3974. <input type="hidden" id="profile-modal-id">
  3975. <div>
  3976. <label class="block font-semibold text-slate-300 mb-1.5">Profile Name *</label>
  3977. <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">
  3978. </div>
  3979. <div class="grid grid-cols-2 gap-4">
  3980. <div>
  3981. <label class="block font-semibold text-slate-300 mb-1.5">Local Address *</label>
  3982. <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">
  3983. </div>
  3984. <div>
  3985. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (Pool) *</label>
  3986. <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">
  3987. </div>
  3988. </div>
  3989. <div class="grid grid-cols-2 gap-4">
  3990. <div>
  3991. <label class="block font-semibold text-slate-300 mb-1.5">DNS Servers</label>
  3992. <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">
  3993. </div>
  3994. <div>
  3995. <label class="block font-semibold text-slate-300 mb-1.5">Use Encryption</label>
  3996. <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">
  3997. <option value="no">no</option>
  3998. <option value="yes">yes</option>
  3999. <option value="required" selected>required (MPPE-128)</option>
  4000. </select>
  4001. </div>
  4002. </div>
  4003. <div>
  4004. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4005. <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">
  4006. </div>
  4007. <div class="flex items-center space-x-2 pt-1">
  4008. <input type="checkbox" id="profile-modal-onlyone" checked class="rounded bg-slate-800 border-slate-700 text-violet-600">
  4009. <label for="profile-modal-onlyone" class="text-slate-300">Only One session per user account</label>
  4010. </div>
  4011. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4012. <button type="button" onclick="closePPPProfileModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4013. <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>
  4014. </div>
  4015. </form>
  4016. </div>
  4017. </div>
  4018. <!-- ================= MODAL: IPSEC ROADWARRIOR SERVER ================= -->
  4019. <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">
  4020. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4021. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4022. <div>
  4023. <h3 class="text-sm font-bold text-white">IPSec (IKEv2) Roadwarrior Server</h3>
  4024. <p class="text-[11px] text-slate-400">Mobile VPN server for Windows, macOS, iOS, Android clients</p>
  4025. </div>
  4026. <button onclick="closeIPSecServerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4027. </div>
  4028. <form onsubmit="submitSaveIPSecServer(event)" class="p-6 space-y-4 text-xs font-sans">
  4029. <div class="flex items-center justify-between border-b border-slate-800 pb-3">
  4030. <span class="text-slate-300 font-semibold">Server State</span>
  4031. <div class="flex items-center gap-3">
  4032. <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>
  4033. <label class="relative inline-flex items-center cursor-pointer">
  4034. <input type="checkbox" id="modal-ipsec-server-enabled" class="sr-only peer">
  4035. <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>
  4036. </label>
  4037. </div>
  4038. </div>
  4039. <div>
  4040. <label class="block font-semibold text-slate-300 mb-1.5">Pre-Shared Key (PSK) *</label>
  4041. <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">
  4042. </div>
  4043. <div class="grid grid-cols-2 gap-4">
  4044. <div>
  4045. <label class="block font-semibold text-slate-300 mb-1.5">Virtual IP Pool (CIDR) *</label>
  4046. <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">
  4047. </div>
  4048. <div>
  4049. <label class="block font-semibold text-slate-300 mb-1.5">DNS Servers</label>
  4050. <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">
  4051. </div>
  4052. </div>
  4053. <div>
  4054. <label class="block font-semibold text-slate-300 mb-1.5">Local Traffic Selector (Subnet)</label>
  4055. <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">
  4056. </div>
  4057. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4058. <button type="button" onclick="closeIPSecServerModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4059. <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>
  4060. </div>
  4061. </form>
  4062. </div>
  4063. </div>
  4064. <!-- ================= MODAL: WIREGUARD CLIENT CONFIG VIEWER ================= -->
  4065. <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">
  4066. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4067. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4068. <div>
  4069. <h3 class="text-sm font-bold text-white">WireGuard Client Configuration</h3>
  4070. <p class="text-[11px] text-slate-400">Import this .conf into WireGuard on iOS, Android, macOS or Windows</p>
  4071. </div>
  4072. <button onclick="closeWGClientConfModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4073. </div>
  4074. <div class="p-6 space-y-4">
  4075. <div>
  4076. <label class="block text-xs font-semibold text-slate-300 mb-1.5">WireGuard Client Profile (.conf)</label>
  4077. <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>
  4078. </div>
  4079. <div class="flex justify-between items-center pt-2">
  4080. <span class="text-[11px] text-slate-500">Ready for instant import</span>
  4081. <div class="space-x-2">
  4082. <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">
  4083. Copy Config
  4084. </button>
  4085. <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">
  4086. Download .conf
  4087. </button>
  4088. </div>
  4089. </div>
  4090. </div>
  4091. </div>
  4092. </div>
  4093. <!-- ================= MODAL: BGP INSTANCE SETTINGS ================= -->
  4094. <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">
  4095. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4096. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4097. <div>
  4098. <h3 class="text-sm font-bold text-white">BGP Instance Settings (/routing bgp instance)</h3>
  4099. <p class="text-[11px] text-slate-400">Configure global Autonomous System and route redistribution</p>
  4100. </div>
  4101. <button onclick="closeBgpInstanceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4102. </div>
  4103. <form id="bgp-instance-form" onsubmit="submitBgpInstance(event)" class="p-6 space-y-4 text-xs">
  4104. <div class="flex items-center justify-between p-3 rounded-xl bg-slate-800/60 border border-slate-700/60">
  4105. <div>
  4106. <div class="font-semibold text-white">Enable BGP Routing</div>
  4107. <div class="text-[11px] text-slate-400">Run FRRouting bgpd service for dynamic exterior gateway routing</div>
  4108. </div>
  4109. <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">
  4110. </div>
  4111. <div class="grid grid-cols-2 gap-4">
  4112. <div>
  4113. <label class="block font-semibold text-slate-300 mb-1.5">Autonomous System (AS) *</label>
  4114. <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">
  4115. </div>
  4116. <div>
  4117. <label class="block font-semibold text-slate-300 mb-1.5">Router ID</label>
  4118. <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">
  4119. </div>
  4120. </div>
  4121. <div class="grid grid-cols-2 gap-4">
  4122. <div>
  4123. <label class="block font-semibold text-slate-300 mb-1.5">Keepalive Time (s)</label>
  4124. <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">
  4125. </div>
  4126. <div>
  4127. <label class="block font-semibold text-slate-300 mb-1.5">Hold Time (s)</label>
  4128. <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">
  4129. </div>
  4130. </div>
  4131. <div class="border-t border-slate-800 pt-3">
  4132. <label class="block font-semibold text-slate-300 mb-2">Redistribute Routes into BGP</label>
  4133. <div class="space-y-2">
  4134. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4135. <input type="checkbox" id="modal-bgp-redist-conn" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4136. <span>Redistribute Connected Subnets</span>
  4137. </label>
  4138. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4139. <input type="checkbox" id="modal-bgp-redist-static" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4140. <span>Redistribute Static Routes</span>
  4141. </label>
  4142. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4143. <input type="checkbox" id="modal-bgp-redist-ospf" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4144. <span>Redistribute OSPF Routes</span>
  4145. </label>
  4146. </div>
  4147. </div>
  4148. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4149. <button type="button" onclick="closeBgpInstanceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4150. <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>
  4151. </div>
  4152. </form>
  4153. </div>
  4154. </div>
  4155. <!-- ================= MODAL: BGP PEER ================= -->
  4156. <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">
  4157. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4158. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4159. <div>
  4160. <h3 id="bgp-peer-modal-title" class="text-sm font-bold text-white">Add BGP Peer Connection</h3>
  4161. <p class="text-[11px] text-slate-400">Establish eBGP / iBGP session with remote router</p>
  4162. </div>
  4163. <button onclick="closeBgpPeerModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4164. </div>
  4165. <form id="bgp-peer-form" onsubmit="submitBgpPeer(event)" class="p-6 space-y-4 text-xs">
  4166. <input type="hidden" id="modal-bgp-peer-id">
  4167. <div>
  4168. <label class="block font-semibold text-slate-300 mb-1.5">Connection Name *</label>
  4169. <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">
  4170. </div>
  4171. <div class="grid grid-cols-2 gap-4">
  4172. <div>
  4173. <label class="block font-semibold text-slate-300 mb-1.5">Remote Address (IP) *</label>
  4174. <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">
  4175. </div>
  4176. <div>
  4177. <label class="block font-semibold text-slate-300 mb-1.5">Remote AS *</label>
  4178. <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">
  4179. </div>
  4180. </div>
  4181. <div class="grid grid-cols-2 gap-4">
  4182. <div>
  4183. <label class="block font-semibold text-slate-300 mb-1.5">Local Address (Update Source)</label>
  4184. <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">
  4185. </div>
  4186. <div>
  4187. <label class="block font-semibold text-slate-300 mb-1.5">MD5 Password (BGP Auth)</label>
  4188. <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">
  4189. </div>
  4190. </div>
  4191. <div class="grid grid-cols-2 gap-4">
  4192. <div>
  4193. <label class="block font-semibold text-slate-300 mb-1.5">In Filter (Routing Filter Chain)</label>
  4194. <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">
  4195. <p class="text-[10px] text-slate-500 mt-0.5">Filter chain for inbound routes from peer</p>
  4196. </div>
  4197. <div>
  4198. <label class="block font-semibold text-slate-300 mb-1.5">Out Filter (Routing Filter Chain)</label>
  4199. <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">
  4200. <p class="text-[10px] text-slate-500 mt-0.5">Filter chain for outbound routes to peer</p>
  4201. </div>
  4202. </div>
  4203. <div class="grid grid-cols-2 gap-3 p-3 rounded-xl bg-slate-800/40 border border-slate-700/50">
  4204. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4205. <input type="checkbox" id="modal-bgp-peer-multihop" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4206. <span>eBGP Multi-hop</span>
  4207. </label>
  4208. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4209. <input type="checkbox" id="modal-bgp-peer-nexthop-self" checked class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4210. <span>Next-hop Self</span>
  4211. </label>
  4212. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4213. <input type="checkbox" id="modal-bgp-peer-passive" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4214. <span>Passive Mode</span>
  4215. </label>
  4216. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4217. <input type="checkbox" id="modal-bgp-peer-disabled" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4218. <span>Disabled (X)</span>
  4219. </label>
  4220. </div>
  4221. <div>
  4222. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4223. <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">
  4224. </div>
  4225. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4226. <button type="button" onclick="closeBgpPeerModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4227. <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>
  4228. </div>
  4229. </form>
  4230. </div>
  4231. </div>
  4232. <!-- ================= MODAL: BGP NETWORK ================= -->
  4233. <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">
  4234. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  4235. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4236. <h3 id="bgp-network-modal-title" class="text-sm font-bold text-white">Advertise BGP Network</h3>
  4237. <button onclick="closeBgpNetworkModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4238. </div>
  4239. <form id="bgp-network-form" onsubmit="submitBgpNetwork(event)" class="p-6 space-y-4 text-xs">
  4240. <input type="hidden" id="modal-bgp-net-id">
  4241. <div>
  4242. <label class="block font-semibold text-slate-300 mb-1.5">Network Prefix (CIDR) *</label>
  4243. <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">
  4244. </div>
  4245. <div>
  4246. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4247. <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">
  4248. </div>
  4249. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4250. <input type="checkbox" id="modal-bgp-net-disabled" class="rounded text-purple-600 bg-slate-800 border-slate-700">
  4251. <span>Disabled</span>
  4252. </label>
  4253. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4254. <button type="button" onclick="closeBgpNetworkModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4255. <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>
  4256. </div>
  4257. </form>
  4258. </div>
  4259. </div>
  4260. <!-- ================= MODAL: OSPF INSTANCE SETTINGS ================= -->
  4261. <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">
  4262. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4263. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4264. <div>
  4265. <h3 class="text-sm font-bold text-white">OSPF Instance Settings (/routing ospf instance)</h3>
  4266. <p class="text-[11px] text-slate-400">Configure OSPFv2 link-state routing daemon and redistributions</p>
  4267. </div>
  4268. <button onclick="closeOspfInstanceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4269. </div>
  4270. <form id="ospf-instance-form" onsubmit="submitOspfInstance(event)" class="p-6 space-y-4 text-xs">
  4271. <div class="flex items-center justify-between p-3 rounded-xl bg-slate-800/60 border border-slate-700/60">
  4272. <div>
  4273. <div class="font-semibold text-white">Enable OSPF Routing</div>
  4274. <div class="text-[11px] text-slate-400">Run FRRouting ospfd service for dynamic interior gateway routing</div>
  4275. </div>
  4276. <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">
  4277. </div>
  4278. <div class="grid grid-cols-2 gap-4">
  4279. <div>
  4280. <label class="block font-semibold text-slate-300 mb-1.5">Router ID</label>
  4281. <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">
  4282. </div>
  4283. <div>
  4284. <label class="block font-semibold text-slate-300 mb-1.5">Default Metric</label>
  4285. <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">
  4286. </div>
  4287. </div>
  4288. <div class="border-t border-slate-800 pt-3">
  4289. <label class="block font-semibold text-slate-300 mb-2">Redistribute Routes into OSPF</label>
  4290. <div class="space-y-2">
  4291. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4292. <input type="checkbox" id="modal-ospf-redist-conn" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4293. <span>Redistribute Connected Subnets</span>
  4294. </label>
  4295. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4296. <input type="checkbox" id="modal-ospf-redist-static" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4297. <span>Redistribute Static Routes</span>
  4298. </label>
  4299. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4300. <input type="checkbox" id="modal-ospf-redist-bgp" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4301. <span>Redistribute BGP Routes</span>
  4302. </label>
  4303. </div>
  4304. </div>
  4305. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4306. <button type="button" onclick="closeOspfInstanceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4307. <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>
  4308. </div>
  4309. </form>
  4310. </div>
  4311. </div>
  4312. <!-- ================= MODAL: OSPF AREA ================= -->
  4313. <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">
  4314. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  4315. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4316. <h3 id="ospf-area-modal-title" class="text-sm font-bold text-white">Add OSPF Area</h3>
  4317. <button onclick="closeOspfAreaModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4318. </div>
  4319. <form id="ospf-area-form" onsubmit="submitOspfArea(event)" class="p-6 space-y-4 text-xs">
  4320. <input type="hidden" id="modal-ospf-area-id">
  4321. <div>
  4322. <label class="block font-semibold text-slate-300 mb-1.5">Area Name *</label>
  4323. <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">
  4324. </div>
  4325. <div class="grid grid-cols-2 gap-4">
  4326. <div>
  4327. <label class="block font-semibold text-slate-300 mb-1.5">Area ID *</label>
  4328. <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">
  4329. </div>
  4330. <div>
  4331. <label class="block font-semibold text-slate-300 mb-1.5">Area Type</label>
  4332. <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">
  4333. <option value="default">Default / Normal</option>
  4334. <option value="stub">Stub</option>
  4335. <option value="nssa">NSSA</option>
  4336. </select>
  4337. </div>
  4338. </div>
  4339. <div>
  4340. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4341. <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">
  4342. </div>
  4343. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4344. <button type="button" onclick="closeOspfAreaModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4345. <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>
  4346. </div>
  4347. </form>
  4348. </div>
  4349. </div>
  4350. <!-- ================= MODAL: OSPF INTERFACE ================= -->
  4351. <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">
  4352. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4353. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4354. <div>
  4355. <h3 id="ospf-interface-modal-title" class="text-sm font-bold text-white">Add OSPF Interface</h3>
  4356. <p class="text-[11px] text-slate-400">Configure OSPF link parameters on a network subnet or interface</p>
  4357. </div>
  4358. <button onclick="closeOspfInterfaceModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4359. </div>
  4360. <form id="ospf-interface-form" onsubmit="submitOspfInterface(event)" class="p-6 space-y-4 text-xs">
  4361. <input type="hidden" id="modal-ospf-iface-id">
  4362. <div class="grid grid-cols-2 gap-4">
  4363. <div>
  4364. <label class="block font-semibold text-slate-300 mb-1.5">Subnet Network (CIDR) *</label>
  4365. <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">
  4366. </div>
  4367. <div>
  4368. <label class="block font-semibold text-slate-300 mb-1.5">OSPF Area *</label>
  4369. <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">
  4370. </div>
  4371. </div>
  4372. <div class="grid grid-cols-2 gap-4">
  4373. <div>
  4374. <label class="block font-semibold text-slate-300 mb-1.5">Interface (Optional Device)</label>
  4375. <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">
  4376. <option value="">Any matching interface</option>
  4377. </select>
  4378. </div>
  4379. <div>
  4380. <label class="block font-semibold text-slate-300 mb-1.5">Metric Cost</label>
  4381. <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">
  4382. </div>
  4383. </div>
  4384. <div class="grid grid-cols-3 gap-3">
  4385. <div>
  4386. <label class="block font-semibold text-slate-300 mb-1.5">Priority</label>
  4387. <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">
  4388. </div>
  4389. <div>
  4390. <label class="block font-semibold text-slate-300 mb-1.5">Hello (s)</label>
  4391. <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">
  4392. </div>
  4393. <div>
  4394. <label class="block font-semibold text-slate-300 mb-1.5">Dead (s)</label>
  4395. <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">
  4396. </div>
  4397. </div>
  4398. <div class="grid grid-cols-2 gap-4">
  4399. <div>
  4400. <label class="block font-semibold text-slate-300 mb-1.5">Authentication Type</label>
  4401. <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">
  4402. <option value="none">None</option>
  4403. <option value="simple">Simple Password</option>
  4404. <option value="md5">MD5 Cryptographic</option>
  4405. </select>
  4406. </div>
  4407. <div>
  4408. <label class="block font-semibold text-slate-300 mb-1.5">Auth Secret Key</label>
  4409. <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">
  4410. </div>
  4411. </div>
  4412. <div class="grid grid-cols-2 gap-3 p-3 rounded-xl bg-slate-800/40 border border-slate-700/50">
  4413. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4414. <input type="checkbox" id="modal-ospf-iface-passive" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4415. <span>Passive (Do not form adjs)</span>
  4416. </label>
  4417. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4418. <input type="checkbox" id="modal-ospf-iface-disabled" class="rounded text-indigo-600 bg-slate-800 border-slate-700">
  4419. <span>Disabled (X)</span>
  4420. </label>
  4421. </div>
  4422. <div>
  4423. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4424. <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">
  4425. </div>
  4426. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4427. <button type="button" onclick="closeOspfInterfaceModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4428. <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>
  4429. </div>
  4430. </form>
  4431. </div>
  4432. </div>
  4433. <!-- ================= MODAL: ADD / EDIT ROUTING FILTER ================= -->
  4434. <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">
  4435. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-xl shadow-2xl overflow-hidden animate-in">
  4436. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4437. <div>
  4438. <h3 id="modal-rf-title" class="text-sm font-bold text-white">Add Routing Filter Rule</h3>
  4439. <p class="text-[11px] text-slate-400">Match routing prefixes, AS-Path, communities, and set BGP attributes (/routing filter)</p>
  4440. </div>
  4441. <button onclick="closeRoutingFilterModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4442. </div>
  4443. <form id="routing-filter-form" onsubmit="submitRoutingFilter(event)" class="p-6 space-y-4 text-xs max-h-[85vh] overflow-y-auto">
  4444. <input type="hidden" id="modal-rf-id">
  4445. <div class="grid grid-cols-3 gap-3">
  4446. <div class="col-span-1">
  4447. <label class="block font-semibold text-slate-300 mb-1.5">Chain Name *</label>
  4448. <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">
  4449. <p class="text-[10px] text-slate-500 mt-0.5">e.g. bgp-in, bgp-out</p>
  4450. </div>
  4451. <div>
  4452. <label class="block font-semibold text-slate-300 mb-1.5">Rule Order *</label>
  4453. <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">
  4454. <p class="text-[10px] text-slate-500 mt-0.5">Sequence (10, 20...)</p>
  4455. </div>
  4456. <div>
  4457. <label class="block font-semibold text-slate-300 mb-1.5">Action *</label>
  4458. <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">
  4459. <option value="accept">accept (Permit)</option>
  4460. <option value="discard">discard (Deny)</option>
  4461. <option value="reject">reject (Deny)</option>
  4462. <option value="passthrough">passthrough (Continue)</option>
  4463. </select>
  4464. <p class="text-[10px] text-slate-500 mt-0.5">Filter action</p>
  4465. </div>
  4466. </div>
  4467. <!-- Match Criteria Box -->
  4468. <div class="p-3.5 rounded-xl bg-slate-800/40 border border-slate-700/50 space-y-3">
  4469. <div class="text-[11px] font-bold text-cyan-400 uppercase tracking-wider">Match Conditions</div>
  4470. <div class="grid grid-cols-2 gap-3">
  4471. <div>
  4472. <label class="block font-medium text-slate-300 mb-1">Prefix (CIDR)</label>
  4473. <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">
  4474. <p class="text-[10px] text-slate-500 mt-0.5">Leave blank to match all prefixes</p>
  4475. </div>
  4476. <div>
  4477. <label class="block font-medium text-slate-300 mb-1">Prefix Length (Range)</label>
  4478. <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">
  4479. <p class="text-[10px] text-slate-500 mt-0.5">Optional subnet mask length filter</p>
  4480. </div>
  4481. </div>
  4482. <div class="grid grid-cols-3 gap-3">
  4483. <div>
  4484. <label class="block font-medium text-slate-300 mb-1">Match Protocol</label>
  4485. <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">
  4486. <option value="any">Any Protocol</option>
  4487. <option value="bgp">BGP</option>
  4488. <option value="ospf">OSPF</option>
  4489. <option value="connected">Connected</option>
  4490. <option value="static">Static</option>
  4491. </select>
  4492. </div>
  4493. <div>
  4494. <label class="block font-medium text-slate-300 mb-1">Match AS-Path (Regex)</label>
  4495. <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">
  4496. </div>
  4497. <div>
  4498. <label class="block font-medium text-slate-300 mb-1">Match Community</label>
  4499. <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">
  4500. </div>
  4501. </div>
  4502. </div>
  4503. <!-- Set Attributes Box (Modifications) -->
  4504. <div class="p-3.5 rounded-xl bg-slate-800/40 border border-slate-700/50 space-y-3">
  4505. <div class="text-[11px] font-bold text-purple-400 uppercase tracking-wider">Set Modifications (On Accept)</div>
  4506. <div class="grid grid-cols-3 gap-3">
  4507. <div>
  4508. <label class="block font-medium text-slate-300 mb-1">Set BGP Local Pref</label>
  4509. <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">
  4510. </div>
  4511. <div>
  4512. <label class="block font-medium text-slate-300 mb-1">Set Metric / MED</label>
  4513. <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">
  4514. </div>
  4515. <div>
  4516. <label class="block font-medium text-slate-300 mb-1">Set AS Prepend (Count)</label>
  4517. <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">
  4518. </div>
  4519. </div>
  4520. <div class="grid grid-cols-2 gap-3">
  4521. <div>
  4522. <label class="block font-medium text-slate-300 mb-1">Set Community</label>
  4523. <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">
  4524. </div>
  4525. <div>
  4526. <label class="block font-medium text-slate-300 mb-1">Set Next Hop (IP)</label>
  4527. <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">
  4528. </div>
  4529. </div>
  4530. </div>
  4531. <div class="grid grid-cols-3 gap-3">
  4532. <div class="col-span-2">
  4533. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4534. <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">
  4535. </div>
  4536. <div class="flex items-center pt-6">
  4537. <label class="flex items-center space-x-2 text-slate-300 cursor-pointer">
  4538. <input type="checkbox" id="modal-rf-disabled" class="rounded text-emerald-600 bg-slate-800 border-slate-700">
  4539. <span class="font-medium">Disabled (X)</span>
  4540. </label>
  4541. </div>
  4542. </div>
  4543. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4544. <button type="button" onclick="closeRoutingFilterModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4545. <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>
  4546. </div>
  4547. </form>
  4548. </div>
  4549. </div>
  4550. <!-- ================= MODAL: ADD / EDIT DHCP CLIENT ================= -->
  4551. <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">
  4552. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-md shadow-2xl overflow-hidden animate-in">
  4553. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4554. <div class="flex items-center gap-2">
  4555. <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>
  4556. <h3 id="modal-dhcp-title" class="text-sm font-bold text-white">Add DHCP Client</h3>
  4557. </div>
  4558. <button onclick="closeDHCPClientModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4559. </div>
  4560. <form onsubmit="submitSaveDHCPClient(event)" class="p-6 space-y-4 text-xs">
  4561. <input type="hidden" id="modal-dhcp-id">
  4562. <div>
  4563. <label class="block font-semibold text-slate-300 mb-1.5">Interface *</label>
  4564. <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">
  4565. <option value="">Select interface...</option>
  4566. </select>
  4567. <p class="text-[11px] text-slate-500 mt-1">Physical port, VLAN sub-interface, or Bridge to acquire dynamic lease on.</p>
  4568. </div>
  4569. <div class="grid grid-cols-2 gap-4">
  4570. <div>
  4571. <label class="block font-semibold text-slate-300 mb-1.5">Default Route Distance</label>
  4572. <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">
  4573. </div>
  4574. <div>
  4575. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4576. <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">
  4577. </div>
  4578. </div>
  4579. <div class="bg-slate-950/60 border border-slate-800/80 rounded-xl p-3 space-y-2.5">
  4580. <div class="text-[11px] font-bold text-slate-400 uppercase tracking-wider">RouterOS Options</div>
  4581. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer">
  4582. <input type="checkbox" id="modal-dhcp-def-route" checked class="rounded text-amber-500 bg-slate-800 border-slate-700 focus:ring-amber-500">
  4583. <span>Add Default Route (default gateway from DHCP)</span>
  4584. </label>
  4585. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer">
  4586. <input type="checkbox" id="modal-dhcp-peer-dns" checked class="rounded text-amber-500 bg-slate-800 border-slate-700 focus:ring-amber-500">
  4587. <span>Use Peer DNS (DNS servers from DHCP)</span>
  4588. </label>
  4589. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer">
  4590. <input type="checkbox" id="modal-dhcp-peer-ntp" checked class="rounded text-amber-500 bg-slate-800 border-slate-700 focus:ring-amber-500">
  4591. <span>Use Peer NTP (NTP servers from DHCP)</span>
  4592. </label>
  4593. <label class="flex items-center space-x-2.5 text-slate-300 cursor-pointer pt-1 border-t border-slate-800/80">
  4594. <input type="checkbox" id="modal-dhcp-enabled" checked class="rounded text-emerald-500 bg-slate-800 border-slate-700 focus:ring-emerald-500">
  4595. <span class="font-semibold text-white">Enable DHCP Client immediately</span>
  4596. </label>
  4597. </div>
  4598. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4599. <button type="button" onclick="closeDHCPClientModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800 transition">Cancel</button>
  4600. <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>
  4601. </div>
  4602. </form>
  4603. </div>
  4604. </div>
  4605. <!-- ================= MODAL: ADD / EDIT BRIDGE ================= -->
  4606. <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">
  4607. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4608. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4609. <h3 id="bridge-modal-title" class="text-sm font-bold text-white">Add Bridge Interface</h3>
  4610. <button onclick="closeBridgeModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4611. </div>
  4612. <form onsubmit="submitSaveBridge(event)" class="p-6 space-y-4 text-xs">
  4613. <input type="hidden" id="bridge-modal-id">
  4614. <div class="grid grid-cols-2 gap-4">
  4615. <div>
  4616. <label class="block font-semibold text-slate-300 mb-1.5">Bridge Name *</label>
  4617. <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">
  4618. </div>
  4619. <div>
  4620. <label class="block font-semibold text-slate-300 mb-1.5">MTU</label>
  4621. <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">
  4622. </div>
  4623. </div>
  4624. <div>
  4625. <label class="block font-semibold text-slate-300 mb-1.5">Admin MAC Address (Optional)</label>
  4626. <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">
  4627. </div>
  4628. <div class="grid grid-cols-2 gap-4">
  4629. <div>
  4630. <label class="block font-semibold text-slate-300 mb-1.5">STP Protocol</label>
  4631. <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">
  4632. <option value="rstp" selected>RSTP (Rapid STP - Recommended)</option>
  4633. <option value="stp">STP (IEEE 802.1D)</option>
  4634. <option value="none">none (Disable STP)</option>
  4635. </select>
  4636. </div>
  4637. <div>
  4638. <label class="block font-semibold text-slate-300 mb-1.5">STP Priority</label>
  4639. <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">
  4640. </div>
  4641. </div>
  4642. <!-- VLAN Filtering Box -->
  4643. <div class="p-3.5 bg-slate-950/60 border border-slate-800 rounded-xl space-y-3">
  4644. <label class="flex items-center space-x-2.5 cursor-pointer">
  4645. <input type="checkbox" id="bridge-modal-vlanfiltering" onchange="toggleBridgeModalVlanFiltering()" class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4646. <span class="font-semibold text-white">VLAN Filtering (802.1Q Aware)</span>
  4647. </label>
  4648. <div id="bridge-modal-pvid-box" class="grid grid-cols-2 gap-3 pl-6">
  4649. <div>
  4650. <label class="block text-[11px] text-slate-400 mb-1">Default PVID</label>
  4651. <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">
  4652. </div>
  4653. <div class="flex items-center pt-4">
  4654. <label class="flex items-center space-x-2 text-slate-400 cursor-pointer text-xs">
  4655. <input type="checkbox" id="bridge-modal-fastforward" checked class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4656. <span>Fast Forward</span>
  4657. </label>
  4658. </div>
  4659. </div>
  4660. </div>
  4661. <div>
  4662. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4663. <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">
  4664. </div>
  4665. <div class="pt-1">
  4666. <label class="flex items-center space-x-2 cursor-pointer">
  4667. <input type="checkbox" id="bridge-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  4668. <span class="font-medium text-slate-300">Disabled (X)</span>
  4669. </label>
  4670. </div>
  4671. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4672. <button type="button" onclick="closeBridgeModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4673. <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>
  4674. </div>
  4675. </form>
  4676. </div>
  4677. </div>
  4678. <!-- ================= MODAL: ADD / EDIT BRIDGE PORT ================= -->
  4679. <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">
  4680. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4681. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4682. <h3 id="bridge-port-modal-title" class="text-sm font-bold text-white">Add Port to Bridge</h3>
  4683. <button onclick="closeBridgePortModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4684. </div>
  4685. <form onsubmit="submitSaveBridgePort(event)" class="p-6 space-y-4 text-xs">
  4686. <input type="hidden" id="bridge-port-modal-id">
  4687. <div class="grid grid-cols-2 gap-4">
  4688. <div>
  4689. <label class="block font-semibold text-slate-300 mb-1.5">Target Bridge *</label>
  4690. <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>
  4691. </div>
  4692. <div>
  4693. <label class="block font-semibold text-slate-300 mb-1.5">Interface *</label>
  4694. <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>
  4695. </div>
  4696. </div>
  4697. <div class="grid grid-cols-3 gap-3">
  4698. <div>
  4699. <label class="block font-semibold text-slate-300 mb-1.5">PVID</label>
  4700. <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">
  4701. </div>
  4702. <div>
  4703. <label class="block font-semibold text-slate-300 mb-1.5">Path Cost</label>
  4704. <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">
  4705. </div>
  4706. <div>
  4707. <label class="block font-semibold text-slate-300 mb-1.5">Horizon (Split)</label>
  4708. <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">
  4709. </div>
  4710. </div>
  4711. <div class="grid grid-cols-2 gap-4">
  4712. <div>
  4713. <label class="block font-semibold text-slate-300 mb-1.5">Frame Types</label>
  4714. <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">
  4715. <option value="admit-all" selected>admit all</option>
  4716. <option value="admit-only-vlan-tagged">admit only VLAN tagged</option>
  4717. <option value="admit-only-untagged-and-priority-tagged">admit only untagged</option>
  4718. </select>
  4719. </div>
  4720. <div>
  4721. <label class="block font-semibold text-slate-300 mb-1.5">Priority</label>
  4722. <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">
  4723. </div>
  4724. </div>
  4725. <div class="grid grid-cols-2 gap-3 p-3 bg-slate-950/60 border border-slate-800 rounded-xl">
  4726. <label class="flex items-center space-x-2 cursor-pointer">
  4727. <input type="checkbox" id="bridge-port-modal-learn" checked class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4728. <span class="text-white font-semibold">MAC Learning</span>
  4729. </label>
  4730. <label class="flex items-center space-x-2 cursor-pointer">
  4731. <input type="checkbox" id="bridge-port-modal-ingressfiltering" class="rounded bg-slate-800 border-slate-700 text-sky-500">
  4732. <span class="text-white font-semibold">Ingress Filtering</span>
  4733. </label>
  4734. </div>
  4735. <div>
  4736. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4737. <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">
  4738. </div>
  4739. <div class="pt-1">
  4740. <label class="flex items-center space-x-2 cursor-pointer">
  4741. <input type="checkbox" id="bridge-port-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  4742. <span class="font-medium text-slate-300">Disabled (X)</span>
  4743. </label>
  4744. </div>
  4745. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4746. <button type="button" onclick="closeBridgePortModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4747. <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>
  4748. </div>
  4749. </form>
  4750. </div>
  4751. </div>
  4752. <!-- ================= MODAL: ADD / EDIT BRIDGE VLAN ================= -->
  4753. <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">
  4754. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden animate-in">
  4755. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4756. <h3 id="bridge-vlan-modal-title" class="text-sm font-bold text-white">Add Bridge VLAN Entry</h3>
  4757. <button onclick="closeBridgeVlanModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4758. </div>
  4759. <form onsubmit="submitSaveBridgeVLAN(event)" class="p-6 space-y-4 text-xs">
  4760. <input type="hidden" id="bridge-vlan-modal-id">
  4761. <div class="grid grid-cols-2 gap-4">
  4762. <div>
  4763. <label class="block font-semibold text-slate-300 mb-1.5">Target Bridge *</label>
  4764. <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>
  4765. </div>
  4766. <div>
  4767. <label class="block font-semibold text-slate-300 mb-1.5">VLAN IDs *</label>
  4768. <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">
  4769. </div>
  4770. </div>
  4771. <div>
  4772. <label class="block font-semibold text-slate-300 mb-1.5">Tagged Member Ports (Trunk)</label>
  4773. <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">
  4774. <span class="text-slate-500 text-xs font-sans">Select a bridge above to view member ports</span>
  4775. </div>
  4776. </div>
  4777. <div>
  4778. <label class="block font-semibold text-slate-300 mb-1.5">Untagged Member Ports (Access)</label>
  4779. <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">
  4780. <span class="text-slate-500 text-xs font-sans">Select a bridge above to view member ports</span>
  4781. </div>
  4782. </div>
  4783. <div>
  4784. <label class="block font-semibold text-slate-300 mb-1.5">Comment</label>
  4785. <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">
  4786. </div>
  4787. <div class="pt-1">
  4788. <label class="flex items-center space-x-2 cursor-pointer">
  4789. <input type="checkbox" id="bridge-vlan-modal-disabled" class="rounded bg-slate-800 border-slate-700 text-rose-500">
  4790. <span class="font-medium text-slate-300">Disabled (X)</span>
  4791. </label>
  4792. </div>
  4793. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4794. <button type="button" onclick="closeBridgeVlanModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4795. <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>
  4796. </div>
  4797. </form>
  4798. </div>
  4799. </div>
  4800. <!-- ================= MODAL: ADD IP ADDRESS TO BRIDGE ================= -->
  4801. <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">
  4802. <div class="bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-sm shadow-2xl overflow-hidden animate-in">
  4803. <div class="px-6 py-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/40">
  4804. <div>
  4805. <h3 class="text-sm font-bold text-white">Assign IP Address to Bridge</h3>
  4806. <span id="bridge-ip-modal-sub" class="text-[11px] font-mono text-sky-400">bridge1</span>
  4807. </div>
  4808. <button onclick="closeBridgeIPModal()" class="text-slate-400 hover:text-white p-1 rounded-lg">✕</button>
  4809. </div>
  4810. <form onsubmit="submitAddBridgeIP(event)" class="p-6 space-y-4 text-xs">
  4811. <input type="hidden" id="bridge-ip-modal-id">
  4812. <div>
  4813. <label class="block font-semibold text-slate-300 mb-1.5">IPv4 / Subnet (CIDR) *</label>
  4814. <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">
  4815. </div>
  4816. <div class="pt-4 border-t border-slate-800 flex justify-end space-x-3">
  4817. <button type="button" onclick="closeBridgeIPModal()" class="px-4 py-2 rounded-lg text-slate-400 hover:bg-slate-800">Cancel</button>
  4818. <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>
  4819. </div>
  4820. </form>
  4821. </div>
  4822. </div>
  4823. <script src="app.js?v=4.1"></script>
  4824. </body>
  4825. </html>