LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-16-2007, 03:57 PM   #1
dids22
LQ Newbie
 
Registered: May 2007
Posts: 9

Rep: Reputation: 0
problem with releasing a Dynamic IP address


hey
first, i use archlinux dis'.
i'm connected to the internet without dialer (some call it mpls)
the way to change the ipin windows is using this script
Code:
ipconfig /release
netsh interface ip set address "local area connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1
ipconfig /release
netsh interface ip set address "local area connection" dhcp
and it's work fine.
i tried to make a similar script for arch- but my ip stay the same
what i do worng?
Code:
#! /bin/bash
INET_IP=`/sbin/ifconfig eth0 | grep 'inet addr' | awk '{print $2}'| sed -e 's/.*://'` #Get IP
echo your old ip was $INET_IP
dhcpcd eth0 -k
ifconfig eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255
sleep 2
dhcpcd eth0
sleep 2
INET_IP=`/sbin/ifconfig eth0 | grep 'inet addr' | awk '{print $2}'| sed -e 's/.*://'` #Get IP
echo your new ip is $INET_IP
ty!!
 
Old 05-16-2007, 07:38 PM   #2
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
Quote:
i tried to make a similar script for arch- but my ip stay the same
I used your script on my Slackware box and it works fine. My box gets the same DHCP assigned IP also. The DHCP server cached the IP address for the requested MAC address and it hasn't expired yet. Nice script
 
Old 05-17-2007, 05:44 AM   #3
dids22
LQ Newbie
 
Registered: May 2007
Posts: 9

Original Poster
Rep: Reputation: 0
if you get the same ip then the script isn't fine

Quote:
Originally Posted by bsdunix
The DHCP server cached the IP address for the requested MAC address and it hasn't expired yet. Nice script
then how u explain that this script working?
Code:
ipconfig /release
netsh interface ip set address "local area connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1
ipconfig /release
netsh interface ip set address "local area connection" dhcp
http://i11.tinypic.com/4uizouq.jpg

Last edited by dids22; 05-17-2007 at 06:21 AM.
 
Old 05-17-2007, 07:17 AM   #4
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
Quote:
if you get the same ip then the script isn't fine
Quote:
then how u explain that this script working?
I did the DHCP/static changes several times on my Windows box, in about 50% of the time I either get the same IP or next incremented number. During my test, the Slackware box always gets the same IP. Why is Windows different? Must be a Windows thing. I don't have a scientific answer for you.
 
  


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
About dynamic IP address satimis Linux - Networking 8 10-24-2006 08:11 PM
[SOLVED] Converting static IP-address to dynamic IP-address Blue_Ice Linux - Networking 3 07-20-2006 03:35 AM
releasing a DHCP address in Fedora tuzman Linux - Networking 1 12-10-2004 10:24 AM
Fix ip address vs Dynamic ip address yenonn Linux - Networking 5 04-13-2004 07:25 AM
Renewing And Releasing Dynamic IP's Jason_25 Linux - Networking 1 03-06-2002 10:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:08 AM.

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
Open Source Consulting | Domain Registration