If possible, attempt a hard line connection (ethernet etc), because wireless can be unreliable in a number of ways(positioning of router vs your device, router, your wireless chip etc)
If the hard connection still have issue, it's either your modem or your ISP(internet service provider). You can probably get another modem easily enough to figure out which.