Skip to content

Instantly share code, notes, and snippets.

@you21979
Last active December 17, 2015 07:49
Show Gist options
  • Save you21979/5575706 to your computer and use it in GitHub Desktop.
Save you21979/5575706 to your computer and use it in GitHub Desktop.
L2ブリッジ用のMACフィルター
DEVICE=br0
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
DELAY=0
STP=off
DEVICE="eth1"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
BOOTPROTO="none"
BRIDGE=br0
#!/bin/bash
# ファイアウォール停止(すべてのルールをクリア)
/etc/init.d/iptables stop
iptables -F
iptables -t nat -F
# デフォルトルール(以降のルールにマッチしなかった場合に適用するルール)設定
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -N chk_mac
for macaddr in `cat /root/MAC_LIST/pc.txt`
do
iptables -A chk_mac -m mac --mac-source $macaddr -j RETURN
done
iptables -A chk_mac -j LOG --log-prefix "nonregistered MAC addr "
iptables -A chk_mac -j DROP
iptables -A FORWARD -m physdev --physdev-in eth1 -j chk_mac
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
@you21979
Copy link
Author

VMWAREを使用してる時は管理ツールから仮想スイッチのセキュリティの設定で無差別モードを承諾するにする

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment