{"id":1749,"date":"2016-04-20T10:16:59","date_gmt":"2016-04-20T02:16:59","guid":{"rendered":"http:\/\/www.51cos.com\/?p=1749"},"modified":"2016-04-20T11:11:37","modified_gmt":"2016-04-20T03:11:37","slug":"%e8%b7%af%e7%94%b1%e5%99%a8%e4%b8%ad%e7%9a%84br0%e3%80%81eth0%e3%80%81wlan0%e3%80%81wlan1%e3%80%81vlan0%e3%80%81vlan1%e5%88%86%e5%88%ab%e4%bb%a3%e8%a1%a8%e4%bb%80%e4%b9%88%e6%84%8f%e6%80%9d%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=1749","title":{"rendered":"\u8def\u7531\u5668\u4e2d\u7684br0\u3001eth0\u3001wlan0\u3001wlan1\u3001vlan0\u3001vlan1\u5206\u522b\u4ee3\u8868\u4ec0\u4e48\u610f\u601d\uff1f"},"content":{"rendered":"<p>\u5148\u770b\u4e24\u5f20\u5e38\u7528\u7684\u8def\u7531\u5668\u7f51\u8def\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1755\" src=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2016\/04\/ASUS-Internals-default-sm.png\" alt=\"ASUS-Internals-default-sm\" width=\"450\" height=\"288\" \/><\/p>\n<p>\u4e0d\u540c\u7684\u8def\u7531\u5668\u6709\u4e0d\u540c\u7684\u8bbe\u5b9a\u65b9\u6cd5\uff0c\u4e3e\u4f8b\uff1a<\/p>\n<p>br0\uff1aBridge 0 \uff0c\uff08\u6709\u7684\u4ee3\u8868vlan0\uff0c\u800cvlan0 \uff1a\u4ee3\u8868LAN2,3,4\uff09\uff1b<br \/>\neth0\uff1a\u8def\u7531\u5668\u7684LAN\u53e3\u7684<br \/>\nvlan1 \uff1aWAN\uff1b<\/p>\n<p>WLAN0\u3001WLAN1\u3001WLAN2\u3001WLAN3\uff1a\u4ee3\u8868\u65e0\u7ebf\u8def\u7531\u5668\u7684\u70ed\u70b90\u3001\u70ed\u70b91\u3001Station0\uff08\u8fde\u63a5\u5176\u4ed6\u8def\u7531\u5668\u7684interface\uff09\u3001Station1\uff08\u8fde\u63a5\u5176\u4ed6\u8def\u7531\u5668\u7684interface\uff09\uff1b<\/p>\n<p>&nbsp;<\/p>\n<p>\u50cf\u6211\u4eec\u8bbe\u8ba1\u7684\u8def\u7531\u5668\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1758\" src=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2016\/04\/ezcast_pro_box_network.jpg.jpeg\" alt=\"ezcast_pro_box_network.jpg\" width=\"863\" height=\"290\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u66f4\u591a\u53ef\u53c2\u8003openwrt\u4ecb\u7ecd\uff1ahttps:\/\/wiki.openwrt.org\/doc\/networking\/network.interfaces#<\/p>\n<p>&nbsp;<\/p>\n<h1>\u5b9e\u6218\u90e8\u5206\uff1a\u5206\u6790OpenWrt \u7f51\u8def\u63a5\u53e3\u7ed3\u6784 \uff0c\u4e3b\u8981\u5206\u6790\u4e24\u79cd\u8def\u7531\u5668\u8bbe\u5907\uff1a<\/h1>\n<h1>\uff11\uff0eInternal Layout D-Link DIR-825\uff0c<\/h1>\n<h1>\u5b98\u65b9\u6587\u6863https:\/\/wiki.openwrt.org\/doc\/techref\/internal.layout<\/h1>\n<p>&nbsp;<\/p>\n<p>This article describes the internal layout and configuration of the D-Link DIR-825. This particular hardware has two physical network interfaces, eth0 and eth1, whereas most emebedded devices have only one: eth0. It also has two two wireless network interfaces using the IEEE 802.11 protocol, represented by wlan0 and wlan1.<\/p>\n<p>\u6b64\u6587\u63cf\u8ff0\u4e86D-Link DIR-825\u5185\u90e8\u7ed3\u6784\u548c\u8bbe\u7f6e\u72b6\u51b5\uff1a\u6709\u4e24\u4e2a\u786c\u4ef6\u63a5\u53e3\uff08eth0 \u3001eth1\uff09\uff0c\u4e24\u4e2a\u65e0\u7ebf\u63a5\u53e3\uff08WLAN0\u3001WLAN1\uff09<\/p>\n<div>\n<p><a class=\"media\" title=\"media:dlink:dir-825:dir-825_hardware_diagram2.gif\" href=\"https:\/\/wiki.openwrt.org\/_detail\/media\/dlink\/dir-825\/dir-825_hardware_diagram2.gif?id=doc%3Atechref%3Ainternal.layout\" target=\"_blank\"><img decoding=\"async\" class=\"media\" src=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2016\/04\/c4f7e5a5c77943249a5a8e6845e66fd3.gif\" alt=\"\" \/><\/a><\/p>\n<div class=\"table sectionedit2\">\n<table class=\"inline \">\n<thead>\n<tr class=\"row0\">\n<th class=\"col0\">iface<\/th>\n<th class=\"col1\">Port<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"row1\">\n<td class=\"col0 leftalign\">eth0<\/td>\n<td class=\"col1\">internal interface connected to Gigabit Switch (default) \u5185\u90e8\u4ea4\u6362\u673a\u63a5\u53e3<\/td>\n<\/tr>\n<tr class=\"row2\">\n<td class=\"col0 leftalign\">eth1<\/td>\n<td class=\"col1 leftalign\">internal interface connected to WAN port (default)\u00a0 \u5e7f\u57df\u7f51\u63a5\u53e3<\/td>\n<\/tr>\n<tr class=\"row3\">\n<td class=\"col0\">wlan0<\/td>\n<td class=\"col1\">radio0<\/td>\n<\/tr>\n<tr class=\"row4\">\n<td class=\"col0\">wlan1<\/td>\n<td class=\"col1\">radio1<\/td>\n<\/tr>\n<tr class=\"row5\">\n<td class=\"col0 leftalign\">usb<\/td>\n<td class=\"col1\">Bluetooth\/3G\/etc.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Additional information on the rtl8366s switch. Switch 1: rtl8366s(RTL8366S), ports: 6 (cpu @ 5), vlans: 16 (4096 starting with 10.03.1-rc4)<\/p>\n<div class=\"table sectionedit3\">\n<table class=\"inline \">\n<thead>\n<tr class=\"row0\">\n<th class=\"col0 leftalign\">switch port id<\/th>\n<th class=\"col1 leftalign\">Label on the back<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"row1\">\n<td class=\"col0 leftalign\">port:0<\/td>\n<td class=\"col1 leftalign\">LAN4<\/td>\n<\/tr>\n<tr class=\"row2\">\n<td class=\"col0 leftalign\">port:1<\/td>\n<td class=\"col1 leftalign\">LAN3<\/td>\n<\/tr>\n<tr class=\"row3\">\n<td class=\"col0 leftalign\">port:2<\/td>\n<td class=\"col1 leftalign\">LAN2<\/td>\n<\/tr>\n<tr class=\"row4\">\n<td class=\"col0 leftalign\">port:3<\/td>\n<td class=\"col1 leftalign\">LAN1<\/td>\n<\/tr>\n<tr class=\"row5\">\n<td class=\"col0 leftalign\">port:4<\/td>\n<td class=\"col1 leftalign\">WAN<\/td>\n<\/tr>\n<tr class=\"row6\">\n<td class=\"col0 leftalign\">port:5<\/td>\n<td class=\"col1 leftalign\">internal<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The default config provided looks something like below:<\/p>\n<pre class=\"code\">config interface loopback<br \/>\n        option ifname   lo<br \/>\n        option proto    static<br \/>\n        option ipaddr   127.0.0.1<br \/>\n        option netmask  255.0.0.0<\/p>\n<p>config interface lan<br \/>\n        option ifname   eth0<br \/>\n        option type     bridge<br \/>\n        option proto    static<br \/>\n        option ipaddr   192.168.1.1<br \/>\n        option netmask  255.255.255.0<\/p>\n<p>config interface wan<br \/>\n        option ifname   eth1<br \/>\n        option proto    dhcp<\/p>\n<p>config switch rtl8366s<br \/>\n        option enable   1<br \/>\n        option reset    1<br \/>\n        option enable_vlan 1<\/p>\n<p>config switch_vlan<br \/>\n        option device   rtl8366s<br \/>\n        option vlan     0<br \/>\n        option ports    \"0 1 2 3 5\"<\/p>\n<p>Going through the configuration, step by step, provides the following information.<\/p>\n<p>First there's the loopback interface lo.<br \/>\nSecond, in this configuration, eth0 is part of the bridged interface lan.<br \/>\nThird, eth1 is configured as the wan interface.<br \/>\nFourth, is the switch configuration.<br \/>\nThe 'config switch rtl8366s' options enable the switch, reset it and enable VLAN capability.<br \/>\nThe 'config switch_vlan' options enable VLAN0 and assigns it to the 4 external LAN ports and internal eth0 interface.<br \/>\n<strong>Note:<\/strong>\u00a0The\u00a0<code>eth1<\/code>\u00a0network interface is assigned to VLAN1 by default, which in turn is assigned to switch port 4 by default. Further,\u00a0<code>eth1<\/code>\u00a0is also configured to be part of the virtual interface\u00a0<code>wan<\/code>. Configuring\u00a0<code>wan<\/code>\u00a0with a static ip address will provide another avenue to access the router using SSH. Finally, either of the wireless interfaces can be configured to enable wifi access as well.<\/p>\n<p>\uff12\uff0e<\/p>\n<\/div>\n<div>\n<p>OpenWrt\u7684\u7f51\u7edc\u914d\u7f6e\u5f88\u4e30\u5bcc\uff0c\u5728\u6211\u770b\u6765\u51e0\u4e4e\u53ef\u4ee5\u5b8c\u6210\u4efb\u4f55\u7f51\u7edc\u7ed3\u6784\u3002\u4e0b\u56fe\u4e3a\u4e00\u4e2a\u652f\u6301OpenWrt\u7684\u8def\u7531\u5668\u7f51\u7edc\u7ed3\u6784\uff1a\u8fd9\u4e2a\u8def\u7531\u5668\u5185\u90e8\u4ea4\u6362\u673a\u67096\u4e2a\u53e3\uff0c\u5176 \u4e2d1\u4e2aWAN\u53e3\u30014\u4e2aLAN\u53e3\u3001Port5\u9ed8\u8ba4\u8fde\u63a5\u5185\u90e8\u7f51\u5361eth0\uff0c\u8fd8\u6709\u8fde\u63a5Wifi\u7684\u65e0\u7ebf\u7f51\u5361\u63a5eth2\uff0ceth3\u4fdd\u7559\u3002<\/p>\n<p>\u4ece\u4e2d\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u8fd9\u4e2a\u8def\u7531\u5668\u6700\u591a\u652f\u63013\u4e2a\u7269\u7406\u7f51\u7edc\u63a5\u53e3eth0\u3001eth1\u3001eth2\u3002\u5176\u5b9e\u4e00\u822c\u8def\u7531\u5668\u6709\u4e24\u5f20\u4ee5\u592a\u7f51\u5361\u548c\u4e00\u5f20\u65e0\u7ebf\u7f51\u5361\uff0c\u4f46\u66f4\u591a\u7684\u8def\u7531\u5668\u91cc\u53ea\u6709\u4e00\u5f20\u4ee5\u592a\u7f51\u5361\u548c\u4e00\u5f20\u65e0\u7ebf\u7f51\u5361\u3002<\/p>\n<p><center><img decoding=\"async\" src=\"http:\/\/www.51cos.com\/wp-content\/uploads\/2016\/04\/7489c63841688d810d7b80e6e5db6f85.png\" alt=\"\" width=\"450\" \/><\/center>\u6700\u8ba9\u6211\u60ca\u5947\u7684\u662fOpenWrt\u7f51\u7edc\u7684\u7075\u6d3b\u6027\uff0c\u5b83\u4e3b\u8981\u9760<a href=\"http:\/\/en.wikipedia.org\/wiki\/Virtual_LAN\" target=\"_blank\">VLAN<\/a>\u548c(Bridging)<a href=\"http:\/\/wiki.openwrt.org\/doc\/networking\/network.interfaces#bridging\" target=\"_blank\">\u7f51\u6865<\/a>\u7b49\u5b9e\u73b0\u3002<\/p>\n<ul>\n<li>VLAN\u4e00\u822c\u8def\u7531\u5668\u4e3a\u8282\u7ea6\u6210\u672c\u53ea\u6709\u4e00\u5f20\u7f51\u5361\uff08\u6211\u7684\u7406\u89e3\u662f\u4ee5\u592a\u7f51\u63a7\u5236\u82af\u7247\uff09\uff0c\u4f46\u5982\u4f55\u63a5\u5165\u591a\u4e2a\u7f51\u7edc\u5462\uff1f\uff08\u8def\u7531\u5668\u6309\u5e38\u7406\u81f3\u5c11\u8981\u4e24\u5f20\u7f51\u5361\u5427\uff09\uff0c\u8fd9\u5c31\u662fVLAN\u7684\u529f\u52b3\u5566\u3002VLAN\uff08Virtual Local Area Network\uff09\u662f\u865a\u62df\u5c40\u57df\u7f51\u7f29\u5199\uff0c\u662f\u628a\u5c40\u57df\u7f51\u4e2d\u7684\u540c\u4e00\u5de5\u4f5c\u7ec4\u7684\u4e3b\u673a\u8fde\u5728\u4e00\u8d77\uff0c\u9694\u7edd\u4e0d\u540c\u7684\u5b50\u7f51\uff08\u5728\u4e00\u4e2a\u6216\u591a\u4e2a\u4ea4\u6362\u673a\u4e0a\uff09\uff0c\u8fd9\u79cd\u5c40\u9650\u589e\u5f3a\u4e86\u5de5\u4f5c\u7ec4\u95f4\u7684\u4fdd\u5bc6 \u6027\uff0c\u4e5f\u51cf\u5c11\u4e86\u5168\u9762\u5e7f\u64ad\u7684\u526f\u4f5c\u7528\u3002\u7528\u4e86VLAN\u4e5f\u5c31\u628a\u8fde\u63a5\u5b50\u7f51\u7528\u7684\u8def\u7531\u5668\u7ed9\u7701\u4e86\uff0c\u7701\u94b1\u800c\u4e14\u6548\u7387\u8fd8\u5f88\u9ad8\u3002VLAN\u9700\u8981\u8def\u7531\u5668\u5185\u7f6e\u7684\u4ea4\u6362\u673a\u652f\u6301\uff08\u4e00\u822c\u90fd\u652f\u6301\u5566\uff09\uff0c\u6700\u591a\u53ef\u4ee5\u5212\u52064096\u4e2aVLAN\u3002\u4e00\u822c\u4f7f\u7528\u53ea\u5212\u5206\u4e24\u4e2aVLAN\uff1aWAN\u548cLAN\uff0c\u5206\u522b\u5bf9\u5e94\u5916\u7f51\u548c\u5185\u7f51\u3002\u5982\u679c\u662f\u7eaf\u7cb9\u7684VLAN\uff0c\u5219WAN\u548cLAN\u4e4b\u95f4\u662f\u9694\u79bb\u7684\uff0c\u4e92\u76f8\u4e0d\u80fd\u901a\u4fe1\uff0c\u4f46\u5728\u81ea\u5df1\u7684VLAN\u91cc\u53ef\u4ee5\u81ea\u7531\u901a\u4fe1\u3002<\/li>\n<li>Trunking\u7528\u4e00\u5f20\u7f51\u5361\u600e\u4e48\u8fde\u63a5\u4e24\u4e2a\u7f51\u7edc\u5462\uff1f\u4e0d\u77e5\u4f60\u662f\u5426\u7559\u610f\u5230\u4e0a\u56fe\u4e2d\u7684Port5\uff0cPort5\u4e00\u8fb9\u8fde\u63a5\u8def\u7531\u5668\uff0c\u4e00\u8fb9\u8fde\u63a5\u7f51\u5361eth0\uff0c\u5b83\u7684\u4f5c\u7528\u5c31\u662f\u8fde\u63a5vlan0\u548cvlan1\u3002\u8fd9\u5c31\u662f\u91c7\u7528VLAN\u7684<a href=\"http:\/\/wiki.openwrt.org\/doc\/networking\/network.interfaces#vlan.trunking\" target=\"_blank\">Trunking<\/a>\u6280\u672f\uff0c\u5728Trunk Port(port5)<strong>\u7ecf\u8fc7\u7684\u4ee5\u592a\u7f51\u5e27\u4e0a\u6253\u6807\u7b7e(Tagging)\u7528\u4ee5\u533a\u5206\u6765\u81ea\u90a3\u4e2aVLAN\uff0c\u7136\u540e\u8def\u7531\u5668\u7528\u7f51\u5361eth0\u63a5\u6536\u5e76\u5904\u7406\u6807\u7b7e\u4ece\u800c\u5904\u7406\uff08\u5728CPU\u4e2d\u5904\u7406\uff09<\/strong>\uff0c\u8fd9\u5c31\u662f\u6240\u8c13\u7684<a href=\"http:\/\/www.visualland.net\/view.php?cid=872&amp;protocol=VLAN&amp;title=6.%20One-arm%20router&amp;ctype=1\" target=\"_blank\">\u5355\u81c2\u8def\u7531\u5668<\/a>\uff0c\u5f88\u5f62\u8c61\u554a:)\u3002<\/li>\n<li>Bridging\u7f51\u6865\u8bf4\u7a7f\u4e86\u5c31\u662f\u4ea4\u6362\u673a\uff0c\u5b83\u5c31\u662f\u7528\u8f6f\u4ef6\u6a21\u62df\u4ee5\u592a\u7f51\u4ea4\u6362\u673a\uff0c\u8fde\u63a5\u591a\u4e2a\u4ee5\u592a\u7f51\u7f51\u5361\uff08\u865a\u62df\u7684\u6216\u7269\u7406\u7684\uff09\u5206\u4eab\u540c\u4e00\u4e2aIP\u5b50\u7f51\u3002\u5728OpenWrt\u4e2d\uff0c\u7f51\u6865\u4e3b\u8981\u7528\u6765\u8fde\u63a5\u65e0\u7ebfWIFI\u7f51\u7edc\u548cLAN\uff0c\u7ec4\u6210\u4e00\u4e2a\u7edf\u4e00\u7684\u5185\u90e8\u5c40\u57df\u7f51\u3002<\/li>\n<\/ul>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u770b\u4e24\u5f20\u5e38\u7528\u7684\u8def\u7531\u5668\u7f51\u8def\u56fe\uff1a \u4e0d\u540c\u7684\u8def\u7531\u5668\u6709\u4e0d\u540c\u7684\u8bbe\u5b9a\u65b9\u6cd5\uff0c\u4e3e\u4f8b\uff1a br0\uff1aBridge 0 \uff0c\uff08\u6709\u7684\u4ee3\u8868vl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1749","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1749"}],"version-history":[{"count":8,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1749\/revisions"}],"predecessor-version":[{"id":1774,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1749\/revisions\/1774"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1749"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}