# Routing issue



## Abstract (Apr 13, 2011)

Hi Everyone,

I'm using FreeBSD version 8.1. I just installed a new internet modem given to me by my isp. They changed the internal ip address from 192.168.1.* to 192.168.2.* . I did get a new ip from the dhcp server by using the following command:

`dhclient em0`

I did restart the routing by using the following command:
`/etc/rc.d/routing restart`

Then I added the following to the file /etc/rc.conf:

```
defaultrouter="192.168.2.254"
```

But when I try to ping the servers that need to be backed up I'm getting this message:

```
ping: sendto: No route to host
```

When I look up the routing statistics I find the following. I've the feeling the line which starts with 192.168.1.0/24 is the reason for my problems. Does anyone has an idea what I could do to fix the routing again? 

netstat -rn

```
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
127.0.0.1          link#3             UH          0        4    lo0
192.168.1.0/24     link#1             U           0 83516320    em0
192.168.2.0/24     link#1             U           3     1112    em0
192.168.2.2        link#1             UHS         0        0    lo0

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::1                               ::1                           UH          lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff01:3::/32                       fe80::1%lo0                   U           lo0
ff02::%lo0/32                     fe80::1%lo0                   U           lo0
```

The problem only exists on this server. The other computer are able to find the routes to the servers that need to be backed up. 

Thank you for any help!


----------



## lbol (Apr 13, 2011)

you don't have a default route
`% netstat -rn` 
should show a line with Destination = "default" and Gateway = "192.168.2.254"

You can either manually delete routes for the old network 192.168.1 and add the default route or reboot if this is an option.


----------



## Abstract (Apr 13, 2011)

Hi lbol,

You are completely right. I just added the default route by using the following command:


```
route add default 192.168.2.254
```

When I ping my servers now these response, so it all works again. There is one thing that I don't understand yet. When I type ifconfig I see the following:


```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
        ether 20:cf:30:51:07:32
        inet 192.168.1.74 netmask 0xffffff00 broadcast 192.168.1.255
        inet 192.168.2.2 netmask 0xffffff00 broadcast 192.168.2.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
```

Why is my old ip address still listed, why is that? 


```
inet 192.168.1.74 netmask 0xffffff00 broadcast 192.168.1.255
```

Thank you for all the help!


----------



## SirDice (Apr 13, 2011)

You do not need to specify a defaultrouter in /etc/rc.conf, this is taken care of by dhclient.

The 'old' IP address is still listed because it's still valid, it's lease hasn't expired.


----------



## lbol (Apr 13, 2011)

dhclient has just added a second IP address to your interface
Try `# ifconfig em0 192.168.1.74 -alias`


----------



## Abstract (Apr 14, 2011)

Hi everyone,

Thank you for the information and help. When I looked this morning the old IP address had been removed from the *ifconfig* table. Problems are solved.


----------

