{"id":190,"date":"2011-06-01T11:32:50","date_gmt":"2011-06-01T03:32:50","guid":{"rendered":"http:\/\/cowman-chiang.no-ip.org\/wordpress\/?p=190"},"modified":"2023-10-31T15:50:53","modified_gmt":"2023-10-31T07:50:53","slug":"bridge-firewall-%e7%ad%86%e8%a8%98-br-sh","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=190","title":{"rendered":"Bridge Firewall \u7b46\u8a18 &#8211; br.sh"},"content":{"rendered":"<h1>br.sh (\u7db2\u8def\u7570\u5e38\u6062\u5fa9\u5f8c\u91cd\u65b0\u5efa\u7acbbridge firewall\uff0c\u8207\u524d\u8005\u5dee\u7570\u65bc\u6700\u5f8c\u4e00\u884c\u547c\u53ebdetect.sh)<\/h1>\n<pre>\n#!\/bin\/bash\n\nIPTABLES=\"\/sbin\/iptables\"\nBRCTL=\"\/usr\/sbin\/brctl\"\nIFCONFIG=\"\/sbin\/ifconfig\"\nROUTE=\"\/sbin\/route\"\n<!--more-->\nBRIP=\"163.28.192.135\"\nFW_IP=\"163.28.192.135\"\nBRMASK=\"255.255.255.0\"\nGATEWAY=\"163.28.192.254\"\nBRBROADCAST=\"163.28.192.255\"\n\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.11\n$IFCONFIG eth2 192.168.163.1\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\" > \/proc\/sys\/net\/ipv4\/ip_forward\n\nsleep 10s\n# \u6b64\u8655\u4e0d\u80fdenable\uff0c\u6703\u9020\u6210\u7121\u9650detect.sh\u8ff4\u5708\n#\/bin\/sh \/br-fw\/detect.sh &bg<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>br.sh (\u7db2\u8def\u7570\u5e38\u6062\u5fa9\u5f8c\u91cd\u65b0\u5efa\u7acbbridge firewall\uff0c\u8207\u524d\u8005\u5dee\u7570\u65bc\u6700\u5f8c\u4e00\u884c\u547c\u53ebdetect.sh) #!\/bin\/bash IPTABLES=&#8221;\/sbin\/iptables&#8221; BRCTL=&#8221;\/usr\/sbin\/brctl&#8221; IFCONFIG=&#8221;\/sbin\/ifconfig&#8221; ROUTE=&#8221;\/sbin\/route&#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-190","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\/190","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=190"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":2344,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/190\/revisions\/2344"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}