Created
August 30, 2022 01:08
-
-
Save imlk0/a2074e5ecab50b3232b08f757af20762 to your computer and use it in GitHub Desktop.
Revisions
-
imlk0 created this gist
Aug 30, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ #!/bin/sh # imlk: setup ipv6 bridge while ipv4 is nat mode. see https://jethro.fun/index.php/archives/162/ logger -t imlk-ebtables-ipv6 "hotplugin event: $INTERFACE -> $ACTION" if [[ "$INTERFACE" != "wan" ]]; then exit fi case "$ACTION" in ifup) logger -t imlk-ebtables-ipv6 "setup ipv6 passthrough ..." # force non-ipv6 packet to be routed ebtables -t broute -A BROUTING -p ! ipv6 -j DROP -i eth0.2 # drop some bad devices in UCAS ebtables -t filter -A FORWARD --src 5c:02:14:73:1c:b6 -j DROP ebtables -t filter -A FORWARD --src 8c:de:f9:ec:92:be -j DROP ebtables -t filter -A FORWARD --src 54:ee:75:f2:85:12 -j DROP brctl addif br-lan eth0.2 logger -t imlk-ebtables-ipv6 "setup ipv6 passthrough done!" ;; ifdown) logger -t imlk-ebtables-ipv6 "revert ipv6 passthrough ..." brctl delif br-lan eth0.2 ebtables -t broute -D BROUTING -p ! ipv6 -j DROP -i eth0.2 logger -t imlk-ebtables-ipv6 "revert ipv6 passthrough done!" ;; esac