#!/bin/sh
#

name=$(route -n | grep ^0.0.0.0 | awk '{print $NF}')
sed -i 's/GATEWAY=192.168.1.1/GATEWAY=192.168.0.1/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/GATEWAY=192.168.2.1/GATEWAY=192.168.0.1/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/GATEWAY=192.168.3.1/GATEWAY=192.168.0.1/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/GATEWAY="192.168.1.1"/GATEWAY="192.168.0.1"/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/GATEWAY="192.168.2.1"/GATEWAY="192.168.0.1"/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/GATEWAY="192.168.3.1"/GATEWAY="192.168.0.1"/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/NETMASK=255.255.255.0/NETMASK="255.255.252.0"/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/NETMASK="255.255.255.0"/NETMASK="255.255.252.0"/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/PREFIX=24/PREFIX=22/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
sed -i 's/PREFIX="24"/PREFIX="22"/g'  /etc/sysconfig/network-scripts/ifcfg-${name}
ifdown ${name} && ifup ${name}
#service network restart
