incubus - an obsession in computing
  • rss
  • Home
  • Linux Apps
    • C&G 4250 Linux Extension
  • C&G 4240
    • Overview
    • Validate Program
    • Sort Program
    • Update / Merge Program
    • Report Program
    • Downloads
  • C&G 4250
    • Overview
    • Data Entry Program
    • Validate Program
    • Sort Program
    • Customer Update / Merge Program
    • Customer Report Program
    • Stock Update / Merge Program
    • Stock Report Program
    • Downloads
  • About
  • Contact

Useful Gentoo Aliases

inc | November 22, 2009 | 9:15 am

Just a quick post to save some time when updating your Gentoo system (Portage 2.2_rc51) , please note this is just a starting point, feel free to extend these.

nano ~/.bashrc
if [ -e /etc/bashrc ] ; then
 source /etc/bashrc
fi
alias esync='emerge --sync'
alias eupdate='emerge -uavDN --nospinner --quiet --keep-going --with-bdeps=y world'

To update your system just call the following two commands:

esync
eupdate

—

Comments
No Comments »
Categories
Linux, Tips & Tricks
Tags
alias, Gentoo
Comments rss Comments rss
Trackback Trackback

PPTP VPN / Ethernet ADSL (Gentoo/IPREDator)

inc | August 18, 2009 | 9:04 pm

I’ve had quite a bit of fun over the last couple of nights configuring a VPN connection using Gentoo Linux and the following simplified set-up:

   Home PC  <=> Ethernet ADSL Router <=> Internet <=>   VPN Server
192.168.1.x <=>      192.168.1.1     <=>          <=> xxx.xxx.xxx.xxx

Firstly ensure your kernel has ppp support (2.6.30 kernel configuration options):

# cd /usr/src/linux ; make menuconfig
Device Drivers ->
    Network device support ->
    [*]   PPP (point-to-point protocol) support
    <*>     PPP support for async serial ports
    <*>     PPP support for sync tty ports
    <*>     PPP Deflate compression
    <*>     PPP BSD-Compress compression
    <*>     PPP MPPE compression (encryption)
    <*>     PPP over Ethernet

Next emerge the ppp and pptpclient packages:

echo "net-dialup/ppp mppe-mppc" >> /etc/portage/package.use
emerge --ask --verbose ppp pptpclient

Once you have both ppp and pptpclient successfully installed upon your system edit the /etc/ppp/options.pptp file so that it resembles the one located below (only a few changes are required to this file):

Example options.pptp file for IPREDator

Next edit the /etc/ppp/chap-secrets file so that it resembles the one located below, be sure to add your IPREDator User name and Password to this file replacing the place holders contained within the example file):

Example chap-secrets file for IPREDator

Next create the /etc/ppp/peers/Ipredator file so that it resembles the one located below, again be sure to add your IPREDator User name to this file replacing the place holder contained within the example file):

Example Ipredator file for IPREDator

Now essentially all that is required is getting the routing set up correctly so that traffic flows to the correct place on the network. What I have below are some modified ip-up and ip-down scripts that may be used, some minor modifications maybe required to tailor the scripts to your specific network settings. These scripts are based upon those from the All Traffic Through Tunnel section of the PPTP Client website (many thanks to the original author as it pointed me in the right direction). I believe that both of these scripts should be set as being executable (chmod +x /etc/ppp/ip-up.d/60-ip-up-tunnel.sh).

ip-up script (/etc/ppp/ip-up.d/60-ip-up-tunnel.sh):

#!/bin/bash
# pppd ip-up script for all-to-tunnel routing

# name of primary network interface (before tunnel)
PRIMARY=eth0

# address of tunnel server
SERVER=$5

# gateway ip address (before tunnel - adsl router ip address)
GATEWAY="192.168.1.1"

# provided by pppd: string to identify connection aka ipparam option
CONNECTION=$6
if [ "${CONNECTION}" = "" ]; then CONNECTION=${PPP_IPPARAM}; fi

# provided by pppd: interface name
TUNNEL=$1
if [ "${TUNNEL}" = "" ]; then TUNNEL=${PPP_IFACE}; fi

# if we are being called as part of the tunnel startup
if [ "${CONNECTION}" = "Ipredator" ] ; then

 # direct tunneled packets to the tunnel server
 route del ${SERVER} dev ${TUNNEL}
 if [ "${GATEWAY}" = "" ] ; then
   route add -host ${SERVER} dev ${PRIMARY}
 else
   route add -host ${SERVER} gw ${GATEWAY} dev ${PRIMARY}
 fi

 # direct all other packets into the tunnel
 route del default ${PRIMARY}
 route add default dev ${TUNNEL}
fi

ip-down script (/etc/ppp/ip-down.d/60-ip-down-tunnel.sh):

#!/bin/bash
# pppd ip-down script for all-to-tunnel routing

# name of primary network interface (before tunnel)
PRIMARY=eth0

# server ip address (for tunnel)
SERVER=$5

# gateway ip address (before tunnel - adsl router ip address)
GATEWAY="192.168.1.1"

# provided by pppd: string to identify connection aka ipparam option
CONNECTION=$6
if [ "${CONNECTION}" = "" ]; then CONNECTION=${PPP_IPPARAM}; fi

# provided by pppd: interface name
TUNNEL=$1
if [ "${TUNNEL}" = "" ]; then TUNNEL=${PPP_IFACE}; fi

# if we are being called as part of the tunnel shutdown
if [ "${CONNECTION}" = "Ipredator" ] ; then

 # direct packets back to the original interface
 route del default ${TUNNEL}
 route del ${SERVER} dev eth0
 if [ "${GATEWAY}" = "" ] ; then
   route add default dev ${PRIMARY}
 else
   route add default gw ${GATEWAY} dev ${PRIMARY}
 fi
fi

Here is what the original routing table looks like, you will notice that all traffic is routed to the ADSL Gateway (in this case 192.168.1.1):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
loopback        127.0.0.1       255.0.0.0       UG    0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

Here is what the routing table looks like when the tunnel is running, you will now notice that traffic to the VPN Server is routed to the ADSL Gateway (192.168.1.1), all local network traffic (192.168.1.xxx) is routed to the associated network interface (eth0), and that all other traffic is routed to the VPN interface (ppp0):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
xxx.xxx.xxx.xxx 192.168.1.1     255.255.255.255 UGH   0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
loopback        127.0.0.1       255.0.0.0       UG    0      0        0 lo
default         *               0.0.0.0         U     0      0        0 ppp0

To start the connection open a terminal window and enter the following command:

pon Ipredator

To enable debug inorder to diagnose connection issues use the following command:

pon Ipredator debug dump logfd 2 nodetach

I hope this has been of some use to you, not only for configuring IPREDator but for other VPN connections that use the PPTP protocol..

—

Comments
13 Comments »
Categories
Linux, Tips & Tricks
Tags
ADSL, Gentoo, IPREDator, VPN
Comments rss Comments rss
Trackback Trackback

Search @incubus

Recent Posts

  • Compressed Hard Disk Image
  • It’s been along time …
  • T209 ECA Result
  • Old Linux Discs…
  • Panasonic CF-U1 / 2D Barcode Imager
  • Useful Gentoo Aliases
  • Hosting Provider Changed.
  • Linux – Merge AVI Files
  • Coders at Work
  • Remove OGA Office Not Genuine Notifications (KB949810)

Links

  • Demonoid
  • Engadget
  • Gentoo Linux
  • Gentoo Planet
  • Gentoo Universe
  • GNOME
  • GNOME Planet
  • ISO Hunt
  • OS News
  • Piratebay

Navigation

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Archives

  • May 2010 (1)
  • February 2010 (1)
  • December 2009 (3)
  • November 2009 (2)
  • September 2009 (4)
  • August 2009 (1)
  • July 2009 (1)
  • May 2009 (2)
  • April 2009 (1)
  • February 2009 (2)
  • January 2009 (1)
  • December 2008 (1)
  • November 2008 (1)
  • October 2008 (3)
  • September 2008 (7)
  • August 2008 (16)

Categories

  • 4240 (1)
  • 4250 (1)
  • Code (8)
  • Linux (29)
  • ODB2 (2)
  • Open University (6)
  • Tips & Tricks (13)
  • Uncategorized (5)

Stats

Visits Today: 6
rss Comments rss design by jide powered by Wordpress get firefox
© Copyright 1999-2010 @incubus. All Rights Reserved. All trademarks acknowledged.
incubus.co.uk || incubus.mobi || rankinstine.co.uk