-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to tc mirrored to get rid of macvtap (#110)
- Loading branch information
1 parent
3ae7f59
commit 0e7c0a8
Showing
3 changed files
with
32 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Script is taken from https://netdevops.me/2021/transparently-redirecting-packets/frames-between-interfaces/ | ||
# Script is taken from https://netdevops.me/2021/transparently-redirecting-packetsframes-between-interfaces/ | ||
# Read it for better understanding | ||
|
||
set -o errexit | ||
TAP_IF=$1 | ||
# get interface index number up to 3 digits (everything after first three chars) | ||
# tap0 -> 0 | ||
# tap123 -> 123 | ||
INDEX=${TAP_IF:3:3} | ||
|
||
ip link set $TAP_IF up | ||
ip link set $TAP_IF mtu 65000 | ||
|
||
# create tc lan<->tap redirect rules | ||
tc qdisc add dev lan$INDEX ingress | ||
tc filter add dev lan$INDEX parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev $TAP_IF | ||
|
||
tc qdisc add dev $TAP_IF ingress | ||
tc filter add dev $TAP_IF parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev lan$INDEX |
This file contains 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