GNU Linux


HOWTO - How I configure my Network and stuff


There should be a blue line here

Table of Contents

There should be a blue line here

1. HOWTO:Set up the network interface card(s)

For my system I do it like this on the machines that are NOT going to be hosting kvm. For machines that are hosting kvm guests you have to bugger about a bit, but see below.

This can all be set using the GUI from the menu System-Administration->Network>

Example
Static IP Address 192.168.0.7 
Domain  myhome.co.uk 
Subnet mask  255.255.255.0 
Default gateway 192.168.0.1 
DNS should already be setup. 
212.69.36.3 
212.69.40.3 

As we are using a static address you will also need to remove the entry in /etc/hosts for 127.0.1.1 and change to to read the static IP address you have assigned to the machine.

For machines that are going to host kvm guests you need to sort out a bridge to the kvm machines as this gives faster networking and does not block up your existing local network with loads of extra packes from the "user" mode networking which is t he default.

This can all be partly set using the GUI from the menu System-Administration->Network>

Example
Configuration:  Automatic configuration (DHCP) 
 
DNS should already be setup. 
212.69.36.3 
212.69.40.3 


Note: for DNS servers that are not supplied by your ISP use OpenDNS fast free and so far so good.


Now you need to edit the networking config file /etc/network/interfaces. Mine looks something like this now

Example
# 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 
 
# Bridge to kvm guests 
auto br0 
iface br0 inet static 
        address 192.168.0.7 
        network 192.168.0.0 
        netmask 255.255.255.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 
 
# The primary network interface This will be overwritten by the bridge 
iface eth0 inet static 
        address 192.168.0.0 
        netmask 255.255.255.0 

To run through that quickly . The auto lines set the name for the device. and the iface lines add some values to options to that device. The lo is a loopback device, and is kinda important. You will need this. As we are using the virtual bridge device to talk to the network that will be used inside the kvm guests we needto disable the eth0 as the host will now talk to the bridge and let the bridge sort out where the network packes are going. This should have been setup already if you used the GUI above.

The virtual bridge should be configured so that it uses the IP address that you used for the host to start with. Just set up br0 as if it was eth0 adding the extra bridge options at the bottom.

You should be able to simply restart networking, but I found that did not work so I reboot and that does work. One day I may find out why.

Code:
sudo /etc/init.d/networking restart 

Add linux60, linux32 and linux12 to the /etc/hosts list.

Ubuntu docs on kvm (these almost work see above)

There should be a blue line here

2. Setting up and configuring autofs

This is how I do it

There should be a blue line here

3. HOWTO:Set up NFS sharing

Install the necessary software if not already done:

Code:
sudo apt-get install nfs-kernel-server nfs-common portmap 

When configuring portmap do not bind loopback. If you do you can either edit /etc/default/portmap by hand or run:

Code:
sudo dpkg-reconfigure portmap 
sudo /etc/init.d/portmap restart 

The /etc/exports file is used for creating a share on the NFS server

Code:
sudo gedit /etc/exports 

Add some exports (shares) (allow IP 192.168.0.(0-255) )

Example
/data 192.168.0.0/255.255.255.0(rw,no_subtree_check,sync) 
/home 192.168.0.0/255.255.255.0(rw,no_subtree_check,sync) 

These lines export the directories /data and /home from the local host a limited range of IP addresses and hostnames with read/write access. See man exports for more details. After making your edits save and restart the NFS daemon.

Code:
sudo /etc/init.d/nfs-kernel-server restart 
sudo exportfs -ra 

really good NFS HOWTO

There should be a blue line here

4. HOWTO:Mount NFS shares at boot using /etc/fstab

HOWTO on mounting.

Make the directory where you want to mount the remote NFS exports and then ad them to your fstab.

Code:
sudo mkdir -p /opt/linux60_home /opt/linux60_data 
sudo chmod 777 /data 
sudo gedit /etc/fstab 

So if we want to mount the directoires from Linux60 on our machine at /opt/linux60_data, try something like this.

Example
linux60:/data   /mnt/data   nfs   rw,hard,intr,rsize=8192,wsize=8192    0   0 
linux60:/home   /mnt/home   nfs   rw,hard,intr,rsize=8192,wsize=8192    0   0 

It is a good idea to test this before a reboot in case a mistake was made. Simplest way is to mount all drives not yet mounted in the fstab.

Code:
sudo mount -a 

There should be a blue line here

5. HOWTO:find out what the current disk label/UUID/ID

Code:
ls /dev/disk/by-label -lah 
ls /dev/disk/by-id -lah 
ls /dev/disk/by-uuid -lah 

OR

Code:
sudo debugreiserfs /dev/sda2 

and to set it to something or something else

Code:
sudo reiserfstune -label LABEL /dev/sda2 

There should be a blue line here

6. HOWTO: Install and configure ssh

Also install openssh server and sort out setting up the right ssh keys for the user so you can login to other machines locally without a password. This is a security risk! I want to use Xwindows programs installed and run on one machine while actually running on another, hence the ForwardX11 bit.

To allow a user from one machine to login to another another machine, you need to update the authorized user file to include the details from the guests id_rsa.pub. It is the same as saying if my friend uses their front door key in my lock it will work.

Code:
ssh-keygen -t rsa 
cd ~/.ssh 
echo ForwardX11=yes > ~/.ssh/config 
cp id_rsa.pub authorized_keys 
chmod 600 ~/.ssh/config  ~/.ssh/authorized_keys 
gedit authorized_keys /opt/linux32_home/richard/.ssh/id_rsa.pub 
gedit /opt/linux32_home/richard/.ssh/authorized_keys id_rsa.pub 

Now test that you can actually ssh to/from linux60 without a password. No needto reboot or logout. If you cannot you did it wrong.

There should be a blue line here

7. HOWTO: Install Samba and share some folders.

It's all from here howto install samba

Install samba with Synaptic modify smb.conf to some realistic settings and start the daemon. (See link above)

To add new shared folders add them to smb.conf as [my_shared_folder] or use the little GUI System->Administration->shared folders.

This can also be used to talk unix<->unix but it is painfully slow, use NFS.

Only have one samba server with "wins support = yes" the others should all have wins server = <host name> or <IP address>


Note: Never have both in one file.

Also see: Samba HOWTO collection