Unreachabe when using SCNetworkReachabilityCreateWithAddressPair with VPN service

I am testing a local vpn service using NEPacketTunnelNetworkSettings that currently use the IP of the underlying network interface (WiFi or Cellular) as the IP of the VPN interface.


However, when I use SCNetworkReachabilityCreateWithAddressPair and set the IP of VPN interface as the local address, the result is unreachable

    var addr = sockaddr_in()
    addr.sin_len = UInt8(MemoryLayout.size(ofValue: addr))
    addr.sin_family = sa_family_t(AF_INET)
    addr.sin_addr.s_addr = inet_addr(address)
   
    let hostAddress = withUnsafePointer(to: &hostaddr) {
        $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
            return $0
        }
    }
   
    guard let reachability = withUnsafePointer(to: &addr, {
        $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
            SCNetworkReachabilityCreateWithAddressPair(kCFAllocatorDefault, $0, hostAddress)
        }
    })else{
        return false
    }


Can anybody tell me why that happens and how to workaround?