# IP always change back to the orginal automatically [solved]

## diablo465

I need to change my mac address to log on a network so that the machine can get ip address. 

I usually use

```
ifconfig enp6s0 hw ether aa:bb:cc:dd:ee:ff
```

or 

```
ip link set dev enp6s0 adress aa:bb:cc:dd:ee:ff
```

after that,  one can see from ifconfig that the address has been changed to the one desired. 

But, once dhcp starts off requesting ip, the ip address changes back to the original one the network card has, which results in no ip to the network system .

Gentoo used to work well using the abovementioned method. An recent update has caused this new problem. The UBUNTU system installed in the same computer still can get ip after using the abovementioned command.Last edited by diablo465 on Wed Dec 10, 2014 10:29 pm; edited 1 time in total

----------

## Schnulli

recompile your Kernel without DHCP-Auto , that would help you if you still want to use DHCPCD, i kicked it bec. the kernel can manage it fine  :Wink: 

And dont forget to change/set your Symlinks in /etc/conf.d/ if your still on udev , the udev rules could be as well a reason, check them  :Wink: 

<*> Packet socket                                                                                                                      │ │  

  │ │                                                                 < >   Packet: sockets monitoring interface                                                                                             │ │  

  │ │                                                                 <*> Unix domain sockets                                                                                                                │ │  

  │ │                                                                 < >   UNIX: socket monitoring interface                                                                                                │ │  

  │ │                                                                 <M> Transformation user configuration interface                                                                                        │ │  

  │ │                                                                 [*] Transformation sub policy support                                                                                                  │ │  

  │ │                                                                 [*] Transformation migrate database                                                                                                    │ │  

  │ │                                                                 [*] Transformation statistics                                                                                                          │ │  

  │ │                                                                 <M> PF_KEY sockets                                                                                                                     │ │  

  │ │                                                                 [ ]   PF_KEY MIGRATE                                                                                                                   │ │  

  │ │                                                                 [*] TCP/IP networking                                                                                                                  │ │  

  │ │                                                                 [*]   IP: multicasting                                                                                                                 │ │  

  │ │                                                                 [*]   IP: advanced router                                                                                                              │ │  

  │ │                                                                 [ ]     FIB TRIE statistics                                                                                                            │ │  

  │ │                                                                 [*]     IP: policy routing                                                                                                             │ │  

  │ │                                                                 [*]     IP: equal cost multipath                                                                                                       │ │  

  │ │                                                                 [ ]     IP: verbose route monitoring                                                                                                   │ │  

  │ │                                                                 [*]   IP: kernel level autoconfiguration                                                                                               │ │  

  │ │                                                                 [*]     IP: DHCP support         ###!! deselect it if you want to use dhcpcd instead                               │ │  

  │ │                                                                 [ ]     IP: BOOTP support                                                                                                              │ │  

  │ │                                                                 [ ]     IP: RARP support

----------

## diablo465

Thanks, deselecting DHCP support does help to preserve the new ip address. 

But Somehow the laptop still can not get ip properly, which may result from some other reason. 

I will mark this one solved.

----------

## szatox

I suppose you're trying to use several ways to configure your network at the same time.

If you want to configure it manualy, remove net services from default runlevel.

If you want to configure network with static IP, use init scripts with static IP rather than automagic (e.g. empty config default to DHCP)

If you want to use DHCP set server correctly and don't mess with it manually. Half way through lease's lifetime it will attempt to rebind IP, so you can only be sure your setup will fail, sooner or later.

Finaly, if you use several networks and switch often, using some kind of manager might be the best way for you. There are plenty of those lying around, like networkmanager or wicd.

Pick ONE that suits your need. One. Not 2, not 3. They will conflict, possibly in ways you don't expect, but you will notice when it happens. And you likely will not know what the cause is.

----------

## diablo465

 *Quote:*   

> 
> 
> I suppose you're trying to use several ways to configure your network at the same time. 
> 
> If you want to configure it manualy, remove net services from default runlevel. 
> ...

 

Thanks @szatox. I am trying to narronw down where am I and where to go in terms of the three methods to configure network. 

I feel that I am under the third method. Currently networkmanager is enabled. but I am not sure how to figure out the commands that will be automatically excuted after the plugging in the network cable. Maybe there are several commands executed at the same time which are muturally conflicting, which causes the system stopped getting IP.

----------

## diablo465

I have disabled the dhcpcd by 

```
 systemctl disable dhcpcd.service 
```

and disabled DHCP support in the kernel config

after plug in the network cable with changed ip, everything is working fine now.

----------

