index.html 299 KB

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