You are not logged in.

#1 2006-07-08 01:23:28

Phrodo_00
Member
From: Seattle, WA
Registered: 2006-04-09
Posts: 342
Website

taking the values from dhcp and use them statically?

Hi, Is there a way I can take the values dhcp aplied and turn them static so I don't have to wait so much for the interface to come out and it doesn't take years to fail when the server is down?

Offline

#2 2006-07-08 03:40:04

DeusExLinux
Member
Registered: 2005-03-18
Posts: 98

Re: taking the values from dhcp and use them statically?

Unless you have a static IP, this wouldn't work

The D in DHCP stands for Dynamic...  therefore the IP is assigned by the server everytime you log into it.

If you have a static IP, then yes, you can.

Otherwise, you just have to wait, like the rest of us.

You could background the task (if it's on boot) by adding a @network in rc.conf

Offline

#3 2006-07-08 05:01:10

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: taking the values from dhcp and use them statically?

DeusExLinux, actually, in many cases, this works perfectly fine and you CAN statically assign addresses on a dynamic home network. Not so sure about a more complex corporate network, where there may be preventatives to stop this. Works fine on all the home router's ive had though.

Just run ifconfig and note the second line:
          inet addr:192.168.1.23  Bcast:192.168.1.255  Mask:255.255.255.0

which translates an option of:

eth0="eth0 192.168.1.23 netmask 255.255.255.0 broadcast 192.168.1.255"
INTERFACES=(lo eth0)

beware, that you must also specify route's and DNS manually too.
Check 'route' for your default route:

root@sara:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
default         192.168.1.1           0.0.0.0         UG    0      0        0 eth0

which translates to this in rc.conf

gateway="default gw 192.168.1.1"
ROUTES=(gateway)

and you can then either setup /etc/resolv.conf yourself by just backing up the one from DHCP, or use a network-profiles setup instead of all this.

James.

Offline

#4 2006-07-08 05:50:26

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: taking the values from dhcp and use them statically?

Depends on the network.
If it is a corp network, then assigning yourself a dhcp address, could cause an ip conflict when the dhcp server tries to lease that same address out to somebody else.
If it is managed by a corp, they will pay someone to come around and beat you over the head.

If it is your home network..then just set it statically.

Another option would be to configure your dhcp client to ask for a specific address...but you would run into the same issue you currently are.. that is..you don't want to wait the few seconds it takes to get a lease.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#5 2006-07-08 06:49:47

_Gandalf_
Member
Registered: 2006-01-12
Posts: 735

Re: taking the values from dhcp and use them statically?

I just want to add in case of a home network, if you want to keep it dynamic but also have static IPS, make the DHCP server give IPs starting from let's say 100 (192.168.1.100) that'll give you 98 machine static (from 2 to 99 assuming 1 is the gateway) and 155 dynamic (from 100 to 254) ...

Offline

#6 2006-07-08 11:33:56

mingfal
Member
Registered: 2005-11-07
Posts: 32

Re: taking the values from dhcp and use them statically?

I remember we can make dhcp try using the the previous assigned address before getting a new one.But I don't know how. :oops:

Offline

#7 2006-07-08 19:30:45

Phrodo_00
Member
From: Seattle, WA
Registered: 2006-04-09
Posts: 342
Website

Re: taking the values from dhcp and use them statically?

Thanks, I'm in a home network and the router is a winxp computer (don't ask me why, it's just that way. It will change as soon as I can buy a router), and there are 4 pcs in my network so conflict posibility is minimum. Thank you all.

Offline

#8 2006-07-08 23:20:06

DeusExLinux
Member
Registered: 2005-03-18
Posts: 98

Re: taking the values from dhcp and use them statically?

Hmm..  Guess I'm dumber than I thought.. ha, or my router just sucks....

Offline

Board footer

Powered by FluxBB