w! ! ! i @@@@ re ___ g $$$ u ¥¥¥ a ----- rd use

1. Compiling and Installing

  Normally make, make install on the line.

  It should be noted:

(1) gcc seems to be at least 4.8 (It should be possible to upgrade the kernel)

(2) To libmnl.so, I was under centos6.5 environment

(3) Since relates to compile the driver module, it is necessary to develop the kernel package (Note Makefile kernel development kit correct path)

 

2. Use

Generate a key pair and the general profile, multi-line, not tired out.

(1) server (environment debain9)

After a successful start, to achieve xx function, need to open the IP forwarding and data forwarding

IP Forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

Data Forwarding

iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A the INPUT -p UDP UDP --dport -m <Server port number> -m --ctstate the conntrack NEW - J ACCEPT
iptables -A the INPUT -s 10.200 . 200.0 / 24 (the tunnel segment) -p -m TCP TCP --dport 53 is -m --ctstate the conntrack NEW - J ACCEPT
iptables -A INPUT -s 10.200.200.0/24 -p udp -m udp --dport 53 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -i wg0 -o wg0 -m conntrack --ctstate NEW -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.200.200.0/24 -o eth0 -j MASQUERADE

 

(2) the client (environment centos6.5)

After a successful installation, you can not use wg-quick start the client, use the command to start their own

sudo ip link add dev wg0 type w__i@@@r!!e__g¥¥¥u$$$a%%%r**d 
sudo ip address add dev wg0 10.100.0.101/24
sudo ip link set wg0 up
sudo wg setconf wg0 /etc/wi@@@r$$$$e###g@@@ua¥¥¥¥r$$$d/wg0.conf

Then add routing rules

sudo route add -host <VPS IP> gw <本机网关>
sudo route del default
sudo route add default dev wg0

 

Close Use

sudo ip link del dev wg0

In the changes back to the normal route

 

Please forgive those strange symbols, write is my greatest courage:)

Guess you like

Origin www.cnblogs.com/yangxinrui/p/12227747.html