Bring up wireguard interface with wg script: Difference between revisions
From AcrodusWiki
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
wg_acrodus_up.sh | wg_acrodus_up.sh | ||
<pre> | |||
#!/bin/bash | #!/bin/bash | ||
Line 17: | Line 19: | ||
ip -6 route add ::/0 dev wg0 table 51821 | ip -6 route add ::/0 dev wg0 table 51821 | ||
</pre> | |||
wg_acrodus.conf | wg_acrodus.conf |
Revision as of 16:03, 18 November 2024
This is the example script and associated config file for the vpn client. This was connecting to a vpn server hosted on the home network.
wg_acrodus_up.sh
#!/bin/bash ip l add dev wg0 type wireguard wg setconf wg0 wg_acrodus.conf ip a add 10.0.0.2/32 dev wg0 ip l set dev wg0 up wg set wg0 fwmark 51821 ip -4 rule add not fwmark 51821 table 51821 ip -4 route add 0.0.0.0/0 dev wg0 table 51821 ip -6 rule add not fwmark 51821 table 51821 ip -6 route add ::/0 dev wg0 table 51821
wg_acrodus.conf [Interface] PrivateKey = KMbtL28SVof35/RM9/aqFvbpuSH4PRpuzDGtfq9UhXQ= ListenPort = 51821 fwMark = 51821
[Peer] PublicKey = cNfZAhVdRi83k35yHOF9rFeOk9KT94vvSj1ALw8GSnE= AllowedIPs = 0.0.0.0/0, 0::/0 EndPoint = vpn.acrodus.uk:51821 PersistentKeepalive = 10
A note to future Alex, wg-quick .conf files have different parameters to wg .conf files. Also remember the importance of the fwmark.