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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
07-30-2017, 11:10 AM
|
#1
|
Member
Registered: Aug 2012
Posts: 789
Rep:
|
Static IP for a wireless box - Keeps changing back to another IP
Desire a static IP on a wireless Centos6 box. I set it up as such, and it sticks for a while, then I get up in the morning and it has reverted back to another IP. How can I prevent it from changing? Thanks
Code:
[Michael@devserver ~]$ ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:42164 errors:0 dropped:0 overruns:0 frame:0
TX packets:42164 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9035715 (8.6 MiB) TX bytes:9035715 (8.6 MiB)
wlan0 Link encap:Ethernet HWaddr B8:76:3F:69:31:95
inet addr:192.168.1.140 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ba76:3fff:fe69:3195/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2569632 errors:0 dropped:0 overruns:0 frame:0
TX packets:1948026 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:293819716 (280.2 MiB) TX bytes:225579123 (215.1 MiB)
[Michael@devserver ~]$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=devserver.michaels.lan
[Michael@devserver ~]$ cat /etc/resolv.conf
search michaels.lan hsd1.wa.comcast.net
nameserver 192.168.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4
[Michael@devserver ~]$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost devserver
::1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 localhost devserver
[Michael@devserver ~]$ cat /etc/sysconfig/network-scripts/ifcfg-wlan0
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
GATEWAY=192.168.1.1
DEVICE=wlan0
BOOTPROTO=none
NETMASK=255.255.255.0
#TYPE=Ethernet
TYPE=wireless
HWADDR=b8:76:3f:69:31:95
IPADDR=192.168.1.10
NM_CONTROLLED=no
ONBOOT=yes
PEERDNS=no
IPV6INIT=no
USERCTL=no
DNS2=8.8.4.4
DNS1=8.8.8.8
[Michael@devserver ~]$
|
|
|
07-30-2017, 11:19 AM
|
#2
|
Senior Member
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 22 MATE, Peppermint OS-Devuan, EndeavourOS
Posts: 4,275
|
|
|
|
07-30-2017, 11:58 AM
|
#3
|
Member
Registered: Aug 2012
Posts: 789
Original Poster
Rep:
|
Thanks beachboy2, but as shown in my original post, I've already done so. Note that my /etc/sysconfig/network-scripts/ifcfg-wlan0 additionally includes the following:
Code:
GATEWAY=192.168.1.1
TYPE=wireless
HWADDR=b8:76:3f:69:31:95
NM_CONTROLLED=no
PEERDNS=no
IPV6INIT=no
USERCTL=no
DNS2=8.8.4.4
DNS1=8.8.8.8
I think the issue might have nothing to do with the centos machine, but I think I forgot to setup my router with an IP range where it will accept self assigned IPs, and centos is forgoing its static ip to use a dhcp ip.. Strange though how centos will ignore its own static ip config to adapt to the routers assignment.
|
|
|
07-30-2017, 12:10 PM
|
#4
|
Senior Member
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 22 MATE, Peppermint OS-Devuan, EndeavourOS
Posts: 4,275
|
NotionCommotion,
I must get my money back on that speed-reading course!
|
|
|
07-30-2017, 12:25 PM
|
#5
|
Member
Registered: Aug 2012
Posts: 789
Original Poster
Rep:
|
@Beachboy2, No worries, and thanks! One of the comments reminded me about dhcp reservations. Now, 192.168.1.10 sticks! Funny though, my router shows it having two IPs now where one is 192.168.1.140. Guess that is what I get for using static ips on wireless devices!
|
|
|
07-30-2017, 12:55 PM
|
#6
|
Senior Member
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669
|
___
NotionCommotion:
Should the problem recur, take this note.
-----
1. NM must control the IP to peg it in one static IP value, to avoid the manager behaving like an idiot on-call it follows whatever the dhcp entices it to accept.
2. Control the IPs from the dhcp side (usually the router) login to it and bind
HWADDR=b8:76:3f:69:31:95 to IP # 192.168.1.xxx (whatever you like.)
Refresh the network script (restart)
Refresh the dhcp as well.
Hope that helps. Good luck.
m.m.
Last edited by malekmustaq; 08-01-2017 at 08:54 AM.
|
|
1 members found this post helpful.
|
07-30-2017, 10:46 PM
|
#7
|
Member
Registered: Aug 2012
Posts: 789
Original Poster
Rep:
|
Yes helpful, nm is network manager? How do I keep behaving like a whore?
|
|
|
07-31-2017, 07:34 AM
|
#8
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,938
|
NotionCommotion:
malekmustag:
Per the LQ Rules, Do not post any messages that are obscene, vulgar, sexually-orientated, hateful, threatening, hostile or insulting.
While I realize there are worse words for one to post, I also fail to see any reference towards this subject.
Please stay on topic and even if self admonishing yourself, please do not bring the conversation to a level violating the LQ rule cited.
EDIT: I incorrectly noted NotionCommotion's comment failing to realize malekmustag's comment. Apologies.
Last edited by rtmistler; 07-31-2017 at 09:08 AM.
|
|
|
07-31-2017, 09:03 AM
|
#9
|
Member
Registered: Aug 2012
Posts: 789
Original Poster
Rep:
|
@rtmistler, Understood. And while I fully agree LQ Rules are appropriate and I would never wish to promote any of the negative qualities which they are meant to prevent, I must say the use of the word does have reference.
|
|
|
07-31-2017, 09:10 AM
|
#10
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,938
|
Quote:
Originally Posted by NotionCommotion
@rtmistler, Understood. And while I fully agree LQ Rules are appropriate and I would never wish to promote any of the negative qualities which they are meant to prevent, I must say the use of the word does have reference.
|
You are quite correct, apologies.
malekmustag:
Please find more appropriate means to describe software behavior.
As you can see, another member possibly felt that this comment was personally directed versus meant to describe software.
|
|
|
08-01-2017, 08:53 AM
|
#11
|
Senior Member
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669
|
Quote:
As you can see, another member possibly felt that this comment was personally directed versus meant to describe software.
|
Yes Mod. My sincere apology.
I really had that same problem once and I yelled at my NM (Network Manager) for behaving that way, it follows whatever wherever the dhcp took it. After a sober moment I realized it was my mistake for letting her be.
Again, NotionCommotion my post was about the "NM" network manager. There is no way a good english user shall mistake the subject and predicate.
Did it help? Please post freely again. Everyone here is eager to help.
Good luck.
m.m.
|
|
|
08-01-2017, 03:49 PM
|
#12
|
Senior Member
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
|
I second the recommendation to use DHCP reservations for assigning specific IP addresses. It centralizes management, making it a lot simpler to make changes.
Cheers :-)
|
|
|
All times are GMT -5. The time now is 06:26 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|