How to connect usb enclosure to guest

Discussion in 'Server Operation' started by satimis, Aug 1, 2008.

  1. satimis

    satimis Member

    Hi folks,


    Ubuntu 8.04 server amd64 - host
    Ubuntu 6.06 server amd64 - guest
    KVM 1:62+dfsq
    UBS enclosure


    Please advise how to mount the USB enclosure to guest. It can be mounted on host. Pointer would be appreciated. TIA


    B.R.
    satimis
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What do you mean with USB enclosure? An external USB dribe? You could do this through NFS.
     
  3. satimis

    satimis Member

    Hi falko,


    Yes, it is similar to external HD, an ATA HD installed on the USB enclosure.



    I found following guide
    https://help.ubuntu.com/community/SettingUpNFSHowTo


    which I suppose may help me out. But I haven't figured out how to setup static IP on guest OS. It is now working on dynamic IP.



    Host;

    $ cat /etc/network/interfaces
    Code:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    
    auto eth0
    iface eth0 inet manual
    
    
    # The primary network interface
    auto br0
    iface br0 inet static
            address 192.168.0.110
            netmask 255.255.255.0
            network 192.168.0.0
            broadcast 192.168.0.255
            gateway 192.168.0.1
            bridge_ports eth0
            bridge_fd 9
            bridge_hello 2
            bridge_maxage 12
            bridge_stp off
    

    Guest;

    $ cat /etc/network/interfaces
    Code:
    auto lo
    iface lo inet loopbak
    
    # The primary network interface
    auto eth0
    iface eth0 inet dhcp
    

    $ ifconfig
    Code:
    ...
    inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
    ....
    


    Host;

    $ cat /etc/libvirt/qemn/networks/default.xml
    Code:
    <network>
      <name>default</name>
      <uuid></uuid>
      <bridge name="virbr%d" />
      <forward/>
      <ip address="192.168.122.1" netmask="255.255.255.0">
        <dhcp>
          <range start="192.168.122.2" end="192.168.122.254" />
        </dhcp>
      </ip>
    </network>
    

    Please shed me some light. TIA


    B.R.
    satimis
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Try this:

    Code:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    # The loopback network interface
    auto lo
    iface lo inet loopback
    # The primary network interface
    auto eth0
    iface eth0 inet static
            address 10.0.2.15
            netmask 255.255.255.0
            network 10.0.2.0
            broadcast 10.0.2.255
            gateway 10.0.2.1
     
  5. satimis

    satimis Member

    Hi falko,


    Before testing your advice. I found following problem;


    Ubuntu 6.06 server amd64 - guest
    Ubuntu 8.04 server amd64 - host
    KVM


    Guest can run "apt-get update/upgrade" but unable to ping Internet/gateway/host, 100% package loss


    $ telnet localhost 25
    Code:
    Trying 127.0.0.1....
    telnet: Unable to connect to remote host: Connection refused.
    

    Guest;

    $ cat /etc/network/interfaces
    Code:
    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet dhcp
    

    $ ifconfig
    Code:
    eth0	  Link encap:Ethernet  HWaddr 52:54:00:12:34:56
    	  inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
    	  inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:Link
    	  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    	  RX packets:175 errors:0 dropped:0 overruns:0 frame:0
    	  TX packets:249 errors:0 dropped:0 overruns:0 carrier:0
    	  collisions:0 txqueuelen:1000
    	  RX bytes:31829 (31.0 KiB)  TX bytes:31819 (31.0 KiB)
    	  Interrupt:11 Base address:0x6000
    
    lo	  Link encap:Local Loopback
    	  inet addr:127.0.0.1  Mask:255.0.0.0
    	  inet6 addr: ::1/128 Scope:Host
    	  UP LOOPBACK RUNNING  MTU:16436  Metric:1
    	  RX packets:41 errors:0 dropped:0 overruns:0 frame:0
    	  TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
    	  collisions:0 txqueuelen:0
    	  RX bytes:3156 (3.0 KiB)  TX bytes:3156 (3.0 KiB)
    

    Host;

    $ cat /etc/network/interfaces
    Code:
    auto lo
    iface lo inet loopback
    
    
    auto eth0
    iface eth0 inet manual
    
    
    # The primary network interface
    auto br0
    iface br0 inet static
            address 192.168.0.110
            netmask 255.255.255.0
            network 192.168.0.0
            broadcast 192.168.0.255
            gateway 192.168.0.1
            bridge_ports eth0
            bridge_fd 9
            bridge_hello 2
            bridge_maxage 12
            bridge_stp off
    

    $ ifconfig
    Code:
    br0       Link encap:Ethernet  HWaddr 00:0e:a6:f9:a3:5b
              inet addr:192.168.0.110  Bcast:192.168.0.255  Mask:255.255.255.0
              inet6 addr: fe80::20e:a6ff:fef9:a35b/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:53674 errors:0 dropped:0 overruns:0 frame:0
              TX packets:85945 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:3310146 (3.1 MB)  TX bytes:19758025 (18.8 MB)
    
    eth0      Link encap:Ethernet  HWaddr 00:0e:a6:f9:a3:5b
              inet6 addr: fe80::20e:a6ff:fef9:a35b/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:53674 errors:0 dropped:0 overruns:0 frame:0
              TX packets:85946 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:4061600 (3.8 MB)  TX bytes:20372743 (19.4 MB)
              Interrupt:249 Base address:0x2000
    
    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:84 errors:0 dropped:0 overruns:0 frame:0
              TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:7462 (7.2 KB)  TX bytes:7462 (7.2 KB)
    
    vnet0     Link encap:Ethernet  HWaddr 4a:e2:d1:69:60:1b
              inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
              inet6 addr: fe80::48e2:d1ff:fe69:601b/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 B)  TX bytes:468 (468.0 B)
    

    Please advise how to fix the problem. TIA

    Remark: iptables is NOT running


    B.R.
    satimis
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Please add this at the end of /etc/network/interfaces in the vm:

    Code:
    up route add -net 10.0.2.0 netmask 255.255.255.0 gw 10.0.2.1 eth0
    Restart the network afterwards.
    Is 10.0.2.1 the correct gateway?
     
  7. satimis

    satimis Member

    Hi falko,

    Edit /etc/network/interfaces as advised.

    $ sudo /etc/init.d/networking restart
    Code:
     * Reconfiguring network interfaces ...
    [ 2254.660148] br0: Dropping NETIF_F_UFO since no NETIF_HW_CSUM feature.
    SIOCADDRT: No such process
    Failed to bring up br0.                   [OK]

    Yes, I did it according to your previous advice. But there was a problem on restarting the network.

    $ sudo /etc/init.d/networking restart
    Code:
     * Reconfiguring network interfaces ...
    SIOCADDRT: No such process                    [OK]

    Still fail to ping network.

    $ ping -c3 yahoo.com
    Code:
    Ping yahoo.com (28=06.190.68.37) 56(84) bytes of data.
    From 10.2.15 icmp_seq=1 Destination Host Unreachable
    From 10.2.15 icmp_seq=2 Destination Host Unreachable
    From 10.2.15 icmp_seq=3 Destination Host Unreachable
    ....
    ......... +3 errors, 100% packet loss ....
    

    satimis
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Did you add the line on the guest or on the host? Must be on the guest.
    Have you tried to reboot the system?
     
  9. satimis

    satimis Member

    Also tried adding the line on guest plus reboot guest as well as host.


    The situation was even worse unable to run "apt-get update" but "apt-get upgrade" did work.

    $ ping -c3 10.0.2.15 (guest LAN IP)
    worked without packet loss

    $ ping -c3 10.0.2.0 (network)
    Code:
    Do you want to ping broadcast?  Then -b
    

    $ ping -c3 yahoo.com
    $ ping -c3 google.com
    Ping unknown host ....


    $ cat /etc/resolv.conf
    Code:
    nameserver 10.0.2.3
    nameserver 202.14.67.4
    nameserver 202.14.67.14
    
    DNS of ISP


    B.R.
    satimis
     
    Last edited: Aug 6, 2008

Share This Page