We apply a recently developed optimization scheme to obtain effective potentials for alkali and alkaline-earth aluminosilicate glasses that contains lithium, sodium, potassium, or calcium as modifiers. As input data for the optimization, we used the radial distribution functions of the liquid at high temperature generated by means of ab initio molecular dynamics simulations and density and elastic modulus of glass at room temperature from experiments. The new interaction potentials are able to reproduce reliably the structure and various mechanical and vibrational properties over a wide range of compositions for binary silicates. We have tested these potentials for various ternary systems and find that they are transferable and can be mixed, thus allowing to reproduce and predict the structure and properties of multi-component glasses.