I have successfully set up and run a Wireguard service on OpenWrt 22.03.5 (aarch64) using Phantun Server 0.6.0. However, I've recently encountered issues with network services connected via Phantun faketcp. While direct connections via Wireguard remain functional, attempts to access network services through Phantun faketcp have failed.
I used iperf3 to evaluate network performance and found that the first three packets sent from the server are not received correctly, but subsequent packets are received normally. Upon inspecting the packets with tcpdump, it appears there might be anomalies in their structure. Below are relevant logs with sensitive information redacted:
Server Log
~ RUST_LOG=TRACE /usr/bin/phantun_server --local 25379 --remote 127.0.0.1:25378
INFO server > Remote address is: 127.0.0.1:25378
INFO server > 4 cores available
TRACE mio::poll > registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
TRACE mio::poll > registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
TRACE mio::poll > registering event source with poller: token=Token(3), interests=READABLE | WRITABLE
TRACE mio::poll > registering event source with poller: token=Token(4), interests=READABLE | WRITABLE
DEBUG neli::socket > Message sent:
Nlmsghdr { nl_len: 64, nl_type: Newaddr, nl_flags: NlmFFlags(FlagBuffer(1, PhantomData)), nl_seq: 0, nl_pid: 0, nl_payload: Payload(Ifaddrmsg { ifa_family: Inet6, ifa_prefixlen: 128, ifa_flags: IfaFFlags(FlagBuffer(0, PhantomData)), ifa_scope: 0, ifa_index: 51, rtattrs: RtBuffer([Rtattr { rta_len: 20, rta_type: Local, rta_payload: Buffer }, Rtattr { rta_len: 20, rta_type: Address, rta_payload: Buffer }]) }) }
INFO server > Created TUN device tun0
INFO server > Listening on 25379
TRACE fake_tcp > Cache miss, checking the shared tuples table for connection
INFO fake_tcp > Sent SYN + ACK to client
TRACE fake_tcp > Cache miss, checking the shared tuples table for connection
TRACE fake_tcp > Storing connection information into local tuples
INFO fake_tcp > Connection from {MyClientPublicIP}:2890 established
INFO server > New connection: (Fake TCP connection from 192.168.201.2:25379 to {MyClientPublicIP}:2890)
TRACE mio::poll > registering event source with poller: token=Token(5), interests=READABLE | WRITABLE
TRACE mio::poll > deregistering event source from poller
TRACE mio::poll > registering event source with poller: token=Token(16777221), interests=READABLE | WRITABLE
TRACE mio::poll > registering event source with poller: token=Token(6), interests=READABLE | WRITABLE
TRACE mio::poll > registering event source with poller: token=Token(7), interests=READABLE | WRITABLE
TRACE mio::poll > registering event source with poller: token=Token(8), interests=READABLE | WRITABLE
Client Log
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: INFO client > Remote address is: {MyServerIP}:25379
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: INFO client > 8 cores available
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(3), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(4), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(5), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(6), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(7), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(8), interests=READABLE | WRITABLE
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: INFO client > Created TUN device tun0
1月 29 15:58:23 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(9), interests=READABLE | WRITABLE
1月 29 15:58:24 new-business-dev-001 phantun_client[3485905]: INFO client > New UDP client from 127.0.0.1:37885
1月 29 15:58:24 new-business-dev-001 phantun_client[3485905]: INFO fake_tcp > Sent SYN to server
1月 29 15:58:25 new-business-dev-001 phantun_client[3485905]: INFO fake_tcp > Waiting for SYN + ACK timed out
1月 29 15:58:25 new-business-dev-001 phantun_client[3485905]: INFO fake_tcp > Sent SYN to server
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: INFO fake_tcp > Waiting for SYN + ACK timed out
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: INFO fake_tcp > Sent SYN to server
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE fake_tcp > Cache miss, checking the shared tuples table for connection
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE fake_tcp > Storing connection information into local tuples
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: INFO fake_tcp > Connection to {MyServerIP}:25379 established
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: DEBUG client > inserted fake TCP socket into connection table
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(10), interests=READABLE | WRITABLE
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(11), interests=READABLE | WRITABLE
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(12), interests=READABLE | WRITABLE
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(13), interests=READABLE | WRITABLE
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(14), interests=READABLE | WRITABLE
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(15), interests=READABLE | WRITABLE
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(16), interests=READABLE | WRITABLE
1月 29 15:58:26 new-business-dev-001 phantun_client[3485905]: TRACE mio::poll > registering event source with poller: token=Token(17), interests=READABLE | WRITABLE
The issue was not with Phantun but with the upstream device responsible for port forwarding on my server. After restarting that device, everything is working fine now.
Server
RUST_LOG=TRACE /usr/bin/phantun_server --local 25379 --remote 127.0.0.1:25378
Client
RUST_LOG=TRACE /usr/bin/phantun_client -l 0.0.0.0:3334 -r {MyServerIP}:25379 -4
Anomalies
I have successfully set up and run a Wireguard service on OpenWrt 22.03.5 (aarch64) using Phantun Server 0.6.0. However, I've recently encountered issues with network services connected via Phantun faketcp. While direct connections via Wireguard remain functional, attempts to access network services through Phantun faketcp have failed.
I used iperf3 to evaluate network performance and found that the first three packets sent from the server are not received correctly, but subsequent packets are received normally. Upon inspecting the packets with tcpdump, it appears there might be anomalies in their structure. Below are relevant logs with sensitive information redacted:
Server Log
Client Log
Iperf3 log
Tcpdump log(First Three Entries for iperf3, complete log available here)