Find all surjective functions $f: \mathbb{N}\to \mathbb{N}$ such that for all $m,n\in \mathbb{N}$: \[m \vert n \Longleftrightarrow f(m) \vert f(n).\]
1. **Observation and Initial Condition**:
   - Given that \( f \) is surjective, for any \( n \in \mathbb{N} \), there exists some \( m \in \mathbb{N} \) such that \( f(m) = n \).
   - Since \( f \) is surjective and \( m \mid n \Longleftrightarrow f(m) \mid f(n) \), we start by considering \( n = 1 \). The only \( m \) such that \( m \mid 1 \) is \( m = 1 \). Therefore, \( f(1) = 1 \).

2. **Behavior on Primes**:
   - Consider any prime \( p \). Since \( p \) has only two divisors (1 and \( p \)), \( f(p) \) must also have only two divisors. Hence, \( f(p) \) must be a prime number.
   - Define a function \( g \) that maps primes to primes such that \( f(p) = g(p) \) for all primes \( p \). Since \( f \) is surjective, \( g \) must be a bijection on the set of primes.

3. **Induction on Prime Powers**:
   - We use strong induction to show that \( f(p^k) = g(p)^k \) for all positive integers \( k \).
   - **Base Case**: For \( k = 1 \), we have \( f(p) = g(p) \), which is true by definition.
   - **Inductive Step**: Assume \( f(p^j) = g(p)^j \) for all \( j \leq k \). We need to show \( f(p^{k+1}) = g(p)^{k+1} \).
     - \( f(p^{k+1}) \) must be divisible by \( 1, g(p), g(p)^2, \ldots, g(p)^k \) and itself, but no other primes.
     - The number of divisors of \( f(p^{k+1}) \) must be \( k+2 \) (since \( \tau(p^{k+1}) = k+2 \)).
     - If \( f(p^{k+1}) \) had any prime factors other than \( g(p) \), the number of divisors would exceed \( k+2 \), which is a contradiction.
     - Therefore, \( f(p^{k+1}) \) must be \( g(p)^{k+1} \).

4. **General Case for Natural Numbers**:
   - Suppose \( n \) is any positive integer and \( p \) is a prime that does not divide \( n \). We need to show \( f(n)f(p^k) = f(np^k) \) for all positive integers \( k \).
   - Since \( (n, p^k) = 1 \), we have \( \tau(n) \tau(p^k) = \tau(np^k) \).
   - We know \( g(p)^k \mid f(np^k) \) and \( g(p) \nmid f(n) \). Thus, all divisors of \( f(n) \) divide \( f(np^k) \), and \( g(p)^k \) divides \( f(np^k) \) as well.
   - The number of divisors of \( f(n)g(p)^k \) is \( \tau(f(n)) \tau(g(p)^k) = \tau(n) \tau(p^k) = \tau(np^k) \).
   - If \( f(np^k) \) had any other divisors, \( \tau(f(np^k)) \) would exceed \( \tau(f(n)g(p)^k) \), which is a contradiction.
   - Therefore, \( f(np^k) = f(n)g(p)^k = f(n)f(p^k) \).

5. **Conclusion**:
   - Since we have defined \( f \) for all prime powers and shown that \( f \) respects the multiplicative property for coprime numbers, the function \( f \) is completely determined by the bijection \( g \) on primes.
   - Thus, the function \( f \) can be written as \( f(n) = g(p_1)^{e_1} g(p_2)^{e_2} \cdots g(p_k)^{e_k} \) where \( n = p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k} \) is the prime factorization of \( n \).

The final answer is \( \boxed{ f(n) = g(p_1)^{e_1} g(p_2)^{e_2} \cdots g(p_k)^{e_k} } \) where \( g \) is a bijection on the set of primes.