{"id":213,"date":"2011-06-01T12:14:32","date_gmt":"2011-06-01T04:14:32","guid":{"rendered":"http:\/\/cowman-chiang.no-ip.org\/wordpress\/?p=213"},"modified":"2023-10-31T15:50:52","modified_gmt":"2023-10-31T07:50:52","slug":"bridge-firewall-%e7%ad%86%e8%a8%98-br-add-sh-%e5%82%99%e6%8f%b4","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=213","title":{"rendered":"Bridge Firewall \u7b46\u8a18 &#8211; br-add.sh (\u5099\u63f4)"},"content":{"rendered":"<h1>br-add.sh (\u5efa\u7acb\u672c\u6a5fbridge)<\/h1>\n<pre>#!\/bin\/bash\n# \u5ba3\u544a\u4f7f\u7528\u6307\u4ee4\u4e4b\u8def\u5f91\nIPTABLES=\"\/sbin\/iptables\"\n\n<!--more-->\n\nBRCTL=\"\/usr\/sbin\/brctl\"\nIFCONFIG=\"\/sbin\/ifconfig\"\nROUTE=\"\/sbin\/route\"\n# \u5ba3\u544a\u6b32\u8a2d\u5b9a\u4e4bip\u8cc7\u8a0a\nBRIP=\"X.X.X.X\"\nFW_IP=\"X.X.X.X\"\nBRMASK=\"X.X.X.X\"\nGATEWAY=\"X.X.X.X\"\nBRBROADCAST=\"X.X.X.X\"\n# \u5ba3\u544a\u6b32\u4f7f\u7528\u4e4b\u4ecb\u9762\u540d\u7a31\nFW_IFACE=\"br0\"\n\n$BRCTL addbr br0\n$BRCTL addif br0 eth0\n$BRCTL addif br0 eth1\n$BRCTL addif br0 eth3\n\n# \u5148\u95dc\u9589\u9019\u4e09\u7d44\u7db2\u8def\u4ecb\u9762\n$IFCONFIG br0 down\n$IFCONFIG eth0 down\n$IFCONFIG eth1 down\n$IFCONFIG eth3 down\n\n$IFCONFIG eth0 0.0.0.0\n$IFCONFIG eth1 192.168.1.14\n$IFCONFIG eth3 0.0.0.0\n\n$IFCONFIG br0 $BRIP netmask $BRMASK broadcast $BRBROADCAST\n# \u8a2d\u5b9a gateway \u503c\uff0c\u4f7f fw \u672c\u8eab\u53ef\u4ee5\u4e0a\u7db2\u3000\n$ROUTE add default gw $GATEWAY\n\n# \u555f\u52d5\u5c01\u5305\u8f49\u9001\necho \"1\" &gt; \/proc\/sys\/net\/ipv4\/ip_forward<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>br-add.sh (\u5efa\u7acb\u672c\u6a5fbridge) #!\/bin\/bash # \u5ba3\u544a\u4f7f\u7528\u6307\u4ee4\u4e4b\u8def\u5f91 IPTABLES=&#8221;\/sbin\/iptables&#8221;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58,8],"tags":[],"class_list":["post-213","post","type-post","status-publish","format-standard","hentry","category-linux","category-network"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=213"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/213\/revisions"}],"predecessor-version":[{"id":2340,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/213\/revisions\/2340"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}