LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2015, 03:51 AM   #1
technerdius
LQ Newbie
 
Registered: Apr 2015
Posts: 1

Rep: Reputation: Disabled
Post What is a good Linux script for changing an IP address statically in Ubuntu?


I have a shell script that currently changes the mac address of eth0 repeatedly. However, it does not change the public IP address, confirmed by wget -qO- ipinfo.io/ip.

PERIOD=10

while [ 1 ]
do
echo "Changing mac address..."
let lastup=`date +%s`
macchanger -A eth0
let diff=`date +%s`-$lastup
if [ "$diff" -lt "$PERIOD" ]
then
sleep $(($PERIOD-$diff))
echo "Changed mac address successfully."
echo
elif [ "$diff" -gt "$PERIOD" ]
then
echo "Command took longer than iteration period of $PERIOD seconds!"
fi
done


The script needs to change the IP Address statically.

Also, ultimately, what I am trying to accomplish, for security reasons, is to frequently and automatically change a computer's public IP address and mac address. This way, my office's computers, when using the Internet, has an additional form of protection.
 
Old 04-05-2015, 11:21 AM   #2
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 939

Rep: Reputation: 174Reputation: 174
Why does changing your mac address provide security?

It will cause your local ip address to change because a new ip address will be allocated by DHCP.

Try using a firewall.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IP address on static assigned ubuntu server keeps changing! dontworryaboutme Linux - Networking 8 03-30-2012 05:32 PM
Changing ip address on SUSE Linux pkmronger Linux - Networking 2 10-17-2008 06:03 AM
changing my mac address permanently at ubuntu jamil_2342 Linux - Newbie 2 03-16-2008 02:03 PM


All times are GMT -5. The time now is 12:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration