EanderAlx.org

Linux, Virtualization and whatever I find interesting ...

User Tools


Site Tools



IPSec VPN with Fritzbox

I doesn't realy like Fritzbox's nor IPSec and myself I'm using a Netgear Router with Tomato and OpenVPN but I had to connect to this IPSec VPN from this Fritzbox 7170. I find Shrew IKE to do this and if you also want to connect to Fritzbox IPSec hear you can find out how did you get it to work. I used Arch Linux as IPSec Client.

Gnome gconf-editor

  • Command:
    gconf-editor 

Enable SSH on ESXi 4.1

  • In the past, it was possible to enable ssh by typing “unsupported”, then you get a terminal and could activate the ssh-server.
  • With ESXi 4.1 “unsupported” is unsupported.

Clone VM on ESXi 4.1

  • Cloning a Virtual Machine (VM) in ESXi without using VMware vSphere doesn't work because in the vSphere Client, which can be also used to manage the ESXi, you have no possibility to do this.

Check for empty variables

  • If you want to check for a empty bash variable you can do this like given here:

Calculate in bash

  • If you want to calculate with an integer it's possible without using other programs.

Bash - Parameters

  • The first parameter passed to the script is $1, the second $2 and so on
  • If you want to to check more then one possibilities of parameter passed to the script then a case is useful

Bash - Functions

  • How to use functions in bash

Arch: VLANs in rc.conf

  • the package vconfig is needed in order to use VLANs
Deprecated

 pacman -Sy vconfig
  • There were several approaches in the Forum to configure VLANs in rc.conf. The Problem is: therefor its necessary to do extensive changes in “/etc/rc.d/network”.
  • After a update its possible that all changes are gone.
  • I wasn't interested in doing multiple changes in “/etc/rc.d/network” after updates.
  • That's why I write my own variant. It's only needed to change two lines.
  • With my Script it's only Possible to add VLAN and not to remove.
  • “vconfig” is designed that after a reboot VLAN interface are not configured.
  • If you want to achieve more, further changes have to include into “/etc/rc.d/network” and I wanted to avoid this.

Setup:

  • First the Script, put it into “/etc/conf.d”.
create_vlans
#!/bin/bash
#FILES
#       /proc/net/vlan/config
#       /proc/net/vlan/[vlan-device]
# rc.conf:
# VLANs
#
#VLAN_DEVS=(eth0.6)
######
# /etc/rc.d/network
# vlan settings
#[ -f /etc/conf.d/create_vlans ] && . /etc/conf.d/create_vlans
#
### Variables ###
LSMOD_PATH="/usr/bin/lsmod"
VLAN_PATH="/proc/net/vlan/"
VCONFIG_PATH="/usr/sbin/vconfig"
#
### Functions ###
vlan_add()
{
	if [ -e $VCONFIG_PATH ];then
		/usr/bin/lsmod | grep 8021q > /dev/null 2> /dev/null
		if [ $? == 0 ];then
			if [ ! -e $VLAN_PATH$1 ];then
				VLANS_DEV=$1
				VLAN_IFACE=`echo $VLANS_DEV | cut -d "." -f1`
				VLAN_ID=`echo $VLANS_DEV | cut -d "." -f2`
				$VCONFIG_PATH add $VLAN_IFACE $VLAN_ID > /dev/null 2> /dev/null
			fi
		else
			echo "8021q Module not loaded"
		fi
	else
		echo "please install vconfig: pacman -S vconfig"
	fi
}
vlan_rem()
{
	vconfig rem $1
}
#
### Main ###
if [ ! -e $LSMOD_PATH ];then
	echo "/usr/bin/lsmod not available, unable to check vlan module"
else
	for vlans in ${VLAN_DEVS[@]}; do
		vlan_add $vlans   
	done
fi
  • Adapt “/etc/rc.d/network” Attention: the changed are gone after update initscripts.
  • Add these lines before the other includes.
# vlan settings
[ -f /etc/conf.d/create_vlans ] && . /etc/conf.d/create_vlans

configure VLANs

  • VLAN interfaces now can be entered in the rc.conf.
  • With “VLAN_DEVS=()” the interfaces were created [Interface.VLAN_ID].
  • Then you can assign an IP-Adresse to the interface. The interface name is “vlan6” for example. This name must not contain “.” or “ ”.

Example:

#VLANs
VLAN_DEVS=(eth0.6)

interface=eth0
address=
netmask=
broadcast=
gateway=

interface=eth0.6
address=172.16.10.1
netmask=255.255.0.0
broadcast=172.16.255.255
gateway=
bloglist.txt · Last modified: 23.03.2013 20:10 by eanderalx