# Cant Statically set an IP & Resolv.conf is gone after reboot

## Chickenbro

I've been having this problem with this on my Gentoo for a week and yet idk what to do. Im setting up my Gentoo box for a class for college. My machine is suppose to get an IP address of 192.168.1.37 and its getting 169.245.245.206.

My resolve.conf is suppose to be nameserver 192.168.1.20 but after a reboot it keeps erasing it.

my /etc/init.d/net is...

dns_domain_eth0="homenetwork"

config_eth0="192.168.1.37 netmask 255.255.255.0 brd 192.168.1.255"

routes_eth0="default via 192.168.1.1"

dns_servers_eth0="192.168.1.20"

Can anyone help me? My instructor told me I should know why I have that IP and I should know how to change it but I've been trying to change it but failed. hes not really helping me out on this.

----------

## NeddySeagoon

Chickenbro,

Welcome to Gentoo.

Your instructor is asking the right questions.

169.245.245.206 is an address in the link local range. dhcpcd can be made to make up an IP address in this range when it cannot get an IP address either statically or from a dhcp server (your router).  Link local addresses are only useful for a group of isolated computers, such as an ad-hoc wireless network.  They are not routable.

A static configuration, such as your net file provides for eth0 should work.

However, it might not be called and eth0 is being started somehow else.

What does 

```
rc-update -v show
```

 produce? 

```
net.eth0 |      default
```

should be in the output somewhere.

----------

## DONAHUE

dns_domain_eth0="homenetwork"  causes an overwrite of /etc/resolv.conf where resolv does not have an e on the end. remove dns_domain_eth0="homenetwork" from /etc/conf.d/net. 

run

```
 ifconfig -a

ifconfig
```

 both should show eth0 if the device exists and has a driver (-a) and if the device exists and has a driver and has been started (no -a).

there is a possibility that your first ethernet NIC has been given a uinique name instead of eth0

----------

## Chickenbro

I used rc-update -v show | less to look at all and I see a net.lo but no net.eth0. I tried to do as much as everyone else in my class had in their files but I probably did something different and yet did not know what I did wrong.

----------

## NeddySeagoon

Chickenbro,

What interfaces does 

```
ifconfig -a
```

 show?

If eth0 is listed, check that you have a symlink called /etc/init.d/net.eth0  that points to net.lo

Make the simlink if you need to.

Now add net.eth0 to your default runlevel, so its started every boot.

Lastly, run 

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

to attempt to start eth0.

I suspect you have other problems, as you have dhcpcd, and it gave you a link local address.  It only does this if it cannot contact a dhcp server.

If you have several wired network interfaces, your network cable may not be connected to the one that is now eth0.

As DONAHUE says - you might not even have an eth0

----------

## Chickenbro

I found out I didnt use the rc-update add net.eth0. after doing that I have my static IP. Now I have to get access from another machine. That's my only problem now to work on my website. thanks for all your guys help and if you can help me with this, I would really appreciate it!

I now have it that when I ping my default gateway and my DNS to be unreachable then not able to reach it when I ping.

----------

## NeddySeagoon

Chickenbro,

You should start sshd on your Gentoo.

Add sshd to the default runlevel

Start it with

```
/etc/init.d/sshd start
```

This may take minutes as it has to make keys on the first start.  Move the mouse and press random keys while it starts. This suppies 'randomness' to the random number generator. Its required to make sure you get good keys.

With sshd running, you can ssh into Gentoo.

On another system on the network, run 

```
ssh root@192.168.1.37
```

to connect to your Gentoo.

Give the root password at the challenge.

Its a very bad thing to allow connections like this as root but thats another topic. Do not permit it on a system accessable from the internet.

----------

## Chickenbro

I already have sshd started. I know I got that started a while back when I was doing the IP set but when I ping those 2 addresses says Destination Host Unreachable. I have a classmate who he assigned us the IP addresses that was giving by my instructor and I might ask him what I need help with tomorrow during class when we develop more in class.

----------

## solamour

Colleges have a class that teaches you how to setup Gentoo? How cool is that? It should be a mandatory class for all engineering students. Seriously.

__

sol

----------

## DONAHUE

can you ping the router? 

```
ping -c2 192.168.1.1
```

----------

## krinn

 *solamour wrote:*   

> Colleges have a class that teaches you how to setup Gentoo?

 

I'm not sure about the "teaching" seeing how the instructor behave  :Smile: 

Or is another "sleepy student" that cheat with gentoo forum to make his work ?

----------

