{"id":188,"date":"2011-06-01T11:31:25","date_gmt":"2011-06-01T03:31:25","guid":{"rendered":"http:\/\/cowman-chiang.no-ip.org\/wordpress\/?p=188"},"modified":"2023-10-31T15:50:53","modified_gmt":"2023-10-31T07:50:53","slug":"bridge-firewall-%e7%ad%86%e8%a8%98-br-boot-sh","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=188","title":{"rendered":"Bridge Firewall \u7b46\u8a18 &#8211; br-boot.sh"},"content":{"rendered":"<h1>br-boot.sh (\u958b\u6a5f\u6642\u5efa\u7acbbridge firewall)<\/h1>\n<pre>\n#!\/bin\/bash\n# \u5ba3\u544a\u4f7f\u7528\u6307\u4ee4\u4e4b\u8def\u5f91\nIPTABLES=\"\/sbin\/iptables\"   \nBRCTL=\"\/usr\/sbin\/brctl\"\nIFCONFIG=\"\/sbin\/ifconfig\"\nROUTE=\"\/sbin\/route\"\n<!--more-->\n# \u5ba3\u544a\u6b32\u8a2d\u5b9a\u4e4bip\u8cc7\u8a0a\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# \u5ba3\u544a\u6b32\u4f7f\u7528\u4e4b\u4ecb\u9762\u540d\u7a31\nFW_IFACE=\"br0\"\n\n$BRCTL addbr br0         #\u65b0\u589e\u4e00bridge\u7db2\u8def\u4ecb\u9762br0\n$BRCTL addif br0 eth0    #\u5c07eth0\u52a0\u5165br0\u5167\n$BRCTL addif br0 eth1    #\u5c07eth1\u52a0\u5165br0\u5167\n$BRCTL addif br0 eth3    #\u5c07eth3\u52a0\u5165br0\u5167\n\n# \u5148\u95dc\u9589\u9019\u4e09\u7d44\u7db2\u8def\u4ecb\u9762\uff0c\u6e96\u5099\u8a2d\u5b9aip\n$IFCONFIG br0 down\n$IFCONFIG eth0 down\n$IFCONFIG eth1 down\n$IFCONFIG eth3 down\n\n$IFCONFIG eth0 0.0.0.0         #eth0\u672c\u8eab\u4e0d\u5e36ip\n$IFCONFIG eth1 192.168.1.11    #eth1\u5e36192.168.1.11\uff0c\u8207\u8a2d\u5b9a\u7684vmware\u7cfb\u7d71\u53ef\u4ee5\u4e92\u901a\n$IFCONFIG eth2 192.168.163.1   #eth2\u5e36192.168.163.1\uff0c\u7528\u4f86\u8207\u5099\u63f4firewall\u4e92\u901a\u5075\u6e2c\n$IFCONFIG eth3 0.0.0.0         #eth3\u672c\u8eab\u4e0d\u5e36ip\n# \u8a2d\u5b9abridge\u4ecb\u9762ip\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\uff0c\u91cd\u8981\necho \"1\" > \/proc\/sys\/net\/ipv4\/ip_forward\n# \u56e0\u70ba\u5efa\u7acbbridge\u9700\u8981\u6642\u9593\uff0c\u7b4910\u79d2\u5f8c\u555f\u52d5detect.sh\nsleep 10s \n\n\/bin\/sh \/br-fw\/detect.sh &bg <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>br-boot.sh (\u958b\u6a5f\u6642\u5efa\u7acbbridge firewall) #!\/bin\/bash # \u5ba3\u544a\u4f7f\u7528\u6307\u4ee4\u4e4b\u8def\u5f91 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-188","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\/188","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=188"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":2345,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/188\/revisions\/2345"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}