Converting DHCP to static local network? Can I mix?
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.
Converting DHCP to static local network? Can I mix?
Hi -
I have a LinkSys DSL router that uses DHCP.
On the local network connected to that router I currently have
192.168.1.101 (usually AFAIK): a CISCO ATA 186 for VoIP with Vonage
192.168.1.102 or 103 a dual boot Linux (RH10/Fedora) /XP box
192.168.1.102 or 103 a Mac AirPort (to which I have connected a PowerPook)
192.168.1.104 a Netgear PS110 print server connected to my printer
The Linux box runs a CUPS daemon, and I can *usually* print fine using CUPS ipp from both the PowerBook and the Linux box. I obviously don't care that I can't print with this setup if I boot into XP. But I do care that I can access the internet, if I boot into XP (since the only reason I still have XP is Microsoft Money (no pun intended) and that I need to occasionally log into work via VPN).
The Linux box also acts as my mail and webserver, so it's setup as the box in the DMZ in the router, and as such is the only box I need to worry about a firewall at the moment (which I have taken care of with iptables)
So far so good. But there's problems with this, and I'd appreciate any advice:
1. The DHCP assigned IP addresses change sometimes (if i boot in and out of XP, or shut that box down). Hence the 'D' in the name I guess. So that means I have to go to the router's control panel, and change the address of DMZ box to whatever address my Linux box has at the moment.
2. When I want to connect to the PowerBook to the Linux box or vice versa, I have to check their IP addresses.
3. I have to change the CUPS configuration, if my PS110's address changes (hasn't happened yet, but I've only had it for a day). Might be that if I at some point reboot the Linux box while the PowerBook is shut down, I get 102 for the PS110 and 103 for the Linux box or whatever. Maybe my CISCO's IP address changes as well, I don't know, I didn't have any problems with that so far.
4. I don't know whether this is DHCP related, or some other problem (but what?), but sometimes my PS110 becomes unreachable, i.e. I can't even ping it. So far the only 'fix' I could come up with is disconnecting its power plug and then reconnecting it. Woops, it's reachable again, with the same IP address as before (which happens to be the highest one in the lot).
Anyways, the point is that DHCP is more of a pain in the ass than a convenience for me, so I am thinking about converting to static IPs.
Now the questions:
1. Is that a good idea?
2. How do I do that? Which files do I need to touch? Has 'arp' anything to do with this?
3. How can I then give my Linux box and my PowerBook names, so they know each other by name, not by fixed IP address?
4. Can/should I leave the ATA alone? If not, how do I assign a fixed IP address to it?
5. How about the PS110? It has an option for enabling/disabling DHCP and currently acts as a DHCP client.
6. Has anybody an idea why else the PS110 might become unreachable to ping?
first with the dhcp, dhcp will cache mac addresses such that if a mac address releases an IP and later that same mac requests an IP (any IP) if the old IP is not allocated elsewhere then the old IP will be reassigned to the mac address. In this way DHCP can be somewhat static. Also there might be somewhere in the dhcp server configuration that you can say 'this mac address always gets this IP, do not give it to anyone else'. If that is not possible you can configure the dhcp client on your box to always request a specific IP that way the only reason the box would get a different IP is if the requested IP currently belongs to another machine.
As for statically linking IPs:
if you want to be able to reference a machine via 'ping billy' then you will have to provide a DNS server such as named / bind. that's about all I got right now as I have to run at the moment, but let me know if that helped at all...
if you're comfortable with the whole static thang, then sure go for it. Unless redhat has changed that much since i used to use it, you just need to edit /etc/sysconfig/network-scripts/ifcfg-eth0 and change the contents there from something like
then restart the interface to remove all trace of DHCP.
Names would then be set by either setting up a fixed dns server. or manage an /etc/hosts file on each server. If you like this idea for the sake of itself*, but think BIND would be overkill, i'd suggest a "cute" alternative such as dnsmasq which will read a single /etc/hosts file and serve those names to anyone on the network configured to use that machines IP for a dns server.
I use myself a netgear box, and it has a feature of reserving ip addresses, so you can define an ip address for each device by its name - thus solving the chaos - maybe linkSys has a similar feature that will save you much trouble...
Greetings,
Ron
jpbarto, your suggestion about telling the dhcp server to always assign such and such ip address to such and such mac address sounds like a simple and straightforward solution, since i know all the mac addresses. does anyone know how to do this on a BEFSR41 LinkSys router?
acid_kewpie, i made the changes to the script that you suggested, and that seems to be working. i have left dhcp enabled in the router at the moment, but i have restricted the dhcp range to .100 and .101, while setting my Linux box address to .102 and the PowerBook address to .103. the idea being that the router will assign .100 to the ATA and .101 to the AirPort. does that make any sense? can i rely on that (since they are both always on)? i don't understand why the router's dhcp table now doesn't show me any dhcp clients, yet i can ping .100 through .103.
i can't ping .104, but then again i have found no way to force the Netgear PS101 print server to take that ip address. and the other thing right now is: the PowerBook can see the same local IP addresses the Linux box can ping, but I lost internet access for it, so presumably the router no longer forwards requests from the PowerBook to the internet.
now, back to the PS110. the only way i've been able to force its IP address is by doing something like /sbin/arp -s -v 192.168.1.104 <macaddress>. i can then ping it at .104 from the linux box, but not from the PowerBook. i don't understand how that's possible. the other starnge thing is that the PS110 shows me 192.168.1.104 as its address in one view ('TCP/IP'), but in teh 'Status' view it shows me
I want the Linux box to be able to ping everything and act as a mail and webserver in the DMZ, and I want the PowerBook to be able to ping everything and have internet access.
i am probably not getting how to use the Linksys router admin features, and their docs suck (plus some of their javascript 'features' don't work in mozilla, only in konqueror or safari). anyways, i see there are 'dynamic routing' and a 'static routing' screens. so i tried setting all IP addresses that i care about in the static routing screen, but that doesn't seem to work for me. for example, i have entered
Sestination LAN IP: 192.168.1.104
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
Interface: LAN
but that doesn't let me ping 192.168.1.104. it actually doesn't change anything. same with any other local IP address. when i then click on Show Routing Table, I always only see
on my dlink router there is a link in the web administration tool for dhcp, after opening that page there is a link for fixed mappings, this is where I have to specify mac = IP.
just judging by the linksys user manual from linksys.com it doesn't look like the dhcp server has such a feature. however I can tell you that 'static routing' is not what your looking for as that is referring to the routers routing tables for communication between the router and other networks (in this case the internet).
I figured it out. I was able to force a static IP address on the PS110 print server, but only by using its Window$ admin utility. I then edited the /etc/hosts files on my PowerBook and my Linux box, so they contain entries like
192.168.1.10 rome
192.168.1.11 paris
192.168.1.11 london
for my Linux box, PowerBook, and printer respectively. I chose IP addresses below .100, which is where by default my router's dhcp addresses begin. This way, the router assigns dynamic addresses only to my ATA 186 and to the AirPort, which I don't care about
I also had to enter my cable broadband provider's DNS servers and my router's IP address in the PowerBook Network config and in my Linux network config.
I have a link-sys cable router/hub. I had to create a small entry in dhservice.conf before the computer name would show up on the link-sys dhcp status listing. One trick to use is to set up one of the computer to boot up to dhcp, at least temporarily, and write down the DNS and Gateway ip addresses so you can enter them later when setting up static ip address.
Having a static configuration inside your LAN seems to be the easiest to configure for a small network. It's easy to edit a hosts file and copy it to each machine.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.