# Gateway Issue



## oshman (Jan 10, 2011)

I have a server at a datacenter running ESXi. The DC has assigned me IPs for different vlans and 1 gateway address.

*Hypothetical IPs:*
VLAN 1 - 178.122.236.200/29 (Default Gateway 178.122.236.201)
VLAN 2 - 178.122.232.128/28 (means that 178.122.232.129 would be gateway)

According to them I have only 1 default gateway (*.236.201). Which is fine with me. On a Windows server I have a *.232.128 IP with the 178.122.236.201. It complained and told that the gateway was on a different network segment but it accepted it and worked.

On my BSD 8.1 machine I've tried setting 'defaultrouter' to 178.122.236.201 but I still can't ping anything outside the other machines on the same network segment.

Tried [cmd=]route add -net 178.122.232.128/28 178.122.236.201[/cmd] but it says that the network is unreachable.

Does anyone have any advice?


----------



## graudeejs (Jan 10, 2011)

in /etc/rc.conf

```
defaultrouter="GATEWAY_IP"
```

manually: 
	
	



```
# route delete default
# route add default GATEWAY_IP
```


----------



## Alt (Jan 10, 2011)

oshman said:
			
		

> VLAN 1 - 178.122.236.200/29 (Default Gateway 178.122.236.201)
> VLAN 2 - 178.122.232.128/28 (means that 178.122.232.129 would be gateway)


If you got additional IP in second subnet, its not generally means you should setup additional gateway. Your 178.122.232.129 (which "whould be gateway") maybe not routing or whatever.



			
				oshman said:
			
		

> The DC has assigned me IPs for different vlans and 1 gateway address.


You should setup these ips as alias on your interface and set default GW as said by your ips.

So i think your setup should look like this:
	
	



```
ifconfig fxp0 alias 178.122.236.X/29
ifconfig fxp0 alias 178.122.232.Y/28
route add default gw 178.122.236.201
```
Now, if someone is accessing your 178.122.232.Y from internet, your server send ask trough 178.122.236.201 gateway:
Request: Client -> .... (internet) -> Your ISP -> 178.122.232.Y/28 (your server)
Answer: 178.122.232.Y/28 (your server) -> GW 178.122.236.201 (trough 178.122.236.200/29 net) -> ISP -> .... (internet) -> Client


----------

