index.html 273 KB

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