Probability of IP address with all digits occuring exactly once I just realized that my IP address have all digits from $1$ to $9$ occurring exactly once, e.g. $91.745.86.23$ (though that is not my real address). Just for fun, could anyone help me calculate the probability of that happening, assuming that all IP addresses have the same probability? I could probably brute force it with a Python script, but I'm interested in how one would do it analytically.

It might be obvious, but remember that each field in an IP address range from $0$ to $255$.
The question can be reformulated to: If we 'concatenate' four numbers between 0 and 255, what's the chance the resulting number contains each of the digits 1 to 9 exactly once.

To answer this question, we need to count all possible permutations of the numbers 1 to 9. In order to get nine digits, the IP address has to either contain three two-digit numbers and one three-digit number, or two three-digit numbers, a two-digit number and a one-digit number. All three-digit numbers have to start with 1 or 2.

Case 1

There is one three-digit number. If it starts with 1, we can distribute the numbers 2 to 9 over the eight other positions, yielding $4\cdot8!$ options (times 4, since the three-digit number can be on any of the four positions). Counting the options starting with 2 is a bit harder. There are 24 three-digit numbers in $\{0,\ldots,255\}$ that can occur, starting with 2. This then leaves 6 digits that can be distributed in any possible way over the remaining 6 spots. As a result, there are $4\cdot24\cdot6!$ of these options.

Case 2

Since there are two three-digit numbers involved, we know one of these has to start with 1 and one of these has to start with 2. Omitting all three-digit numbers starting with 2 and containg 1 from the 24 mentioned in case 1, 14 remain (the lowest being 234). In each case, 4 out of 9 digits are known and the other 5 can be filled in any way we like. We now need to determine the number of orders for these blocks (the three-digit number starting with 1, the three-digit number starting with 2, the two-digit number and the 1-digit number), which is simply $4!$. In total this gives us $4!\cdot5!\cdot15$ possibilities.

As a final result, we get a chance of $$\frac{4\cdot8!+4\cdot24\cdot6!+4!\cdot5!\cdot14}{256^4}=\frac{270720}{256^4}.$$

Fortunately this agrees with the brute-force answer in the comments above.
I get 270 720 good cases....

Calculation:

First case
...,..,..,.. (plus permutation of groups)

1..,..,..,.. => 8! * 4 (4 = Perm of groups) = 161 280

2..,..,..,.. => 3 * 7! * 4 (second nr in three digit is 1,3 or 4) + 
3 * 6! * 4 (second nr in three digit is 5) = 69 120

Second case
1..,2..,..,. (plus perm of groups 4!)
=> 2 * 6! * 4! (1..,23., or 1..,24.,) + 2 * 5! * 4! (1..,25.,) = 40 320

Total: 270 720

Gives prob.