Este script es para cambiar la direccion IP si usan cablemodem sin router, es decir, que su PC no posea una direccion privada del tipo 192.168.x.x, sino que sea directo con el servicio de cablemodem, NO ADSL.
El principio es simple, los cablemodem asignan la direccion IP basandose en un algoritmo entre la MAC de la iface y la de el, en base a eso asigna la IP, a veces esto sirve para cambiar la IP porque nos mandamos un moco, porque queremos bajar mas cosas de lugares como freakshare o simplemente modo paranoico.
Copian el codigo y metanlo en /usr/bin/changeip, denle permiso con chmod +x /usr/bin/changeip y listo.
El principio es simple, los cablemodem asignan la direccion IP basandose en un algoritmo entre la MAC de la iface y la de el, en base a eso asigna la IP, a veces esto sirve para cambiar la IP porque nos mandamos un moco, porque queremos bajar mas cosas de lugares como freakshare o simplemente modo paranoico.
Copian el codigo y metanlo en /usr/bin/changeip, denle permiso con chmod +x /usr/bin/changeip y listo.
#!/bin/bash
# Author: SynFlag
# Licence: GNU GPLv2
# changeip is a script for change the IP address using cablemodem under GNU/Linux
# Date: 6-6-2014
clear
if [ "$UID" -ne 0 ]; then
echo -e "Please run with root privileges using su -c 'changeip' or sudo changeip"
exit
fi
echo "Your IP address is `curl -s icanhazip.com`"
echo "Enter the active device with internet in your system, for example: eth0, eth1, wlan0"
read iface
echo "The MAC of $iface is `ifconfig $iface|egrep HWaddr|awk '{print $5}'`, change the last two digits with a number from 0 to 9 and letter from A to F and paste here, including the : separator"
read newmac
{
service network stop ; service networking stop ; ifdown $iface ; /etc/init.d/networking stop ; /etc/init.d/network stop ; /etc/rc.d/rc.inet1 $iface"_stop"
} &> /dev/null
ifconfig $iface hw ether $newmac &> /dev/null
echo "Disconnect the power supply of your cablemodem now and wait for instructions and press Intro"
read
sleep 2
echo "Reconnect the power supply of your cablemodem and press Intro"
read
{
service network start ; service networking start ; ifup $iface ; /etc/init.d/networking start ; /etc/init.d/network start ; /etc/rc.d/rc.inet1 $iface"_start"
} &> /dev/null
sleep 4
echo "Done, your new IP is `curl -s icanhazip.com`"
exit 0
# Author: SynFlag
# Licence: GNU GPLv2
# changeip is a script for change the IP address using cablemodem under GNU/Linux
# Date: 6-6-2014
clear
if [ "$UID" -ne 0 ]; then
echo -e "Please run with root privileges using su -c 'changeip' or sudo changeip"
exit
fi
echo "Your IP address is `curl -s icanhazip.com`"
echo "Enter the active device with internet in your system, for example: eth0, eth1, wlan0"
read iface
echo "The MAC of $iface is `ifconfig $iface|egrep HWaddr|awk '{print $5}'`, change the last two digits with a number from 0 to 9 and letter from A to F and paste here, including the : separator"
read newmac
{
service network stop ; service networking stop ; ifdown $iface ; /etc/init.d/networking stop ; /etc/init.d/network stop ; /etc/rc.d/rc.inet1 $iface"_stop"
} &> /dev/null
ifconfig $iface hw ether $newmac &> /dev/null
echo "Disconnect the power supply of your cablemodem now and wait for instructions and press Intro"
read
sleep 2
echo "Reconnect the power supply of your cablemodem and press Intro"
read
{
service network start ; service networking start ; ifup $iface ; /etc/init.d/networking start ; /etc/init.d/network start ; /etc/rc.d/rc.inet1 $iface"_start"
} &> /dev/null
sleep 4
echo "Done, your new IP is `curl -s icanhazip.com`"
exit 0
No hay comentarios:
Publicar un comentario