仕事で
特定の
Gentooの
https://wiki.gentoo.org/wiki/WireGuard
環境は
WireGuardはCONFIG_WIREGUARD
を
wireguard-tools
をwg
コマンドを
emerge -a net-vpn/wireguard-tools
net-misc/netifrc now has native support for wireguard and wg-quick is no longer required.
wireguard-tools
のwg-quick
コマンドでnetifrc
の
net-vpn/wireguard-tools -wg-quick
WireGuardの
今回は
配置は/etc/wireguard/wg0.conf
に
# /etc/wireguard/wg0.conf
# センシティブ情報は省略
[Interface]
PrivateKey =
[Peer]
PublicKey =
Endpoint =
AllowedIPs =
Remove "Address" and "DNS" from wg0.conf, because they won't be recognized by net-misc/netifrc.
netifrc
は[Interface]
のAddress
とDNS
は/etc/conf.d/net
で
Wikiでは
今回は[VPN経由にしたいアドレス]
はwg.conf
の[Peer]
内のAllowedIPs
と
# /etc/conf.d/net
wireguard_wg0="/etc/wireguard/wg0.conf"
config_wg0="[Interface]のAddress部分"
postup() {
if [ "${IFACE}" == "wg0" ];
then
ip route add [VPN経由にしたいアドレス] dev wg0 || exit 1
fi
return 0
}
predown() {
if [ "${IFACE}" == "wg0" ];
then
ip route del [VPN経由にしたいアドレス] dev wg0 || exit 1
fi
return 0
}
最後にsymlink
を
ln -s /etc/init.d/net.lo /etc/init.d/net.wg0
たまに
rc-service net.wg0 start