# Strange behaviour after IP changes



## Ricky (Sep 15, 2012)

Hi, I'm using FreeBSD 8.3. My IP address is being set by DHCP

rc.conf

```
ifconfig_em0="DHCP"
*Other bunch of things like [FILE]apache [/FILE]and [FILE]mysql[/FILE]*
```

But after my IP address changes my machine starts behaving strange. I can't ping anything, either internal or outside world. I tried:
[CMD=""]/etc/rc.d/netif restart[/CMD]
But it doesn't help anything. 

Even to log in through SSH it takes a while, considering that I'm connecting using internal IP it should logged in as fast as a split second (like it usually does before my IP address changes).

Someone have any idea why is this happening? Anyone ever experienced similar problems? Is there anything I can do instead of restart the machine?

Thank you.


----------



## da1 (Sep 15, 2012)

What error do you get when ping-ing?
What device/server is giving you the IP and is it configured correctly (ex: is another machine using DHCP and working correctly?)?
Did you check the routing table and /etc/resolv.conf on your FreeBSD machine?
Did you set [cmd=""]UserDNS no[/cmd] in /etc/ssh/sshd_config, restarted ssh and tried to login again?


----------



## Ricky (Sep 15, 2012)

Hi da1, thank you for helping me.

The machine is directly connected to my router which updates IP address automatic.

/etc/resolv.conf

```
search lan
nameserver 192.168.1.254
nameserver 192.168.1.254
```


----------



## mamalos (Sep 17, 2012)

Ricky,

do you run a firewall on your FreeBSD box? If so, check your configuration.

Moreover, try setting up your DHCP server to give the same IP for your FreeBSD box by using its MAC address.

Good luck.


----------



## m6tt (Nov 4, 2012)

What does netstat -rn look like when failing?

Trying this as root and reacquire the dhcp address (whether re-running rc script or running dhclient on the if)

```
route flush
```


----------

