index.html 338 KB

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