# Setting a Static IP

## SnackMasterX

I'm having problems trying to get my newly built server to accept the static IP's I assign it, I tried following the gentoo handbook but it hasn't seemed to work and I'm thinking I might have missed something but wanted to get another opinion. Essentially my /etc/conf.d/net looks like this

```
config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )

routes_eth0=( "default via 192.168.0.1" )

```

In mine of course are the real values, this was just a copy and paste from the gentoo handbook. Am I supposed to be doing something different or changing something? my adapter is net.eth2 (unsure how to rename it to net.eth0)

Thanks in Advance!

----------

## 1clue

Did you:

cd /etc/init.d

ln -s net.lo net.eth0

rc-update add net.eth0 default

?

----------

## SnackMasterX

I noticed that NetworkManager was still in the default stage on rc-update, removed that and deleted net.eth0 then ran

```
ln-s net.lo net.eth0
```

Now I have no net.eth devices showing up after boot, I was running an older kernel (it was a system that I'm just updating) so I'm going to try and update the kernel and see if I need a module for this NIC. Used this install on an old motherboard that went bad but it booted up fine on this one.

----------

## SnackMasterX

So here is what I've discovered so far, I ran "lspci -a" and it showed net.eth2 but no net.eth0 or net.eth1, so I ran the following within /etc/init.d

```
ln -s net.lo net.eth2

/etc/init.d/net.eth2 start
```

Then it instantly turned on and used the configuration under /etc/conf.d/net

So this is progress, however is there a way I can change it from net.eth2 to net.eth0? This was installed on a different motherboard as mentioned previously however that board died and has been replaced, thought it might be easier to use the already in place system and just modify/update it for this new motherboard and so far its taken much less time than actually starting from scratch.

----------

## 1clue

You're running out of my experience a bit.  Every time I've started with a new board I scrape off the drive and start over.

I'm not really an expert here, but what it seems to me is that you have more than one network device, and the others are being recognized first.

Or maybe you have some hard-configured devices from the previous board which no longer exist, and they're being put in first.

Whatever the case, you have something using up eth0 and eth1, or something is specifically loading your module in eth2.  In my experience, leaving the configuration bare and just booting generally puts any fully attached card onto the net through DHCP, and it is usually in the order of discovery.

I would try to figure out what modules are loading in association with which cards, which you can get both through lsmod and lspci -k.

Other than what's been said here I would really need to do some digging through the docs.

Maybe somebody else can step in and help.

----------

## SnackMasterX

Well for the moment I can get it connected to the internet automatically after a reboot so I'm not too concerned about renaming the device, a name is less important than functionality  :Smile: 

Thanks for the help though, I wouldn't have tried the ln -s without your suggestion, much appreciated!

----------

## Hu

Normally, udev remembers your past NICs and reserves their names in case they return.  If you know they will not be returning, you can delete the persistent-net rules file to make udev forget them and start fresh from eth0.

----------

## ewaller

can you post your /etc/udev/rules.d/70-persistent-net.rules file?

----------

## SnackMasterX

I did that and it fixed the problem, now I just need to figure out why my ssh connections are being refused :-\

*edit* Actually I bet its the key that my computer stored, that probably needs to be cleared

----------

