請問各位前輩~小弟依照網路上面架設 Wireguard,架好後Server端雖然可以 ping到客戶端2個封包,但後面就完全ping 不通了~有可能是哪需要注意的嗎?
作業系統:CentOS Linux release 7.7.1908 (Core)
Linux核心:Linux wireguard 4.20.13-1.el7.elrepo.x86_64
wireguard-tools-1.0.20191226-1.20191226-1.el7.x86_64s
wireguard-dkms-0.0.20200215.el7.noarch
以下是我的設定:
1、Server端,wg0.conf 設定檔
[Interface]
Address = 10.0.0.1/32 #不存在 Lan 內
SaveConfig = true
ListenPort = 51800
PrivateKey = oL2JOXMfamchjLXLgXZS4DDgIFvKq98D/IS8+7UeKEI=
[Peer]
PublicKey = c8HIlFtIiJvljZddm+TF8DcHyRitNfXCZQ2RNv52RhM=
AllowedIPs = 10.0.0.2/32
[Peer]
PublicKey = vw6Y2DLvXgF+4AUoBvtMxe082J/KecFORQesokcEO0I=
AllowedIPs = 10.0.0.3/32
2、Client端
[Interface]
PrivateKey = iLZ0b92Z733OS+GLeXcmDJ+S0o1sEVTCu82Bd8q7U3Y=
Address = 10.0.0.2/32 #不存在 Lan 內
DNS = 1.1.1.1
[Peer]
PublicKey = Eu10p9Ohd+mHlVKbjj9TXO1iOopPrztEkojsTBU8q14=
AllowedIPs = 10.0.0.1/32
Endpoint = Public IP:51800
PersistentKeepalive = 25
3、Firewall
firewall-cmd --zone=public --add-port=51800/udp --permanent
firewall-cmd --zone=public --add-masquerade
4、sysctl.conf 設定IP轉發並啟用
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.ip_forward=1
net.ipv4.tcp_syncookies=1
#啟用轉發
sysctl -p