index.html 323 KB

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