# Network configuration of KVM client



## inch (Jul 31, 2013)

Hello, I'm running FreeBSD 8.3 in a KVM VM and can't get the network working.

IP address of your server: 31.193.xxx.xxx
Gateway: 151.236.xxx.xxx
Subnet: 255.255.255.255
Primary DNS Server: 208.67.xxx.xxx
Secondary DNS Server: 208.67.yyy.yyy

rc.conf:

```
hostname="asdf"
ifconfig_em0="inet 31.193.xxx.xxx netmask 255.255.255.255"
defaultrouter="151.236.xxx.xxx"
```

`ifconfig em0`:

```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL>
        ether x:x:x:x:x:x
        inet 31.193.xxx.xxx netmask 0xffffffff broadcast 31.193.xxx.xxx
        media Ethernet autoselecty (1000baseT <full-duplex>)
        status: active
```

`service routing restart`:

```
::                ::1                done
::ffff:0.0.0.0    ::1                done
route: writing to routing socket: Network is unreachable
add net default: gateway 151.236.xxx.xxx: Network is unreachable
add net ::ffff:0.0.0.0 gateway ::1
add net ::0.0.0.0: gateway ::1
```

Every ping responds with a "Host name lookup failure". What am I missing? To confirm that the gateway/IPs provided by my hoster are working, I quickly installed Gentoo to confirm that they are indeed correct.


----------



## SirDice (Aug 1, 2013)

inch said:
			
		

> IP address of your server: 31.193.xxx.xxx
> Gateway: 151.236.xxx.xxx
> Subnet: 255.255.255.255
> 
> ...



Your default gateway is outside of the subnet your interface is in. Try setting the default gateway like this: 
	
	



```
defaultrouter="-iface em0"
```


----------



## inch (Aug 1, 2013)

Hi, thanks for your reply.

`service routing restart`

```
::                ::1                done
::ffff:0.0.0.0    ::1                done
route: writing to routing socket: File exists
add net default: gateway em0: route already in table
add net ::ffff:0.0.0.0 gateway ::1
add net ::0.0.0.0: gateway ::1
```

No more errors but the connection isn't working. inet and broadcast are the same btw.


----------



## inch (Aug 3, 2013)

Any ideas or additional information I could provide? `dmesg` says nothing and I don't know where to look further.


----------

