Default gateway is in different subnet. How to configure in RHEL6.2
- by Dmytro Leonenko
I have two subnets routed to my server from ISP. I have only one gateway ip. The gateway is on the same VLAN as my IP address.
For example netowrk 1 is 1.0.0.0/24 and network 2 is 2.0.0.0/24. Both are routed to eth0 by my ISP. Gateway is 1.0.0.1. My host ip is 2.0.0.1/24 (eth0)
So I can configure default gateway manually with
ip route add default dev eth0
ip route add default via 1.0.0.1
and then internet connection works properly.
How do I configure it in /etc/sysconfig/network-scripts/ifcfg-eth0 ?
I tried to set GATEWAY=1.0.0.1 but it doesn't work. Tried to set GATEWAY and GATEWAYDEV in /etc/sysconfig/network and it does only what first command from listing above do.