const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:6416,currentPage:1,targetPage:1,total:15,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[{id:15,url:'/t/0f074b236a045c7665770f3a1528',name:'软路由',color:'#66BB6A',icon:'mdi-router-wireless-settings',},],posts:[{id:77009,num:0,uid:13598,content:'\u003Cp\u003E大佬们好,我家有个 NAS ,放在书房。因为光猫在玄关,只有一条线到客厅,书房没有条件接有线,所以得用 AP 中继过去,NAS 再接上 AP 。\u003C/p\u003E\u003Cp\u003E以前是用的光猫拨号,OpenWRT 做旁路用科学插件,然后 K2p 在书房做 AP 中继,NAS 再接 K2p ,这个方案家里需要翻墙的设备网关改成旁路就行了,一直都没啥问题,NAS 接在 AP 上也能正常科学。\u003C/p\u003E\u003Cp\u003E但是,最近发现电信会悄悄上行速度,而且光猫性能很差,上行只能跑个 10Mbps 左右,所以选择从光猫拨号改成了路由拨号,形成了左边这个拓扑图。但是在这个拓扑结构下,设置网关为旁路的设备不能上网,但是旁路又能 ping 通外网,折腾了两天了,没弄好。不知道是不是因为我拨号的路由是 OP ,旁路装在 PVE 里,又是接的中继,导致网络环境太复杂了?\u003C/p\u003E\u003Cp\u003E所已打算换成右边这种拓扑结构,用 WMA301 拨号,刷了 OP 的 AX1800 放在书房做 AP+旁路的功能,不知道可以吗\u003C/p\u003E\u003Cp\u003E或者在这个条件下我该怎么部署网络结构呢?\u003C/p\u003E\u003Cp\u003E\u003Cimg alt\u003D\"image\" src\u003D\"https://files.catbox.moe/447eyj.png\"\u003E\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 12:01:12',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77010,num:1,uid:12215,content:'设置网关为旁路的设备 你做个 tracert 到一个外网 ip 地址看看断哪了,图上看着理论上是可以通的。 PVE 没用过 你看看有没针对虚拟网卡的安全设置。 ESXI 有个混杂模式,PVE 不知道有没有。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 12:26:18',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77011,num:2,uid:5726,content:'猜一个原因,左边那个网络接口,设置旁路由为网关的设备,数据包去程和回程不一致,去程的数据包是 设备 -\u0026gt; 旁路由 -\u0026gt; 主路由 -\u0026gt; 目标服务器 路径,回程的数据包是 目标服务器 -\u0026gt; 主路由 -\u0026gt; 设备 的路径,主路由发现数据包对不起来会进行丢包处理(有的路由器就不会)。可以用 tcpdump 去主路由上抓一下包看看是卡在哪儿了\u003Cbr\u003E\u003Cbr\u003E解决的话两种,一个是在旁路由做 nat ,去程和回程一致了,另一种方式是关掉主路由的 rpf',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 12:48:08',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77012,num:3,uid:13598,content:'右边这个方式行得通吗。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 12:58:38',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77013,num:4,uid:13598,content:'我尝试过关掉 PVE 的防火墙功能,但是好像做不用不大。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 12:59:17',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77014,num:5,uid:6622,content:'最省事的方法,沿着踢脚线从弱电箱走线到书房,关键词 “隐形光纤”',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 13:41:31',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77015,num:6,uid:14214,content:'如 2 楼所说,左边是因为来回路径不一致,两段网关 1.1 有问题;换个网段互相指路由就能打通,或者旁路由做 nat 。右边方案没问题。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:11:49',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77016,num:7,uid:13598,content:'我昨天试着在旁路里增加 NAT 规则,重写,但是还是不行。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:16:44',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77017,num:8,uid:2852,content:'不能吧 旁路由转发时会修改 Saddr , 主路由眼里就是旁路由来的数据。回程的时候也发给旁路由(个人理解)\u003Cbr\u003E\u003Cbr\u003E我觉得问题是 PVE 的虚拟交换机是不是有用户隔离什么的(毕竟我也没用过)\u003Cbr\u003E另外本来觉得是 dns 的问题,但是应该只是外网网站上不去,baidu 上不去那就不是 dns 问题。\u003Cbr\u003E\u003Cbr\u003E退一万步说,实践中我觉得有问题的 一般都是没问题的\u003D \u003D\u003Cbr\u003E\u003Cbr\u003E另外直接 AX1800 拨号+代理+wifi 多好,all in boom',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:25:02',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77018,num:9,uid:2852,content:'另外确定 openwrt 旁路由的设置一定是好的吗?',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:27:10',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77019,num:10,uid:14214,content:'主路由有 wrt 直接翻了,下面还搞个 wrt 做咩? pve 能出互联网,走 ax wrt 翻就行了吧',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:27:33',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77020,num:11,uid:5726,content:'右边这个中继具体是怎么做的呢,两个不同网段吗',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:30:04',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77021,num:12,uid:869,content:'图文对半天对不上, 正常也是左边放之前的图,右边放改了后的图吧,看半天,其实只放图就好了,字不对打这么多,代词还和图对不太上,\u003Cbr\u003E\u003Cbr\u003E如果左边这个图的飞牛 os 是你的 nas , 那他同时连了无线和有线, 无线的网络跳数必然比有线的小,于是路由始终走有线的路由',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:40:48',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77022,num:13,uid:869,content:'window 下用 tracert ,linux 下用 traceroute , 看看路由怎么跳转的\u003Cbr\u003E路由没问题再查 dns',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:43:19',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:77023,num:14,uid:5726,content:'你说得也是对的,如果数据包经过旁路由的某些神奇软件处理,SADDR 会被修改成旁路由自己,如果是国内 IP 或者没经过某些神奇软件再或者配置的有问题,此时旁路由只转发数据包,就会造成非对称路由,结合他旁路由和主路由不同的情况,就有可能造成客户端上不了网。',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 16:56:25',updatedAt:'2025-03-26 13:49:15',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[2852,{uid:2852,url:'/u/3f3d63076a045c75686f546f4f063e26',avatar:'/a/3f3d63076a045c75686f546f4f063e26',username:'dufldylan1🤖',}],[6622,{uid:6622,url:'/u/031a023d6a045c716668546f395e3e12',avatar:'/a/031a023d6a045c716668546f395e3e12',username:'hicdn🤖',}],[14214,{uid:14214,url:'/u/0823512e6a045d73626b526f44251912',avatar:'/a/0823512e6a045d73626b526f44251912',username:'eisen🤖',}],[13598,{uid:13598,url:'/u/150d63586a045d7465635e6f411d171d',avatar:'/a/150d63586a045d7465635e6f411d171d',username:'Rebron1900🤖',}],[12215,{uid:12215,url:'/u/303041196a045d75626b536f13231870',avatar:'/a/303041196a045d75626b536f13231870',username:'leafyyy🤖',}],[869,{uid:869,url:'/u/0a0b593f6a045c77686c5f6f26333d26',avatar:'/a/0a0b593f6a045c77686c5f6f26333d26',username:'hwdq0012🤖',}],[5726,{uid:5726,url:'/u/6a2162086a045c726768506f352f6703',avatar:'/a/6a2162086a045c726768506f352f6703',username:'leehaoze98🤖',}],]),related:[{title:'tailscale 和 zerotier 哪个好用,功能多?',url:'/d/360b75096a045c77606a567a445d6a6a2b280405',},{title:'Openwrt 上如何设置递归静态路由',url:'/d/2f2c575e6a045c77606a567a465f676a5b2f3139',},{title:'小米 wifi7 路由器千兆都跑不满',url:'/d/313003376a045c77606a567a475c606a1c101014',},{title:'家庭路由器组网求助',url:'/d/3711025f6a045c77606a56754f5e636a3b0c3505',},{title:'EasyTier 组网是真不错',url:'/d/6a035e586a045c77606a56744051666a5d332b01',},{title:'目前好像感受到了 openwrt 作为主路由的无力感',url:'/d/373048036a045c77606a56744051616a2517642b',},{title:'路由器选择就推荐,小米还是中兴呢?或者华硕呢',url:'/d/6a3e555a6a045c77606a5674405f676a282f0920',},{title:'畅网 N100 软路由死机频繁, PVE + 爱快 + IstoreOS 配置,换硬盘后仍未解决,求助!',url:'/d/037d540e6a045c77606a56744251656a38131d3e',},{title:'城中村租房 OpenWrt 抢共享带宽问题求助',url:'/d/6b3b512b6a045c77606a5674425d626a2e731038',},{title:'两个路由器之间的电力猫应该如何配置?',url:'/d/0f784b076a045c77606a56744258656a2b711f64',},{title:'求推荐带两路 SFP+口的路由器',url:'/d/620859076a045c77606a5674455f656a1b131f15',},{title:'你们的AdGuard home能去youtube客户端广告吗',url:'/d/1c7c482c6a045c77606a5674465f6a6a5b2f0319',},{title:'有什么好用的软路由系统推荐吗',url:'/d/3d3b7e1d6a045c77606a5674465b636a2902231f',},{title:'openwrt 去广告的方案',url:'/d/1f3c621a6a045c77606a56774550656a0d326304',},{title:'r2s 的内存卡(带op系统 ) 插r4s 上能否直接使用。',url:'/d/2f38780f6a045c77606a5677455b6b6a0a7a1a2a',},{title:'AdGuard现在哪里还有活动吗?',url:'/d/1d1077186a045c77606a56764e5b616a162f6736',},{title:'r2s 只能跑满300兆啊。4s 5s 哪个能跑满千啊',url:'/d/080b7a2b6a045c77606a5676415c6a6a1c20270b',},{title:'分享一下用AdguardHome和Nginx的配置,让你可以自由DIY路径',url:'/d/6d10533f6a045c77606a5676415a626a0f273467',},{title:'adguard home的doh服务终于搭建成功了',url:'/d/69707b0c6a045c77606a567641586b6a5d361b64',},{title:'AdGuard home过滤手机广告——服务端',url:'/d/2a250a046a045c77606a5671405e636a0a3a2126',},],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")