# Can't configure internet connection through VirtualBox



## mack11 (Sep 12, 2013)

Hi. I have FreeBSD 8.4 as  a guest and Windows XP as a host (VirtualBox 4.0.10 r72479).

FreeBSD's interface is configured via a network bridge. The DNS server address is 192.168.0.222, the gateway is 192.168.0.2. Pinging the LAN is OK, but pinging out yields

```
cannot resolve ...: Host name lookup failure
```

/etc/rc.conf:

```
gateway_enable="YES"
tcp_extensions="YES"
ifconfig_em0="inet 192.168.0.107  netmask 255.255.255.0"
defaultrouter="192.168.0.2"
hostname="gate.irb.local"
```

/etc/hosts:

```
::1                     localhost localhost.irb.local
127.0.0.1               localhost localhost.irb.local
192.168.0.107           gate.irb.local gate
```

/etc/resolve.conf:

```
domain  irb.local
nameserver      192.168.0.222
```

`netstat -rn`

```
Routing tables

Internet:
Destination       Gateway           Flags    Refs      Use  Netif     Expire
default           192.168.0.2       UGS         0        0    em0
127.0.0.1         link#2            UH          0        0    lo0
192.168.0.0/24    link#1            U           0       98    em0
192.168.0.107     link#1            UHS         0        0    lo0
```

Thanks.


----------



## wblock@ (Sep 12, 2013)

Firewall blocking access to the DNS server?  What DNS server is being used by the host?


----------



## ShelLuser (Sep 12, 2013)

Obviously a DNS issue, most likely something on 192.168.0.122 is blocking your host. Still, it is possible that the problem lies somewhere else. If you could show us your /etc/nsswitch.conf then we can be more sure (this file basically tells the system where to do name lookups).

You can also do a test yourself by simply pinging a remote IP address. For example Google's public DNS server: 8.8.8.8. When that works then the issue is most definitely DNS related.


----------



## mack11 (Sep 13, 2013)

DNS on Windows 2008 Server-192.168.0.222  



```
root@gate:~ # cat /etc/nsswitch.conf
#
# nsswitch.conf(5) - name service switch configuration file
# $FreeBSD: release/8.4.0/etc/nsswitch.conf 158266 2006-05-03 15:14:47Z ume $
#
group: compat
group_compat: nis
hosts: files dns
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files
```

 Ping to 8.8.8.8 fails.


----------



## wblock@ (Sep 13, 2013)

Windows "firewall" blocking DNS or maybe all network access to VirtualBox, I bet.  Also, Microsoft is terrified of ICMP, frequently refusing those scary packets, and the NAT in VirtualBox complicates it anyway, so pings may not be a reliable indicator of connection.


----------



## mack11 (Sep 16, 2013)

I installed FreeBSD on a real machine that is connected to the gateway. The firewall on the gateway is disabled. The problem is not solved. Already I do not know what to think.


----------



## wblock@ (Sep 16, 2013)

How does it not work?  Please show /etc/rc.conf and the output of `ifconfig`.  It is often helpful to run dhclient(8) and see what DHCP hands out for gateway and DNS servers.


----------



## junovitch@ (Sep 16, 2013)

Also, it's /etc/resolv.conf not /etc/resolve.conf like your first post shows.


----------



## mack11 (Sep 17, 2013)

```
[CMD]cat /etc/rc.conf[/CMD]
# -- sysinstall generated deltas -- # Tue Sep 17 10:23:08 2013
# Created: Tue Sep 17 10:23:08 2013
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
defaultrouter="192.168.0.2"
hostname="freeBSD.irb.local"
ifconfig_fxp0="inet 192.168.0.108  netmask 255.255.255.0"
keymap="ru.koi8-r"
sshd_enable="YES"
```


```
[CMD]ifconfig[/CMD]
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=2009<RXCSUM,VLAN_MTU,WOL_MAGIC>
        ether 00:13:20:5a:05:1a
        inet 192.168.0.108 netmask 0xffffff00 broadcast 192.168.0.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 0x8
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
```

The computer has a static IP addresses. From the LAN it pings OK, but 8.8.8.8 gives a failure.


```
[CMD]netstat -rn[/CMD]
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.0.2        UGS         0      546   fxp0
127.0.0.1          link#8             UH          0        0    lo0
192.168.0.0/24     link#6             U           0      531   fxp0
192.168.0.108      link#6             UHS         0        0    lo0
```


```
ping: cannot resolve google.com: Host name lookup failure
```


----------



## SirDice (Sep 17, 2013)

Please show the output of `traceroute -n 8.8.8.8`.

And ping the IP address, not the hostname.


----------



## mack11 (Sep 18, 2013)

Friends, thanks a lot for the help, the problem was solved. The server was not configured to forward requests through a proxy. Now everything is working, thanks.


----------

