謝謝各位前輩的指導~因為小弟只算是剛入門沒多久的新手而已~

如果有問到一些太無言的問題還請前輩們原諒


OSos wrote:
例如 192.168.1.0/24 跟192.168.2.0/24 若是要通
一定要有一個 device 有兩張網卡 涵蓋這兩個ip
這個device 就是路由

若是要啟用router 功能
你連更上層的router 都得要處理


小弟的公司是這樣的網路架構

對外網路←→pf防火牆←→A虛擬網段(假設192.168.1.X)←→FreeBSD(router不是NAT)
←→B虛擬網段(假設192.168.2.X,PCA所在網段)
←→VM的FreeBSD(假設對外IP是192.168.2.2,對內是192.168.3.1)
←→VM的C虛擬網段(就是PCB所在網段,假設192.168.3.X)

照OSos大說明的~小弟VM的FreeBSD應該就算是您所說的路由了~是嗎?

如果要啟用router 功能,就是VM的FREEBSD要設定路由,介於A、B中間的虛擬網段也要再設定路由的意思嗎?

之前小弟設定VM的FREEBSD路由後,發現從PCB只能ping的到192.168.2.2,其他2.X的網段都ping不到也是因為更上層的router沒有設的原因嗎?


k750iii wrote:
重複看了好多遍,我想...(恕刪)

謝謝~k750iii大導正了小弟的觀念~小弟一直以為NAT跟路由表是相同原理的東西
對外網路←→pf防火牆←→A虛擬網段(假設192.168.1.X)←→FreeBSD(router不是NAT)
︿︿︿︿︿︿︿︿︿︿︿︿︿︿是的這裡就是router
←→B虛擬網段(假設192.168.2.X,PCA所在網段)

你在router table 一定可以看到所有的path

已經很久沒有玩freebsd
應該在rc.loacl 裡面會有 path 設定

在你的freebsd vm 內
參考一下這篇
http://www.freebsd.org/doc/handbook/network-routing.html

32.2.4 Building a Router
A network router is simply a system that forwards packets from one interface to another. Internet standards and good engineering practice prevent the FreeBSD Project from enabling this by default in FreeBSD. You can enable this feature by changing the following variable to YES in rc.conf(5):

gateway_enable="YES" # Set to YES if this host will be a gateway
This option will set the sysctl(8) variable net.inet.ip.forwarding to 1. If you should need to stop routing temporarily, you can reset this to 0 temporarily.

Your new router will need routes to know where to send the traffic. If your network is simple enough you can use static routes. FreeBSD also comes with the standard BSD routing daemon routed(8), which speaks RIP (both version 1 and version 2) and IRDP. Support for BGP v4, OSPF v2, and other sophisticated routing protocols is available with the net/zebra package. Commercial products such as GateD® are also avail
這裡有詳細的說明
工作機 上線 P15 Gen1 48G RAM 一堆頻率不統一的 合在一起跑

OSos wrote:
對外網路←→pf防火...(恕刪)


OSos大~謝謝喔~小弟我再詳細閱讀這篇~
jackyepson wrote:
之前小弟設定VM的FREEBSD路由後,發現從PCB只能ping的到192.168.2.2,其他2.X的網段都ping不到也是因為更上層的router沒有設的原因嗎?...(恕刪)


你check一下2.x所有電腦的subnet mask是否都一樣! 基本上VM設intranet那就是在同LAN中,你能ping 到192.168.2.2那理論上也可以ping到同LAN的其他IP,除非......你subnet mask不對,或者其他電腦把ICMP drop掉,

再來你是說3.x的電腦沒辦法上網對吧?
那你要在FREEBSD裝NAT,且其餘3.x的gw要指向192.168.3.1

HTTP大多走80 port,這跟IP能不能相通是兩回事(routing table能相通是必要的),但你依舊要裝NAT呀

k750iii wrote:
基本上VM設intranet那就是在同LAN中,你能ping 到192.168.2.2那理論上也可以ping到同LAN的其他IP

是呀~小弟也覺得奇妙為何會ping不到~

不過小弟也有用2.X其他電腦ping到3.X的電腦

卻是可以正常ping的~這種情況小弟也只能猜是不是VM的一些什麼內定機制所以才導致這樣
文章分享
評分
評分
複製連結

今日熱門文章 網友點擊推薦!