I have two sub-sites set up in configuration manager. When the SCCM agent installs on the client machines within the boundaries of those sub sites they are assigned the site code of the Primary site, not the sub site code.
As a result their management server remains the main server not the sub site server.
I am setting up thes sub sites on cross WAN locations to cut down on traffic.
What could be preventing the clients from getting associated with the proper sub site code.
When you say sub-sites, are you referring to secondary sites? If so, clients that are within the boundary of a secondary site are assigned the site code of the primary site, not the secondary site. Refer http://technet.microsoft.com/en-us/library/bb681005.aspx.
What you need to do is check the boundaries of your secondary sites, and ensure that the clients that should be within these secondary sites are within the boundaries. I normally do this by using Active Directory sites as the boundaries. If you go down that route, ensure your Active Directory sites have the appropriate subnets assigned. By having secondary sites assigned the appropriate boundaries and the relevant clients within those boundaries, the clients will be assigned the proxy management point of the secondary site.