Static ip behind dhcp?

Kai4Linux

Member
Apr 28, 2002
59
0
0
Hey all im on linux, behind a linksys router. I did ipconfig eth0 192.168.1.101 255.255.255.0, cause i thot it gives dit that ip, b ut my router keeps changing the ip to 192.168.1.102. ANy idea how to keep it static? Thanks
 

pac1085

Diamond Member
Jun 27, 2000
3,456
0
76
I'm prety sure I remember reading in the manual that if you wanted a static ip, you would have to use 192.168.1.2 - 192.168.1.99. I dont have it handy but I know that the router doesnt assign those IP's to computers using DHCP. It sounds like your system is setup to use dhcp, what distro are you using?
 

spyordie007

Diamond Member
May 28, 2001
6,229
0
0
even so, behind a dhcp server you should be able to HC your IP and it will work just fine. As long as you dont shut your machine down for long periods of time your router will keep it's mac address in it's arp table and shouldnt assign out that IP anywhere else. You could also avoid any IP conflicts by setting your IP to something that will never get assigned 2-99 as ICSVortex suggested, or something higher that has a very low probilbility of getting assigned.

-Spy
 

Kai4Linux

Member
Apr 28, 2002
59
0
0
Well the thing is, I only have two computers. My desktop, and my server. I bootup my desktop first so it gets the 192.168.1.100 ip, then next my server 192.168.1.101. I turn off my desktop but my server is on. It had that 101 ip for a week, then all the sudden it changed to 102. I checked out teh server, and the dhcp release is set for 50000 days.... Hmm I'm on Mandrake 8.2, and i use DHCP. Mandrake detected my ip so im sort of lost on how to change it to static IN CONSOLE. Id like to learn this hehe.

Thanks
 

spyordie007

Diamond Member
May 28, 2001
6,229
0
0
I dont remember, it's been a long time since I've done it from a consol.

"ifconfig en0 down" than do a "man ifconfig" and see if you can figure out how to set it statically, than lastly do an "ifconfig en0 up" make sure to replace en0 with whatever the name of your network interface is, you could do an "ifconfig all" to have it list all of them.

hope my syntax is correct, like I said it's been a while.

Good Luck

-Spy
 

Kai4Linux

Member
Apr 28, 2002
59
0
0
Well the thing is, could i still connect as my router acts as a dhcp router and gateway so.. would it still go through?
 

spyordie007

Diamond Member
May 28, 2001
6,229
0
0
Originally posted by: Kai4Linux
Well the thing is, could i still connect as my router acts as a dhcp router and gateway so.. would it still go through?
Sure, just make sure you set your router's IP as your GW and that your on the same network.

-Spy
 

Bleep

Diamond Member
Oct 9, 1999
3,972
0
0
The router will do dhcp and static at the same time regardless of what linksys says. Just set the router to assign dhcp to addresses starting .100 then any machine you want static assign the address starting at .10. Works every time. You will have to change the configuration on your machine of course.
Bleep
 

Kai4Linux

Member
Apr 28, 2002
59
0
0
.10? You mean 192.168.1.10... so ifconfig eth0 192.168.1.11 255.255.255.0?

I just checked out man ifconfig, it says how to put the ip in, but nothing about static.. .and mandrake overwrites it with dhcp i think on startup.

 

lowtech1

Diamond Member
Mar 9, 2000
4,644
1
0

find -name "ifconfig*" -print
and edit the dhcp range, and leave a small range for static.

Debian: /etc/network/interfaces
 

Kai4Linux

Member
Apr 28, 2002
59
0
0
find -name "ifconfig*" -print

I tried that nothing outputed. Mandrake uses a script called dhcpd.exe (don't ask), which gets your ip and all. I did a man of it, and nothing in their would let you get an ip. Any ideas? thx
 

lowtech1

Diamond Member
Mar 9, 2000
4,644
1
0

I don't know Mandrake, but you coud go Here for graphical walk though setup & diagnostic Mandrake_networking.
 

FUBAR

Senior member
Oct 11, 1999
618
0
0
If mandrake is still a RH clone, you need to edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file to say proto=static and then address=whatever.you.want.ittobe and netmask=whatever...