LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 12-08-2003, 03:12 PM   #1
renzopeco
LQ Newbie
 
Registered: Dec 2003
Posts: 4

Rep: Reputation: 0
Question 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?

Thanks
Renzo
 
Old 12-08-2003, 04:07 PM   #2
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
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...

jpbarto
 
Old 12-08-2003, 04:10 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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

Code:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
to
Code:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.101
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
NETMASK=255.255.255.0
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.

* after all, this is linux.... why not??
 
Old 12-08-2003, 04:25 PM   #4
blish_blash
Member
 
Registered: Dec 2003
Posts: 68

Rep: Reputation: 15
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
 
Old 12-08-2003, 05:32 PM   #5
hizroyalhajpaj
LQ Newbie
 
Registered: Dec 2003
Distribution: RHL 9.0
Posts: 8

Rep: Reputation: 0
since nobody w/ a d-link router has posted yet i'll chime in...

my d-link does dhcp... but i can statically assign addresses too...

so i would go with acid_kewpie's advice first (plus it's a simple change)

good luck!
 
Old 12-08-2003, 05:32 PM   #6
renzopeco
LQ Newbie
 
Registered: Dec 2003
Posts: 4

Original Poster
Rep: Reputation: 0
more confusion

thanks to all who've responeded.

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

TCP/IP Info:
IP Address: 169.254.47.238
Subnet Mask: 0.0.0.0
Gateway Address: 0.0.0.0

so maybe that thing is hardcoded to use an entirely different private IP address range, and I need to switch over to that??

sorry, but i am fairly confused, as you can tell. and all i want is something like this:

|
|
WAN address whatever
|
DSL Modem
|
Router (*.*.*.1)
|
|
------------------------------
| | | |
| | | |
ATA AirPort Linux PS110
.100 .101 .102 .104
|
|
PowerBook
.103

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.

thanks
 
Old 12-08-2003, 05:55 PM   #7
renzopeco
LQ Newbie
 
Registered: Dec 2003
Posts: 4

Original Poster
Rep: Reputation: 0
hizroyalhajpaj,

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

Destination LAN IP
192.168.1.0

Subnet Mask
255.255.255.0

Default Gateway
0.0.0.0

Hopcount
1

as the only LAN entry
 
Old 12-08-2003, 07:03 PM   #8
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
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).

Last edited by jpbarto; 12-08-2003 at 07:08 PM.
 
Old 12-09-2003, 09:05 PM   #9
renzopeco
LQ Newbie
 
Registered: Dec 2003
Posts: 4

Original Poster
Rep: Reputation: 0
OK, thanks again to everyone for their help!

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.

That's it, I think
 
Old 12-09-2003, 09:53 PM   #10
hizroyalhajpaj
LQ Newbie
 
Registered: Dec 2003
Distribution: RHL 9.0
Posts: 8

Rep: Reputation: 0
from your post right after mine i saw that u were getting somewhere...

i'm still getting the hang of the options in my d-link...

peace
 
Old 12-20-2003, 11:30 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
  


Reply



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
Zoom modem/switch & linux<->linux network: DHCP / Static ? tredegar Linux - Networking 8 11-11-2007 03:41 AM
Problem with an external DHCP server giving address on my local department network atl02wrx Linux - Networking 2 07-12-2005 05:50 AM
Network Changes from Static to DHCP RemusX2 Linux - Networking 5 06-15-2005 01:15 PM
Mix intern and extern network Ephracis Linux - Networking 1 12-15-2004 12:02 PM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 11:13 AM

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

All times are GMT -5. The time now is 09:06 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