# Static IP mandrake linux



## Fyzbo (Feb 6, 2002)

I'm in charge of a linux box running mandrake linux in my school's computer science lab. After installing mandrake the ip set up automatically as DHCP with an IP ending in 130. I was asked to change the IP to everything the same only ending in 17. I was told that it should support a static IP, but I can't get it to work. Can anyone possibly list the steps I should take to make this change?

Thank you in advance.


----------



## 5mi11er (Aug 11, 2004)

Well, without further information, we're going to be shooting in the dark...

But, assuming you've been able to use the ifconfig command correctly, and have the ip address, and mask set correctly, more than likely you're default gateway entry is now missing.

Something along the lines of:

```
route add default gw 1.2.3.4
```
where 1.2.3.4 is replaced by the address of the router's interface that is serving that network, should do the trick.

Hope this helps,
-Scott


----------



## tsunam (Sep 14, 2003)

you should have a /etc/conf.d/net (or something similar, its what your /etc/init.d/net.eth0 calls from to boot up eth0) section. if you edit that it'll allow you to change the gateway, dhcp to static etc.


----------



## 141191 (Sep 12, 2004)

Fyzbo,
I don't know Mandrake, but assuming the thing is RedHat based, I think you should have the folder

/etc/sysconfig/network/
or
/etc/sysconfig/network-scripts/

Look for file *ifcfg-eth0* and take a look on it
As _root_ change
IPADDR=nnn.nnn.nnn.17

If you need gateway, just place
GATEWAY=nnn.nnn.nnn.nnn

Then execute (root)
ifdown eth0
ifup eth0

Hope it helps.


----------



## Fyzbo (Feb 6, 2002)

Alright so I was able to change the IP address. Now the computer is on the campus network, other computers can ssh/telnet to it without a problem. However when on the linux box itself can't search the net. I open mozilla and it can't get to any webpages. Any thoughts on this?


----------



## 141191 (Sep 12, 2004)

probably DNS problem.
Do you know DNS server IP address?

If so, execute


> echo "nameserver AA.BB.CC.DD" >> /etc/resolv.conf


 but change AA.BB.CC.DD for that IP


----------



## tsunam (Sep 14, 2003)

also do a route to see where its going on its path to get out. if you don't have anything under it then its a dns/gateway issue. you can try doing a route add gw 10.128.1.30 <--whatever the address is that'd probably get you out as well. Its probably not talking with the dhcp server correctly.


----------

