
次の設定が必要です
client gw with openvpn ntp server
192.168.10.82 ----> eth0 192.168.10.1 - tun0 10.8.0.46 ---> 10.8.0.1
.82 に OpenVPN クライアントをインストールできない
.82 が 192.168.10.1 に ntp を要求し、192.168.10.1 が tun0 インターフェイス 10.8.0.46 を介して 10.8.0.1 に質問をルーティングし、その後 .82 に応答するようにします。
私のiptables設定は以下の通りです
# Generated by iptables-save v1.8.4 on Sun Jan 3 22:29:42 2021
*filter
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:INPUT DROP [0:0]
# Accept traffic from internal interfaces
-A INPUT ! -i eth1 -j ACCEPT
# Accept traffic with the ACK flag set
-A INPUT -p tcp -m tcp --tcp-flags ACK ACK -j ACCEPT
# Allow incoming data that is part of a connection we established
-A INPUT -m state --state ESTABLISHED -j ACCEPT
# Allow data that is related to existing connections
-A INPUT -m state --state RELATED -j ACCEPT
# Accept responses to DNS queries
-A INPUT -p udp -m udp --dport 1024:65535 --sport 53 -j ACCEPT
# Accept responses to our pings
-A INPUT -p icmp -m icmp --icmp-type echo-reply -j ACCEPT
# Accept notifications of unreachable hosts
-A INPUT -p icmp -m icmp --icmp-type destination-unreachable -j ACCEPT
# Accept notifications to reduce sending speed
-A INPUT -p icmp -m icmp --icmp-type source-quench -j ACCEPT
# Accept notifications of lost packets
-A INPUT -p icmp -m icmp --icmp-type time-exceeded -j ACCEPT
# Accept notifications of protocol problems
-A INPUT -p icmp -m icmp --icmp-type parameter-problem -j ACCEPT
COMMIT
# Completed on Sun Jan 3 22:29:42 2021
# Generated by iptables-save v1.8.4 on Sun Jan 3 22:29:42 2021
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed on Sun Jan 3 22:29:42 2021
# Generated by iptables-save v1.8.4 on Sun Jan 3 22:29:42 2021
*nat
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
# eth0 to 4g dongle
-A POSTROUTING -o eth1 -j MASQUERADE
次の行を試しても機能しません:
-A PREROUTING -i eth0 -p udp --dport 123 -j DNAT --to-destination 10.8.0.1:123
-A POSTROUTING -o tun0 -p udp --dport 123 -d 10.8.0.1 -j SNAT --to-source 10.8.0.46
何か提案はありますか?ありがとう
答え1
Tom Yan の最初の返信が解決策です。その後の議論は、私が間違った iptables 構成ファイルを編集したせいです。