34 lines
778 B
Bash
34 lines
778 B
Bash
#!/bin/sh
|
|
|
|
tun_iface=tun0
|
|
rtable_id_ingress=100
|
|
rtable_id_egress=101
|
|
|
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
|
echo 0 > /proc/sys/net/ipv4/tcp_window_scaling
|
|
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
|
|
sysctl -w net.ipv4.conf.default.rp_filter=0
|
|
|
|
ethtool -K p7p1 lro off
|
|
ethtool -K p7p1 tso off
|
|
ethtool -K p7p1 gro off
|
|
|
|
ethtool -K em2 lro off
|
|
ethtool -K em2 tso off
|
|
ethtool -K em2 gro off
|
|
|
|
# Create TUN devices
|
|
ip tuntap add dev ${tun_iface} mode tun multi_queue
|
|
ifconfig ${tun_iface} up
|
|
|
|
# Ingress
|
|
ip rule add iif ${tun_iface} tab ${rtable_id_ingress}
|
|
ip route add local 0.0.0.0/0 dev lo table ${rtable_id_ingress}
|
|
|
|
# Egress
|
|
ip rule add fwmark 0x65 lookup ${rtable_id_egress}
|
|
ip route add default dev ${tun_iface} table ${rtable_id_egress}
|
|
|
|
# Flush cache
|
|
ip route flush cache
|