VirtualBox – Sharing Folder between Windows Host and Linux Guest (Fedora)

June 4, 2011

Sharing Folder with Host System

To share network folders, you need to configure a share folder with a share name in the virtual machine settings.

Then in Linux, you need to mount the share folder using VirtualBox file system:

#mount –t vboxfs name_of_share_folder /mnt/mount_point

Please note that the above mounted folder is owned by root. To allow user to own the files and folder use the command:

#mount -t vboxsf -o uid=1000,gid=1000 name_of_share_folder /mnt/mount_point

Where uid is the user id and gid is the group id. If you want to have it mount automatically upon each boot, put the mount command in /etc/rc.local. Using /etc/fstab has little effect, because that  file is processed before the SF module is loaded and will fail to mount the share.


Basic Network Configuration in Linux

December 14, 2009

This network configuration guide is based on Fedora.

Configuration Tools

Text console configuration tool:

  • /usr/sbin/system-config-network-tui
  • /sbin/ifconfig

Using ifconfig:

  • ifconfig – display running network configuration
  • ifconfig -a – display all (running or not running network device) network configuration
  • ifconfig <interface> up – bring up the specified interface network
  • ifconfig <interface> down – bring down the specified interface network
  • ifconfig eth0 netmask – setup a network interface with a specific IP address and sub-net mask
  • For further usage check #man ifconfig

Network Configuration Files

/etc/sysconfig/network – Defines your network and some of its characteristics.

The settings are:

  • HOSTNAME=localhost.localdomain

/etc/sysconfig/network-scripts/ifcfg-eth* – This is a configuration file for each network interface card. For eth0 the path would be /etc/sysconfig/network-scripts/ifcfg-eth0

The settings are permanent; some of the entries are shown below:

  • DEVICE=eth0
  • HWADDR=00:03:10:22:45
  • #For permanent fixed IP address
  • ONBOOT=yes
  • BOOTPROTO=none

/etc/networks – Provides a database of network names with network addresses similar to the /etc/hosts file.

The settings are:

  • Default
  • Loopback
  • Link-local

/etc/hosts – Defines local hosts.

The settings are:

  •  localhost  localhost.localdomain
  • mymachine

/etc/host.conf – Specifies order to search for host name for name resolution.

The settings are:

  • Multi on
  • Order hosts, bind

/etc/resolv.conf – Contains the address of name server

The settings are:

  • Nameserver

Configuring Ethernet Manually

Fixed IP

  • Ifconfig to set IP address and bring up the network card

#ifconfig eth0 netmask up

  • To setup the network routing

#route add -net netmask eth0

  • Use route add or ip to add default gateway

#route add default gw eth0

  • DNS for the network

Add “nameserver” at /etc/resolve.conf

  • Note: Please note that the above measure is temporary. To permanently set ip address, gateway and dns use system-config-network-tui.
  • Once you set fixed IP, netmask, gateway and DNS. The information will be recorded in etc/sysconfig/network-scripts/ifcfg-eth* as follows;
    • DEVICE=eth0
    • HWADDR=00:05:20:15:36
    • #For permanent fixed IP address
    • IPADDR=
    • NETMASK=
    • ONBOOT=no
    • BOOTPROTO=none
  • Note: If you have hard coded fixed IP in the config file ifcfg-eth*, if you type #ifconfig eth0 up, it will not configure the fix IP from the file, the eth0 is up with no address assigned.
  • Therefore, a proper way to completely bring up and down the network interface card (NIC) is to use #ifup and #ifdown instead of ifconfig.
  • If eth0 is down for some reason, using #ifup eth0 will turn on the NIC with all address, gatway and DNS configure in the file
  • The console utility (system-config-network-tui) do not have the ability to set the configuration such that eth0 is turn on during startup, to do this we must manually change to ONBOOT=yes.
  • If eth0 still will not turn on during startup; this is because the service network is not turn on.
  • To turn on the network service during startup, use the command #service network start
  • To permently turn on the network service #chkconfig network on

DHCP Client

  • If inside the file ifcfg-eth0,the entry ‘BOOTPROTO = none’ or there is no entry on BOOTPROTO use the following:
    • #ifup eth0
    • #dhclient
  • If inside the file ifcfg-eth0, the entry ‘BOOTPROTO = dhcp’ use the following:
    • #ifup eth0
  • Note: To configure BOOTPROTO just run the utilities system-config-network-tui
  • However, the console utility do not have the ability to set the configuration such that eth0 is turn on during startup, to do this we must manually change the file etc/sysconfig/network-scripts/ifcfg-eth*; ONBOOT=yes
  • Then make sure service Network is started and set to turn on permanently with the command #chkconfig network on

Alternative method of starting network

  • Add the following at /etc/rc.d/rc.local
    • # ifup eth0
  • or
    • # dhclient eth0
  • Note: Using local startup script, there is no need to turn on network services

Network Manager (New)

  • A new way of managing network is to install the package NetworkManager which does the management of network automatically.
  • NetworkManager is designed to replace all other network configuration. It includes all types of network from Ethernet to wireless network.
  • Use the command #yum install NetworkManager
  • Using NetworkManager, you still need tp ensure that the settings for eth* is setup properply. You need to ensure that ONBOOT=yes.