Is it safe to assume that two hosts on the same /24 network belong to the same AS-number?

Solution 1:

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:

115.84.167.192/27  (AS17574) and 115.84.167.0/24  (AS17841)
203.238.37.96/27   (AS9846)  and 203.238.37.0/24  (AS9571)
211.252.151.224/27 (AS23577) and 211.252.151.0/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 203.238.37.96/27
BGP routing table entry for 203.238.37.96/27, version 5930150
Paths: (3 available, best #3, table Default-IP-Routing-Table)
  Not advertised to any peer
  1221 4637 4766 9846
    203.62.252.186 from 203.62.252.186 (203.62.252.186)
      Origin IGP, localpref 100, valid, external
...

route-views.oregon-ix.net>show bgp ipv4 unicast 203.238.37.0/24
BGP routing table entry for 203.238.37.0/24, version 3468876
Paths: (33 available, best #24, table Default-IP-Routing-Table)
  Not advertised to any peer
  3277 3216 3549 10026 9848 9571
    194.85.4.55 from 194.85.4.55 (194.85.4.16)
      Origin IGP, localpref 100, valid, external
      Community: 3216:3000 3216:3004 3277:3216 3549:4025...
....

hope this helps :)

Lockie