Files moved from scripts.
This commit is contained in:
45
service/tun2socks_pre.sh
Normal file
45
service/tun2socks_pre.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
NETNS=soghancq
|
||||
IP=/sbin/ip
|
||||
NS="$IP netns exec $NETNS"
|
||||
|
||||
#
|
||||
# Set ip forwarding.
|
||||
# Do it from /ete/sysctl.conf
|
||||
#sysctl -w net.ipv4.ip_forward=1
|
||||
|
||||
#
|
||||
# Create network namesapce.
|
||||
#
|
||||
$IP netns add $NETNS
|
||||
|
||||
#
|
||||
# Peer to peer to default namespace.
|
||||
#
|
||||
$IP link add veth0 type veth peer name veth1
|
||||
$IP addr add 10.1.1.1/30 dev veth0
|
||||
$IP link set veth0 up
|
||||
|
||||
$IP link set veth1 netns $NETNS
|
||||
$NS $IP addr add 10.1.1.2/30 dev veth1
|
||||
$NS $IP link set veth1 up
|
||||
$NS $IP route add 127.0.0.0/24 via 10.1.1.1 metric 5
|
||||
$NS $IP route add 192.168.0.0/24 via 10.1.1.1 metric 5
|
||||
#$NS $IP route add 8.8.8.8 via 10.1.1.1 metric 5
|
||||
|
||||
#
|
||||
# Configure tun0 which goes through socks5.
|
||||
#
|
||||
$NS $IP tuntap add dev tun0 mode tun user root
|
||||
$IP link set tun0 netns $NETNS
|
||||
$NS $IP addr add 10.0.0.1/24 dev tun0
|
||||
$NS $IP link set dev tun0 up
|
||||
$NS $IP route add default via 10.0.0.2 metric 6
|
||||
#$NS /usr/local/sbin/tun2socks \
|
||||
# --tundev tun0 \
|
||||
# --netif-ipaddr 10.0.0.2 \
|
||||
# --netif-netmask 255.255.255.0 \
|
||||
# --socks-server-addr 127.0.0.1:1080 \
|
||||
# --udpgw-remote-server-addr 127.0.0.1:7300 &
|
||||
|
||||
Reference in New Issue
Block a user