LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Server brainstorm, does it sound good? (http://www.linuxquestions.org/questions/linux-server-73/server-brainstorm-does-it-sound-good-748245/)

xaos5 08-17-2009 04:18 PM

Server setup
 
I have a server I'm about to get back up and running, but I have a few changes in mind (starting from scratch) because I believe I can merge my router into this server (IPCOP router). Here are my requirements:

-Sun virtualbox vm running two guest OS:
1. IPCOP, needs to have full control over two hardware NIC
2. Windows 2000 or XP, with access to usb port to manage a printer for network.
-Virtual VM guests need to be ran Headless and started on boot.
-Host OS running SVN server, MySQL server, Web Server, SAMBA.
-Server gets IP address through DHCP on the Virtual machine its running.


I'll end up having three NIC used and one USB port with this setup.

Server Specs:
AMD 4000+ x2 am2 w/ 2GB ram

Does it sound possible?

scheidel21 08-18-2009 07:20 AM

Possible yes, but I might suggest a static IP for the Host server. You can start the VM by adding a startup to rclocal, you might consider scripting it so one line in rclocal runs a script that brings up your VMs. I might suggest though you look at resource usage, I feel you may run into an issue with the amount of RAM, but then again maybe not. I suppose 256 for Win2000/XP VM, a 768 or a gig for the IPCOP VM and the remainder for the Host. I would suggest on the host that you not run a GUI interface, or you have a very minimal one and that you NOT HAVE IT start on boot. only start it if you need to administer something. Conserve resources. I think the big question is how much activity is your mysql and SVN going to get. Serving Samba shares is minimal usage but Mysql can be resource intensive. Same with the webserver if running much server side dynamic content.

xaos5 08-19-2009 04:33 PM

I managed to get a lot of it running, only thing left to do is actually move it over and test the actual network with ipcop and get VNC or some type of remote desktop for the host OS. I decided i'm going to keep a GUI running because i'm doing very well on ram (after boot, both VM running headless, and logged in to gnome):

Code:

$ free -m
            total      used      free    shared    buffers    cached
Mem:          1762        920        841          0        26        287
-/+ buffers/cache:        606      1155
Swap:        3551          0      3551

if anybody is interested here is my notes on how I did it:

edited: see post below

xaos5 08-20-2009 03:26 PM

Alright I have it all setup but I can't get bridged networking going. Nothing can ping the guest, guest can't ping outside, guest can ping itself. Fedora 11 x86 is the host and I've tried doing a bridged connection with windows 2000 and IPCOP guests. I'm stumped as of why this isn't working.

gankoji 08-20-2009 05:20 PM

It sounds like it might be a problem with your iptables. you may need to masquerade your hw nics to the VM? or you just have your VM incorrectly setup without access to the nics.

scheidel21 08-20-2009 08:09 PM

Maybe your VM isn't in bridged mode?

xaos5 08-20-2009 10:31 PM

Ok I managed to get ping to work, eth0 and eth2 where down (didn't know I needed these up for the bridge to work), I can ping back and forth between the host and guest and any other computer on the network. Now I can't seem to get firefox to open up the website (http://192.168.0.2:81).

/etc/rc.local (how i'm starting the VM):
Code:

touch /var/lock/subsys/local

ifconfig eth0 up
ifconfig eth2 up

VBoxHeadless --startvm "router" &
sleep 1
VBoxHeadless --startvm "Print Server" &

ipcop config:
Code:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Sun VirtualBox Machine Configuration -->
<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.7-linux">
  <Machine uuid="{ae6ff441-9712-4e5a-9fdb-e318890d64bc}" name="router" OSType="Linux24" lastStateChange="2009-08-21T03:15:58Z" aborted="true">
    <ExtraData>
      <ExtraDataItem name="GUI/SaveMountedAtRuntime" value="yes"/>
      <ExtraDataItem name="GUI/ShowMiniToolBar" value="yes"/>
      <ExtraDataItem name="GUI/MiniToolBarAlignment" value="bottom"/>
      <ExtraDataItem name="GUI/LastWindowPostion" value="923,216,720,448"/>
      <ExtraDataItem name="GUI/Fullscreen" value="off"/>
      <ExtraDataItem name="GUI/Seamless" value="off"/>
      <ExtraDataItem name="GUI/AutoresizeGuest" value="on"/>
      <ExtraDataItem name="GUI/MiniToolBarAutoHide" value="on"/>
      <ExtraDataItem name="GUI/LastCloseAction" value="powerOff"/>
    </ExtraData>
    <Hardware>
      <CPU count="1">
        <HardwareVirtEx enabled="true"/>
      </CPU>
      <Memory RAMSize="600"/>
      <Boot>
        <Order position="1" device="Floppy"/>
        <Order position="2" device="DVD"/>
        <Order position="3" device="HardDisk"/>
      </Boot>
      <Display VRAMSize="8" monitorCount="1" accelerate3D="false"/>
      <RemoteDisplay enabled="true" port="3391" authType="Null" authTimeout="5000"/>
      <BIOS>
        <ACPI enabled="true"/>
        <IOAPIC enabled="false"/>
        <Logo fadeIn="true" fadeOut="true" displayTime="0"/>
        <BootMenu mode="MessageAndMenu"/>
        <TimeOffset value="0"/>
        <PXEDebug enabled="false"/>
      </BIOS>
      <DVDDrive passthrough="false"/>
      <FloppyDrive enabled="true"/>
      <USBController enabled="true" enabledEhci="false"/>
      <Network>
        <Adapter slot="0" enabled="true" MACAddress="08002740A8A7" cable="true" speed="0" type="82540EM">
          <BridgedInterface name="eth0"/>
        </Adapter>
        <Adapter slot="1" enabled="true" MACAddress="080027AEAD73" cable="true" speed="0" type="82543GC">
          <BridgedInterface name="eth2"/>
        </Adapter>
        <Adapter slot="2" enabled="false" MACAddress="0800271C348D" cable="true" speed="0" type="Am79C973"/>
        <Adapter slot="3" enabled="false" MACAddress="080027C6206F" cable="true" speed="0" type="Am79C973"/>
        <Adapter slot="4" enabled="false" MACAddress="080027E9EC28" cable="true" speed="0" type="Am79C973"/>
        <Adapter slot="5" enabled="false" MACAddress="0800270CC38D" cable="true" speed="0" type="Am79C973"/>
        <Adapter slot="6" enabled="false" MACAddress="080027C22453" cable="true" speed="0" type="Am79C973"/>
        <Adapter slot="7" enabled="false" MACAddress="08002791A6C3" cable="true" speed="0" type="Am79C973"/>
      </Network>
      <UART>
        <Port slot="0" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
        <Port slot="1" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
      </UART>
      <LPT>
        <Port slot="0" enabled="false" IOBase="0x378" IRQ="4"/>
        <Port slot="1" enabled="false" IOBase="0x378" IRQ="4"/>
      </LPT>
      <AudioAdapter controller="AC97" driver="Pulse" enabled="true"/>
      <SharedFolders/>
      <Clipboard mode="Bidirectional"/>
      <Guest memoryBalloonSize="0" statisticsUpdateInterval="0"/>
      <GuestProperties>
        <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="C" timestamp="1250823952054611000" flags=""/>
      </GuestProperties>
    </Hardware>
    <StorageControllers>
      <StorageController name="IDE" type="PIIX4" PortCount="2">
        <AttachedDevice type="HardDisk" port="0" device="0">
          <Image uuid="{98e4d8d1-1e58-4835-ad30-9414482c6ae5}"/>
        </AttachedDevice>
      </StorageController>
    </StorageControllers>
  </Machine>
</VirtualBox>

Code:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:18:E7:16:B9:F4 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:21 Base address:0x6000

eth1      Link encap:Ethernet  HWaddr 00:19:21:47:C6:43 
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::219:21ff:fe47:c643/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1977 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2246 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1362886 (1.2 MiB)  TX bytes:427820 (417.7 KiB)
          Interrupt:22 Base address:0xc000

eth2      Link encap:Ethernet  HWaddr 00:04:5A:58:BC:B6 
          inet6 addr: fe80::204:5aff:fe58:bcb6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:398 (398.0 b)
          Interrupt:20 Base address:0x8000

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:4677 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4677 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2328088 (2.2 MiB)  TX bytes:2328088 (2.2 MiB)

virbr0    Link encap:Ethernet  HWaddr B6:9B:D2:42:63:64 
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: fe80::b49b:d2ff:fe42:6364/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:12543 (12.2 KiB)


xaos5 08-21-2009 07:27 AM

Ok I think I managed to find the problem. I downloaded a testing version of ipcop (1.9.7). I realized this when I did a
Code:

netstat -an | grep "LISTEN"
and it didn't list port 81 and 445 and did a google search.

Reinstalling with 1.4.20, i'll post back with results.

xaos5 08-23-2009 02:26 PM

Alright everything is going smooth now that the correct version is installed. I've even added another VM for git, updated and hopefully final notes:

Code:

### SAMBA setup ###############################################################
-Upgrade system and install samba
        ~# yum upgrade
        ~# yum install samba-swat.i586
-System->Administration->Services:
        -Start and enable nmb, smb, xinetd, swat daemons
-System->Administration->Firewall:
        -Under "Trusted Services" enable Samba and Samba Client and click Apply.
-Web browser:
        -type in http://localhost:901 root as user, setup window shares.
*Extra tips for setting up directories for SAMBA:
        ~# chcon -t samba_share_t <dir_name> (use to test change selinux on your directories for samba)
        *To change selinux for a persistent change:
        ~# semanage fcontext -a -t samba_share_t <dir_name>
        ~# restorecon -v <dir_name>

### VBOX setup ################################################################
-Install programs required for VBOX
        ~# yum install kernel-devel #(used to compile virtualbox modules against kernel)
        ~# yum groupinstall "Development Tools"
-Install sun virtualbox closed source edition from website
-Add user to the vbox group:
        ~# usermod -a -G vboxusers <username>

### Network Setup #############################################################
-System->Administration->Network:
        -Make sure Server iface is Not Controlled by NetworkManager, Activate when comp starts, and static IP
        -Make sure Other two Interfaces are not controlled by  NetworkManager, not activate when comp starts.
        -verify ifcfg-<Server iface> is inside /etc/sysconfig/network/scripts/ and looks correct.
-System->Administration->Services:
        -Disable and stop NetworkManager daemon.
        -Start and enable network daemon.

### IPCOP setup ###############################################################
-download ipcop cd iso: http://voxel.dl.sourceforge.net/project/ipcop/IPCop/IPCop%201.4.19%20_%201.4.20/ipcop-1.4.20-install-cd.i386.iso
-MAKE SURE ITS 1.4.20
-change two network adapters to bridged interface, recommend changing the adapter type to make it easier to distinguish inside ipcop.
-install IPCOP, RED interface = WAN and GREEN interface = LAN
-Configure VM to connect on VRDP NULL AUTH

### Win2K Print Server Setup ##################################################

-Install windows
-Install printer drivers
-Configure VM to connect on VRDP NULL AUTH
-Create USB Filters for VM
-TODO: make a normal user able to use USB ports - http://forums.virtualbox.org/viewtopic.php?f=7&t=19536

### Start VM on Boot ##########################################################

-Add these lines to /etc/rc.local:
                sleep 1
                VBoxHeadless --startvm "router" &
                sleep 2
                VBoxHeadless --startvm "Print Server" &


### Setup RDP for Server ######################################################

-VNC and Gnome way:
        -Install vnc-server and xinetd:
                ~# yum install vnc-server
                ~# yum install xinetd
        -Enable XDMCP in /etc/gdm/custom.conf:
                [xdmcp]
                Enable=true
                [security]
                DisallowTCP=false
        -Remap ports in /etc/services:
                #vnc-server      5900/tcp                # VNC Server
                #vnc-server      5900/udp                # VNC Server
                vnc-gdm                5900/tcp                # VNC and GDM -- Added by Drebbe
        -Create xinetd Service in /etc/xinetd.d/vnc-gdm:
                service vnc-gdm
                {
                        disable = no
                        socket_type = stream
                        protocol = tcp
                        group = tty
                        wait = no
                        user = nobody
                        server = /usr/bin/Xvnc
                        server_args = -inetd -query localhost -geometry 1024768 -depth 16 -once -fp /usr/share/X11/fonts/misc -securitytypes=none
                }
        -Restart xinetd:
                ~# service xinetd restart
        -Reboot if it doesn't work

-Windows XP and lower way:
        -Install xrdp:
                ~# yum install xrdp
        -Enable Daemon:
                -System->Administration->Services: Enable and Start xrdp
        -Firewall setup:
                -System->Administration->Firewall: Other Ports:
                        - add port 3389 tcp and udp (service name is "ms-wbt-server")

### Git-Server VM #############################################################

-Install OS (debian lenny) without GUI
-Install ssh:
        ~# apt-get install ssh
-Install git:
        ~# apt-get install git-core
-Create new user for git:
        ~# adduser git
-Setup ssh for key access:
        ~# su - git
        ~$ ssh-keygen -t dsa
                - Place it in ~/.ssh/id_dsa
        ~$ cp ~/.ssh/id_dsa.pub ~/.ssh/authorized_keys2
                        - Windows clients to anyname.ppk, link in startup folder as: “C:\Program Files\PuTTY\pageant.exe” ”Path to anyname.ppk”
-Port Forward 22 through NAT for VM:
        ~# VBoxManage setextradata "git-server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 22
        ~# VBoxManage setextradata "git-server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
        ~# VBoxManage setextradata "git-server" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

-Creating a git repository:
        -login through ssh with key auth git@server
        ~$ mkdir ~/repo_name.git
        ~$ cd ~/repo_name.git
        ~$ git --bare init

-Adding to that new repository:
        ~$ mkdir example.git
        ~$ cd example.git
        ~$ git init
                Initialized empty Git repository in /home/David/example.git/.git/
        ~$ mv ../catch.cpp .
        ~$ ls
                catch.cpp
        ~$ git add catch.cpp
        ~$ git commit -m "first commit"
        ~$ git remote add origin git@localhost:example.git
        ~$ git push origin master
                Counting objects: 3, done.
                Delta compression using 2 threads.
                Compressing objects: 100% (2/2), done.
                Writing objects: 100% (3/3), 508 bytes, done.
                Total 3 (delta 0), reused 0 (delta 0)
                To git@localhost:example.git
                * [new branch]      master -> master

-Checkout that repository:
        ~$ git clone git@server:example.git

-Committing changes to that repository:
        ~$ git commit -m "comment here"
        ~$ git push

-Add server to startup, add to /etc/rc.local:
        sleep 2
        VBoxHeadless --startvm "git-server" &



All times are GMT -5. The time now is 10:22 AM.