Debian Wheezy Xen + Guest Howto

October 8th, 2014

Xen is usually my go to virtualization technology for Linux. Here’s a HOWTO on setting up Xen on Debian Wheezy and the first guest virtual machine.

First step is getting the required packages:

apt-get install xen-linux-system xen-tools xen-utils-4.1 xen-utils-common xenstore-utils xenwatch

Now, we’ll need to specify the Xen kernel as the default boot kernel on the host, and then reboot:
Read the rest of this entry »

Full NAT, DNAT and SNAT aka 1:1 NAT, 1 to 1 NAT

February 10th, 2010

Full NAT, DNAT and SNAT aka 1:1 NAT, 1 to 1 NAT – this is used when you want to map a dedicated external IP on an external interface to another IP on a separate interface with everything routed between them.

EXTERNAL_IP=”87.117.XXX.XXX”
EXTERNAL_IF=”eth1″
INTERNAL_IP=”192.168.1.105″
INTERNAL_IF=”eth0″

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A PREROUTING -i ${EXTERNAL_IF} -d ${EXTERNAL_IP} -j DNAT –to-destination ${INTERNAL_IP}
iptables -t nat -A POSTROUTING -o ${EXTERNAL_IF} -s ${INTERNAL_IP} -j SNAT –to-source ${EXTERNAL_IP}
route add -host ${EXTERNAL_IP} ${INTERNAL_IF}
arp -Ds ${EXTERNAL_IP} ${INTERNAL_IF}

Linux IP Address Configuration Static or DHCP

January 18th, 2009

It’s simple really..

You can define a static IP as follows:

ifconfig <interface> <ipaddress> netmask <mask> broadcast <broadcast>
e.g. ifconfig eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255

You can then define a route out to the internet:

route add default gw <router>
Which has the same effect as: route add -net 0.0.0.0/0 <router>
i.e. route add default gw 192.168.1.1

Or if you’d like to acquire an address via a local DHCP server:

dhclient <interface>
e.g. dhclient eth0

That’s all there is to it! Now.. these settings won’t stick on reboot, you’ll have to refer to your distro’s startup files. On debian you want /etc/network/interfaces

A sample stanza for the above configuration:

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

All done!

Quick Linux and Windows OpenVPN HOWTO and tutorial, including VPN routing

September 15th, 2008

OpenVPN is a popular Windows/Linux VPN Server/Client pair. I think there’s a separate GUI available for it if you’re so minded. This howto will cover command line usage only.

I’ll provide example configuration based on a Linux server and a Windows client, however the same applies pretty easily if you wanted to mix and match.

On Debian, apt-get install openvpn. On any other linux distro, use your own package manager or alternatively download from source and compile.
Read the rest of this entry »