Assume two IP-addresses in the same /24 network (say 1.2.3.*):
Is it safe to assume that these two hosts belong to the same AS-number? If not, roughly how often is that the case that they do not belong to the same AS?
IPv4 addresses in the same /24 can be members of different Autonomous Systems, but this is very uncommon.
I just did a quick search of the BGP routing table, and only found a couple of hundred /24s spanning different ASes. This compares to a total of ~310,000 total advertised prefixes.
Here are three examples:
18.104.22.168/27 (AS17574) and 22.214.171.124/24 (AS17841) 126.96.36.199/27 (AS9846) and 188.8.131.52/24 (AS9571) 184.108.40.206/27 (AS23577) and 220.127.116.11/24 (AS9642)
If you're interested in BGP data, routeviews.org provide snapshots of the global BGP table, and a number of BGP routers accessible via telnet, for example:
route-views.oregon-ix.net>show bgp ipv4 unicast 18.104.22.168/27 BGP routing table entry for 22.214.171.124/27, version 5930150 Paths: (3 available, best #3, table Default-IP-Routing-Table) Not advertised to any peer 1221 4637 4766 9846 126.96.36.199 from 188.8.131.52 (184.108.40.206) Origin IGP, localpref 100, valid, external ... route-views.oregon-ix.net>show bgp ipv4 unicast 220.127.116.11/24 BGP routing table entry for 18.104.22.168/24, version 3468876 Paths: (33 available, best #24, table Default-IP-Routing-Table) Not advertised to any peer 3277 3216 3549 10026 9848 9571 22.214.171.124 from 126.96.36.199 (188.8.131.52) Origin IGP, localpref 100, valid, external Community: 3216:3000 3216:3004 3277:3216 3549:4025... ....
hope this helps :)