HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //usr/local/sbin/seteth1
#!/bin/bash
read -p "Enter the interface name: " interface
while [ -z "$interface" ]
do
	echo "The interface is required!"
	read -p "Enter the interface: " interface
done
if ! ip link show | awk '{print $2}' | grep -wq $interface
then
	echo "No such interface detected!"
	exit 1
fi
ifdown $interface
echo "NAME=$interface
DEVICE=$interface
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
IPADDR=
NETMASK=255.255.255.0" > /etc/sysconfig/network-scripts/ifcfg-$interface
nano +6 /etc/sysconfig/network-scripts/ifcfg-$interface
address=$(grep "IPADDR" /etc/sysconfig/network-scripts/ifcfg-$interface | cut -c8-)
if [ $(echo $address | awk -F "." '{print $1}') == 10 ]
then
	echo "10.255.255.0/24 dev $interface" > /etc/sysconfig/network-scripts/route-$interface
else
	octets=$(echo $address | awk -F "." '{print $1"."$2"."$3}')
	echo "172.31.255.0/24 via $octets.1" > /etc/sysconfig/network-scripts/route-$interface
fi
ifup $interface
/usr/bin/wget -q -O - --no-check-certificate "https://64.59.69.75/tempfiles/installs_do.php?type=I&hostname=$(hostname -s)&task=eth1&action=X"
rm -f /usr/local/sbin/seteth1