Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761
Rep:
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
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
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.