advanced_networking_linux – oracle vm virtualbox

Upload: renato-vasques-beraldo

Post on 02-Apr-2018

243 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Advanced_Networking_Linux Oracle VM VirtualBox

    1/3

    Advanced Network settings for Linux

    Contributed by Jean-Jacques Sarton, 2007/03/21

    The virtual machine may be fully integrated into the network and you may have access between

    all virtual machine and the host if you do a little bit more.

    A bridge can contain only one physical/virtual device. So you can create your bridge as follow:

    #!/bin/sh# set PATH for the case we are called via sudo or su rootPATH=/sbi

    With this code you will be able to contact the virtual machine attached to the Host Interface

    tap1 from the host and the host from the virtual machine. The IP adress should not conflict with

    the main IP address of your PC which will probably been within the range 192.168.0.0/16.

    With these settings we will not have an access to the external world from the virtual machine.

    How to do this will be explained later.

    If we plan to use more as one virtual machine we can add further tap devices to the bridge. The

    script can be modified as follow:

    #!/bin/sh# set PATH for the case we are called via sudo or su rootPATH=/sbi

    Now we will be able to start the virtual machines 1 to n, the virtual machine are to be attached to

    tap1, tap2, ...tapn.

    Settings within the virtual machines. You may use the tools provided by the guest system in order

    to configure the device used for the network connection or set the ip address manually or via a

    script. On linux the commands which are to be called manually are:

    ip link set up dev eth0ip addr add 10.1.1.2/24 dev eth0ip route add default

    You must also edit the file /etc/resolv.conf in order to be able to resolve network names such as

    www.virtualbox.org or local names. The content of this file can be the same as for the resolv.conf

    file on your computer.

    You may also assign the address via DHCP, in this case the dhcpd daemon must work on the host

    machine. A simple configuration shall look as follow:

    ddns-update-style interim;ignore client-updates;subnet 10.1.1.0 netmask 255.

    If you want to use zeroConf rendez-vous/Bonjour for automatic setting of the IP address for the

    guests you shout use an addres in the range 169.254.0.0/16 for the host eg 169.254.0.1.

    Connecting the internal network to the world.

    With the above scenario we don't have access to the wide world and will not ne able to update a

    guest system or download anythings. In order ot get this working we must configure the main

    system so that it do NAT.

    The simplest way should be to insert the interface used for the connection to the internet and

    using the dhcp server provided by the router (if you are attached to the internet via a DSL

    router). I we do so, all systems can reach the web and you may surf or download files within your

    virtual machine.

  • 7/27/2019 Advanced_Networking_Linux Oracle VM VirtualBox

    2/3

    If you want that the machine are not normally connected to the wide world you can set you host

    machine (and unset it) for a temporary connection to the world.

    Sett ing NAT can be do with the following code

    INTIF="br0"EXTIF="eth0"echo 1 > /proc/sys/net/ipv4/ip_forward# clear existi

    If a firewall is already installed you may also enable/disable the access to the internet calling:

    # insert NAT ruleiptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE# enabl

    and disabling the internet access with:

    # remove NAT ruleiptables -t nat -F# disable forwardingecho 0 > /proc/sys/ne

    Connection via Ipv6

    Since the Ipv6 Address range is limited to approximately 3.59 addresses and most of them are alreadyused, the next generation of the Internet protocol was developed. A major advantage of Ipv6 is that there are

    enough room for providing all systems with unique and world wide valid without the need of special thinks as NAT

    or STUN. With the advance of technology and use of IP based services for computers, IP-based telephones and so

    on the need of an extended range of IP address increase considerably.

    With IPv6 the full connectivity to the net will become real and the communication between

    different systems will be easier.

    All major OS (BSD, Linux Mac OS X and other UNIX like systems support actually IPv6. This is also

    the case for Windows Vista and Windows XP (on XP you may need some supplements from

    Microsoft).

    If you have a connection to the IPv6 world via a provider as SIXXS.NET or use 6to4 (Protocol 41)

    you will get an IPv6 main Address and have the possibility to use own segments for your local

    network. Each of the systems will be connected to the IPv6 network without the need of NAT and

    so on.

    For this case we assume that you will try IPv6 on a virtual machine and get your first experiences

    with IPv6 based network.

    A further assumption is that you have a fix IPv6 address from sixxs.net or an other supplier and

    also the ability to configure your own segment.

    The address you will get may look as 2001:XXXX:YYYY:ZZZZ::2 (XXXX, YYYY ans ZZZZ arehexadecimal coded values). This will be the main address for connection to IPv6 via a tunnel. If

    your supplier provide you with the ability to use segments you will get the main part of the IPv6

    Address you may use (Prefix) and this should be 2001:XXXX:SSSS::/48 XXXX. You can with this

    use the prefixes 2001:XXXX:SSSS:0000::/64 up to 2001:XXXX:SSSS:ffff::/64 within your IPv6

    network.

    For the bridge you will need an own interface or tap device, it shall not be connected to your

    main interface port.

    A script for setting the bridge look as for the example above, there are only a fews differences.

    #!/bin/sh# set PATH for the case we are called via sudo or su rootPATH=/sbi

    On the virtual machine you can use the automatic router and ip setting feature provided by IPv6.

    In this case you should install radvd (provided by most Linux distributions) and modify the file

    /etc/radvd.conf:

  • 7/27/2019 Advanced_Networking_Linux Oracle VM VirtualBox

    3/3