This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-kni/bin/kni_set_cmd
liuyang e7bf4a2001 20180710:
1、将IP_ENTRY改为TCPALL_ENTRY
2、将iptables规则在脚本中设置,不再代码中设置;
2018-07-10 09:32:18 +08:00

33 lines
828 B
Bash

#!/bin/sh
# cd /home/liuyang/src/forge_socket-master/;insmod forge_socket.ko
#ip tuntap add dev tun0 mode tun
#ifconfig tun0 up
echo 1 > /proc/sys/net/ipv4/ip_forward
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
ip tuntap add dev tun0 mode tun multi_queue
ifconfig tun0 up
route add default dev tun0
iptables -F -t mangle
iptables -t mangle -N DIVERT
iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
iptables -t mangle -A DIVERT -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
ip rule add fwmark 1 lookup 100
#ip route add local 0.0.0.0/0 dev tun0 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -A PREROUTING -p tcp -i tun0 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 50080