index.html 339 KB

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