Created
August 30, 2018 10:14
-
-
Save ljjjustin/255a4954eb6e5aa4329c1146167f7f98 to your computer and use it in GitHub Desktop.
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 characters
| #!/bin/bash | |
| SRCBR=br-int | |
| PPORT=patch-tun | |
| TAP=tap-${SRCBR} | |
| OLD_PS1="$PS1" | |
| cleanup() { | |
| ovs-vsctl clear bridge ${SRCBR} mirrors | |
| ovs-vsctl del-port ${SRCBR} $TAP | |
| ip link del dev $TAP | |
| export PS1="$OLD_PS1" | |
| } | |
| trap "cleanup" EXIT | |
| ip link add name $TAP type dummy | |
| ip link set dev $TAP up | |
| ovs-vsctl add-port ${SRCBR} $TAP | |
| ovs-vsctl -- --id=@dst get Port $TAP \ | |
| -- --id=@src get Port ${PPORT} \ | |
| -- --id=@m create Mirror name=$TAP select_dst_port=@src output_port=@dst \ | |
| -- set Bridge ${SRCBR} mirrors=@m | |
| ovs-vsctl list mirror | |
| echo "tcpdump -pni $TAP" | |
| export PS1="tcpdump > " && bash |
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 characters
| #!/bin/bash | |
| SRCBR=br-tun | |
| PPORT=patch-int | |
| TAP=tap-${SRCBR} | |
| OLD_PS1="$PS1" | |
| cleanup() { | |
| ovs-vsctl clear bridge ${SRCBR} mirrors | |
| ovs-vsctl del-port ${SRCBR} $TAP | |
| ip link del dev $TAP | |
| export PS1="$OLD_PS1" | |
| } | |
| trap "cleanup" EXIT | |
| ip link add name $TAP type dummy | |
| ip link set dev $TAP up | |
| ovs-vsctl add-port ${SRCBR} $TAP | |
| ovs-vsctl -- --id=@dst get Port $TAP \ | |
| -- --id=@src get Port ${PPORT} \ | |
| -- --id=@m create Mirror name=$TAP select_dst_port=@src output_port=@dst \ | |
| -- set Bridge ${SRCBR} mirrors=@m | |
| ovs-vsctl list mirror | |
| echo "tcpdump -pni $TAP" | |
| export PS1="tcpdump > " && bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment