All vk.com IP addresses

Published on

Here’s the current list of IP addresses owned by the social network vk.com (“vkontakte”/“Вконтакте”):

CIDR Base address Netmask
87.240.128.0/18 87.240.128.0 255.255.192.0
93.186.224.0/20 93.186.224.0 255.255.240.0
95.142.192.0/20 95.142.192.0 255.255.240.0
95.213.0.0/17 95.213.0.0 255.255.128.0
185.32.248.0/22 185.32.248.0 255.255.252.0

You can use this list to block, unblock, or apply custom routing to the VK traffic.

Here is the Perl script I wrote to extract this information, in case you want to check whether this table is up-to-date or generate a similar table for a different website/company.

#!/usr/bin/perl -l

use strict;
use warnings;
use Net::Netmask;

my @inetnum;
my @ranges;

while (<>) {
  if (/^inetnum:\s*(\S+) - (\S+)$/) { @inetnum = (,); }
  if (/^mnt-by:\s*VKONTAKTE-NET-MNT$/) {
    push @ranges, range2cidrlist(@inetnum);
  }
}

for my $cidr (cidrs2cidrs(@ranges)) {
  print $cidr, "\t", $cidr->base(), "\t", $cidr->mask();
}

Usage (if you saved the script as ip_ranges.pl):

wget ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.inetnum.gz
zcat ripe.db.inetnum.gz | perl ip_ranges.pl