You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
890 B

DEV_NAME=wg0
INTERFACE_IP=10.13.13.2/16
INTERFACE_IProute=10.13.13.2
ENDPOINT_IP=83.212.77.133
ip link set $DEV_NAME down
ip link del $DEV_NAME
# add wireguard interface
ip link add $DEV_NAME type wireguard
# set wireguard conf
wg setconf $DEV_NAME /data/appl/ok/swarmlab-hybrid-agent/src-local/hybrid/connect/$DEV_NAME.conf
# assign ip to wireguard interface
ip addr add $INTERFACE_IP dev $DEV_NAME
# set sysctl
sysctl -w net.ipv4.conf.all.rp_filter=2
# set mtu for wireguard interface
ip link set mtu 1420 up dev $DEV_NAME
# bring wireguard interface up
ip link set up dev $DEV_NAME
# add route
ip route add default via $INTERFACE_IProute metric 2 table 200
ip route show table 200 | grep -w $INTERFACE_IProute
# add local lan route
ip rule add table main suppress_prefixlength 0
ip rule show | grep -w "suppress_prefixlength"