Linux - NewbieThis 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.
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.
I have a Centos machine in the crawlspace of my garage. I can't get wire to it, so am using wifi. I previously had it set up with both a 192.168.1.200 eth0 and 192.168.1.201 wlan0 (but obviously eth0 wasn't operational), and I recently changed it to 10.120.11.200 wlan0 only. I think all is good, but wake up in the morning and ssh into it from my living room, and my server is gone! I crawl into the crawlspace, and find the IP is now 10.120.11.140. I restart the network, and now it is back to 10.120.11.200. The top of the first image shows an ifconfig I had done yesterday and the second half is one I just did (yes, I know I shouldn't leave it looked on, but it is hidden in my crawlspace you know). The second image is me next restarting the network, and re-running ifconfig (off topic, how can I capture the screen without taking a picture?).
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363
Rep:
Hey NotionCommotion ..
Have you made sure your router is assigning a fixed IP address to the computer in the crawl space through a DHCP reservation ? You either have to do that or turn off DHCP altogether and use local fixed IP addresses for every computer on your network.
If it's not that, I'm not sure what is causing the IP address to change like that.
I looked at the router, and it shows the device in question as DHCP. I definitely don't want to use DHCP across the board. Looking at the router settings, I don't think I could fix things from that end. I think I have to tell the Linux server to tell the router not to use DHCP.
I am thinking I just need to change BOOTPROTO=none to BOOTPROTO=static in /etc/sysconfig/network-scripts/ifcfg-wlan0. Guess I could/should also get rid of DNS1 and DNS2, but think it might not hurt anything.
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363
Rep:
Quote:
Originally Posted by NotionCommotion
Hey Rickkk! You are right!
I looked at the router, and it shows the device in question as DHCP. I definitely don't want to use DHCP across the board. Looking at the router settings, I don't think I could fix things from that end. I think I have to tell the Linux server to tell the router not to use DHCP.
I am thinking I just need to change BOOTPROTO=none to BOOTPROTO=static in /etc/sysconfig/network-scripts/ifcfg-wlan0. Guess I could/should also get rid of DNS1 and DNS2, but think it might not hurt anything.
Hey NotionCommotion,
If for some reason you have set up your WLAN interface to use a static IP, but it is still getting overwritten by the router, you can configure your router to fix this. Short of disabling DHCP completely on the router (which might make your life more complicated for other computers in your home), the best way to make sure that your crawl space computer is always assigned the same IP is to use your router's DHCP reservation function.
You just need to pair the crawl space computer's WLAN MAC address with the IP you want to assign, change the configuration of the WLAN interface on your crawl space box to use DHCP instead of a static IP, and thereafter its IP address should remain the same. I always manage fixed IP addresses through DHCP reservation as opposed to configuring static IPs on each computer - it's much simpler since management is centralized on the router.
First of all, is your lan subnet 10.120.x.x or 192.168.x.x? You first say that you configured your server with an ip belonging to the 192.168.x.x lan, but then you say that all of a sudden the dhcp (most probably) assigned you a 10.120.x.x ip. This doesn't really make any sense. I can see that everyone here supposed that you're talking about IPs belonging to the same subnet.
So if we assume that, my suggestion is to simply change the dhcp pool. I think that's the easiest thing you can do. Just use, for instance 10.120.11.100-.254 for dhcp and you can assign static IPs starting from .2 (I'm guessing .1 is the router) to .99. And the rest of the devices can still use dhcp.
@NotionCommotion, as far as I know, BOOTPROTO=static doesn't exist. Only none actually exist, but in principle the effect should be the same, i.e. not use dhcp.
For static ips, if you're using centos, for instance, you also need to add the gateway in /etc/sysconfig/network:
GATEWAY=10.120.11.1
First of all, is your lan subnet 10.120.x.x or 192.168.x.x? You first say that you configured your server with an ip belonging to the 192.168.x.x lan, but then you say that all of a sudden the dhcp (most probably) assigned you a 10.120.x.x ip. This doesn't really make any sense. I can see that everyone here supposed that you're talking about IPs belonging to the same subnet.
So if we assume that, my suggestion is to simply change the dhcp pool. I think that's the easiest thing you can do. Just use, for instance 10.120.11.100-.254 for dhcp and you can assign static IPs starting from .2 (I'm guessing .1 is the router) to .99. And the rest of the devices can still use dhcp.
@NotionCommotion, as far as I know, BOOTPROTO=static doesn't exist. Only none actually exist, but in principle the effect should be the same, i.e. not use dhcp.
For static ips, if you're using centos, for instance, you also need to add the gateway in /etc/sysconfig/network:
GATEWAY=10.120.11.1
Thanks vincix. No, I previously had it set up with both a 192.168.1.200 eth0 and 192.168.1.201 wlan0..., and I recently changed it to 10.120.11.200 wlan0 only. Also, my gateway is good as I originally showed. I've have a couple eth0 machines set up as static using the same router, and all is good. Is it because it is wireless? Maybe I also create an unused eth0 static ip on the machine, but it sounds like there is probably a more correct why to handle.
IF the IPADDR directive and the BOOTPROTO=none were there in ifcfg-wlan0, I really don't understand what could have made your server to change the ip, unless you're using another network tool to connect to your router through wifi, which, in turn, switches to dhcp. Maybe there's a conflict between the two.
Anyway, you should really use an IP outside the dhcp pool, otherwise you might end up with connection problems. Change the dhcp pool so that you have a range of static ips - this way you won't have to bother yourself with ip reservation - especially if this is a server(-like). One doesn't have dhcp reservations for servers (normally).
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363
Rep:
Quote:
Originally Posted by vincix
... One doesn't have dhcp reservations for servers (normally).
Although I agree with this for a business environment, I personally opt for the DHCP reservation method for servers and all machines on my home network. It just makes management so much simpler, given that it is centralized on the router.
Both methods work, though, so the OP has a choice.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.