Not even sure if I worded this correctly, but here’s what I’m trying to do roughly.
Take an IP such as:
192.168.100.0 and mask it to
255.255.255.0, and set the gateway of that route to another IP address.
I'm using bash, on Mac OS X.
To add, I.T. at my work has an issue where Mac computers have a problem when connecting to a network that has more than one gateway/router. The idea is to create a script that checks to see what subnet it is connected to. If it is the subnet with more than one gateway, then we need to add additional routing rules to ensure proper communication.
Its a few different IPs that will all mask to
255.255.255.0, and all to the same router IP.
192.168.100.0 mask 255.255.255.0 router/gateway 192.168.160.1 192.168.120.0 mask 255.255.255.0 router/gateway 192.168.160.1