顯示具有 Mikrotik RouterOS 標籤的文章。 顯示所有文章
顯示具有 Mikrotik RouterOS 標籤的文章。 顯示所有文章

2012年8月22日 星期三

Router OS搭配L2網管型SWITCH(SMC8024L2)實現單網路孔多WAN

一般來說在多路對外線路的環境下,發生RouterOS機器上的網路孔不夠用時,可利用Switch切VLAN方式從RoterOS一孔在switch分出多孔使用。這裡以RouterOS之ETH4分出兩孔為例,一孔撥接出兩條PPPoe。

RouterOS設定:
於Interface新增2個vlan介面,VLAN ID分別指定2跟3,介面選擇ETH4,如下圖

 之後新增各將兩條PPPoe並將之介面各指定為vlan2跟vlan3

SMC Switch設定:

假設我們RouterOS上的ETH4孔與SMC的Port1孔對接,那SMC的設定方法為
VLAN Membership=>Add VLAN Group 新增VLAN ID 2跟VLAN ID 3
並在VLAN ID 1裡將P1;P2;P3取消打勾。
之後在VLAN ID 2中將P1;P2打勾。 之後在VLAN ID 3中將P1;P3打勾。




以下是SMC原廠關於VLAN說明之官方文件
Introduction to VLANs
VLANs (or Virtual LANs) are logical partions of the physical LAN. You can use VLANs to:
  • Increase network performance
  • Increase internal network security
If the network has adequate performance and security for your current needs, it is recommended that you leave the VLAN settings in the default configuration. The default configuration is as follows:
  • All ports are members of VLAN 1
  • The switch management interface is on VLAN 1
  • All ports have a Port VLAN ID (PVID) of 1
  • All ports can send and receive both VLAN-tagged and untagged packets (i.e. they are "hybrid" ports)
In the default configuration, any port is able to send traffic to any other port and a PC connected to any port will be able ro reach the management interface. Broadcast traffic, for example, will be flooded to all ports on the switch.

Add VLAN Group
Type into the VLAN ID (1-4093) of the VLAN group which you want to setup. After pressing the ADD button, you will be navigated to a new page for configuring VLAN membership. Only one VLAN group can be setup per time. Note: For QinQ application, The number of VLAN groups that would be setup is equal to the number of customer ports. Each VLAN group consists of two ports, customer port and network port. The VID equals to PVID of the customer port. Network port is member of the VLAN of customer port.

VLAN Group List
This table displays all the VLAN groups and they are sorted for display purposes. Click the radio button which is associated with the VLAN that is displayed immediately below it and use Modify or Delete button can modify or delete an existing VLAN group. Modify button will navigate to a web page for configuring VLAN membership. 


VLAN Awareness
  • VLAN aware ports will strip the VLAN tag from received frames and insert the tag in transmitted frames (except PVID). VLAN unaware ports will not strip the tag from received frames or insert the tag in transmitted frames.
  • For QinQ application, customer port should be VLAN unaware and network port (trunk port) should be VLAN aware.

  • QinQ
  • QinQ enabled port will accept packets up to 1526 bytes in length, which means double tag header frames can be accepted.
  • For QinQ application, the QinQ should be enabled for provider port but not for customer port. Note: For QinQ application, customer ports indicate those ports which are connected to normal VLAN aware switches at the customer network and the network ports are those which are connected to the service provider network. To tunnel the packets through MAN, QinQ needs to be enabled on network ports.

  • Packet Type
    • PCs should be connected to ports with Packet Type set to All. PCs cannot, in general, send or receive tagged packets.
    • Switches should be connected to each other with Packet Type set to Tagged Only.
    • If the Packet Type is set to All, the port can accept incoming tagged and untagged packets. Untagged packets will be associated with the VLAN identified by the PVID. Tagged packets will be dropped unless the port is a member of the VLAN identified by the VLAN tag in the packet. Outgoing packets will be tagged unless the packet's VLAN ID is the same as the PVID.
    • If the Packet Type is set to Tagged Only, the port will drop untagged packets and will only send and receive tagged packets. Tagged packets will be dropped unless the port is a member of the VLAN identified by the VLAN tag in the packet. The PVID has no effect in this case.

    Port VLAN ID
    • The PVID is (Port VLAN ID) is the VLAN ID that is associated with untagged, ingress packets.
    • It is not possible to remove a port from VLAN 1 unless its PVID has been changed to something other than 1.
    • The PVID has no effect on ports that have Packet Type set to Tagged Only.
    • Untagged frames received on the port will be classified to this VLAN ID. Frames classified to this VLAN ID will be sent untagged on the port.
    • None is used for trunk port.
    • For QinQ application, the PVID for each customer port must be unique.

    QinQ Application Example
    This example shows how to configure one network port and three customer ports with the following setup on this switch. Port 1 as network port and port 2-4 are customer ports.
    • Click off VLAN aware enabled checkboxes for port 2-4 and click VLAN aware enabled checkbox for port 1.
    • Clear the QinQ enabled checkboxes for port 2-4 and click QinQ enabled checkbox for port 1.
    • Type PVID 2,3,4 individually for port 2-4. The PVID for each customer port must be unique.
    • In VLAN membership page, add VLAN group 2 with port 1 and port 2 as members. Add VLAN group 3 with port 1 and port 3 as members. Add VLAN group 4 with port 1 and port 4 as members. 

    2011年12月4日 星期日

    內部NAT回流問題分析實作

    在虛擬IP的環境下,routeros裡區網中有一台WEB伺服器也是虛擬ip,外部要經過wan 的public ip 訪問這台web server主要做兩步驟,也就是在ip=>firewall=>nat裡加兩條規則即可,第一針對此台web server ip作src-nat,此時web server已經可以對外通訊,出去的ip為ros中的對外public ip;第二欲讓外部ip訪問此台server則必須做Dst-nat將ros上的public ip映射80 port到此台server。
    以上兩規則所指定的界面都是wan介面,基本上沒什麼問題。

    但是欲實現區網Client透過此台pubic ip訪問區網中web伺服器,則必須做NAT回流,在此必須先分析一下觀念,設定起來才比較清楚。請先看下圖....

    如上圖,黃色虛線即是錯誤通訊,客戶機經router os公網ip欲回到本身同區網訪問web server,也是加兩條規則即可,第一針對客戶機對區網作src-nat但是"out-interface要指定routeros裡的內網介面";第二針對server作dst-nat並"in-interface要指定routeros的內網介面",說簡單一點就是對外通訊的兩條nat規則除了介面不同其他設定值一樣。

    這裡有一個重要觀念就是在routeros中要將nat分成外網跟內網才不會造成錯誤通訊。撇除介面在將routeros的公網跟內網ip想成都是屬於routeros並針對介面不同去做設定。

    以下在分享從網路找到的兩張圖,參考看看














    參考資料:
    http://ewangsoft.blog.163.com/blog/static/7721558220105581734591/
    http://ewangsoft.blog.163.com/blog/static/77215582201062361238621/