Bridge Firewall 筆記 – br-del.sh (備援)

br-del.sh (移除本機bridge)

#!/bin/bash

IPTABLES="/sbin/iptables"



BRCTL="/usr/sbin/brctl"
IFCONFIG="/sbin/ifconfig"
ROUTE="/sbin/route"

BRIP="X.X.X.X"
FW_IP="X.X.X.X"
BRMASK="X.X.X.X"
GATEWAY="X.X.X.X"
BRBROADCAST="X.X.X.X"

FW_IFACE="br0"

$IFCONFIG br0 down
$IFCONFIG eth0 down
$IFCONFIG eth1 down
$IFCONFIG eth3 down

$BRCTL delbr br0

$IFCONFIG eth3 $BRIP netmask $BRMASK broadcast $BRBROADCAST
# 設定 gateway 值,使 fw 本身可以上網 
$ROUTE add default gw $GATEWAY

# 啟動封包轉送
echo "1" > /proc/sys/net/ipv4/ip_forward
This entry was posted in Linux, Network. Bookmark the permalink.