Your gateway will have to be setup to get a dynamic IP address from whatever router your computer connects to through the switch.
If all you have is a modem that supplies your internet (not a router) than this setup will not work. You will need a router that can assign your computer and the gateway unique ip addresses. When you connect them together directly (sans internet) they get link local ip addresses, but these will not work on the internet.
No, your computer and the gateway need different ip addresses. If you connect your internet to the switch and your computer and gateway to the switch, all you're really doing is connecting your gateway and computer to the source of your internet.
If the source is a router, then it will assign your computer and the gateway each and ip address. Then things should work fine as long as your gateway is configured to use DHCP.
If the source is a modem then there's a problem. The modem can only handle a connection to one entity, your computer. Your gateway will end up stranded and not be able to communicate with anything.
It sounds like your ethernet cable is connected to a local network which is probably good. Just make sure the gateway is setup for DHCP and then you should be able to rediscover it on the network after connecting it and your computer to the switch.