#! /bin/bash
#脚本用途 连接以太网
#参数根据需要自己改
################parameters##################
IFACE=eth0
IP_ADDR=192.168.1.102
SUBNET_MASK=255.255.255.0
GW=192.168.1.1
HW_ADDR='14:xx:b5:ec:57:xx'
############################################
if [ $UID -ne 0 ]
then
echo "Run as root"
exit 1
fi
# close the port before configuration
/sbin/ifconfig $IFACE down
if [[ -n $HW_ADDR ]];
then
/sbin/ifconfig hw ether $HW_ADDR
echo Spoofed MAC ADDRESS to $HW_ADDR
fi
/sbin/ifconfig $IFACE $IP_ADDR netmask $SUBNET_MASK
route add default gw $GW $IFACE
echo Successfully configured $IFACE
#脚本用途 连接以太网
#参数根据需要自己改
################parameters##################
IFACE=eth0
IP_ADDR=192.168.1.102
SUBNET_MASK=255.255.255.0
GW=192.168.1.1
HW_ADDR='14:xx:b5:ec:57:xx'
############################################
if [ $UID -ne 0 ]
then
echo "Run as root"
exit 1
fi
# close the port before configuration
/sbin/ifconfig $IFACE down
if [[ -n $HW_ADDR ]];
then
/sbin/ifconfig hw ether $HW_ADDR
echo Spoofed MAC ADDRESS to $HW_ADDR
fi
/sbin/ifconfig $IFACE $IP_ADDR netmask $SUBNET_MASK
route add default gw $GW $IFACE
echo Successfully configured $IFACE