index.html 273 KB

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