Feb 13
adminIPv6, Linux System Administration, Networking
6to4 is a tunneling protocol for using IPv6 over an IPv4 connection, and it’s configuration on Linux is well described.
Note: this can only apply to interfaces which have a public IPv4 address
A 6to4 tunnel can be configured using the following shell script
#/bin/bash
# set the interface name
if=wlan0
# calculate the IPv6 address
ipv4=`/sbin/ifconfig $if | grep "inet addr" | sed -e 's/^. *inet addr://' | sed
-e 's/ .*$//'`
ipv4s=`echo $ipv4 | tr "." " "`
ipv6=`printf "2002:%02x%02x:%02x%02x::1" $ipv4s `
case "$1" in
start)
/sbin/ip tunnel add tun6to4 mode sit ttl 128 remote any local $ipv4
/sbin/ip link set dev tun6to4 up
/sbin/ip -6 addr add $ipv6/16 dev tun6to4
/sbin/ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4 metric 1
# configure firewall
/sbin/ip6tables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/ip6tables -A INPUT -j DROP
;;
stop)
/sbin/ip -6 route flush dev tun6to4
/sbin/ip link set dev tun6to4 down
/sbin/ip tunnel del tun6to4
# clear firewall
/sbin/ip6tables -F INPUT
;;
*)
echo "usage: ipv6 {start|stop}"
exit 1
esac
exit 0
This will create a new interface ‘tun6to4′ which will be used for IPv6.
See here for link preference.
Feb 09
adminLinux General, Linux System Administration
When debugging bash scripts use:
set -o xtrace
to print out each line along with the regular output, as it is executed.
Jan 08
adminLinux General, Linux System Administration
Annoyed that tapping my trackpad was no longer being recognised as a mouse click after an upgrade to Debian Squeeze, I sought to have “synclient TapButton1=1″ executed after login.
It would appear that both ~/.xinitrc and ~/.xsession are not used. Placing the above command in the file ~/.xprofile resolved the issue and I am now happily tapping my trackpad.
(tested when using GDM for logging in and Enlightenment for the Window Manager)
Nov 08
adminLinux General
Search and replace in vi is both quick and simple:
X,Ys/search/replace/g
(where x – start line number, y – end line number. optional)
One very useful feature is the ability to use parts of the search regular expression within the replace string.
For example, where the selected lines contain values between 2000-2999 and all these values need to be increased by 1000 so that all the values are now in range 3000-3999:
X,Ys/2\([0-9][0-9][0-9]\)/3\1/g
The \1 includes the contents of the 1st regular expression delimited by ( ).
Multiple regular expressions can be reproduced in the replace string. For example, in the file containing:
Surname, Forename
surname, forename
The command:
1,2s/\([a-z]*\), \([a-z]*\)/\2 \1/ig
Results with:
Forename Surname
forename surname
\2 in the replacement string matches the 2nd regular expression in the search string, and likewise for \1 with the 1st regular expression.
Oct 31
adminLinux System Administration
As AES-256 partitions using either a block file device or a physical partition cannot be mounted automatically at boot, they will not be automatically checked.
To manually run a fsck:
- Unmount the partition
- Setup loop device: losetup -e aes-256 /dev/loop0 /dev/sdaX
(use loop1, loop2 etc if the others are being used)
- Enter encryption password
The losetup will not give an error if the password was incorrect. Therefore a test is needed to confirm that the password was entered correctly – mount then umount the loop device:
- mkdir /tmp/test
-
- mount /dev/loop0 /tmp/test
- ls /tmp/test
- umount /dev/loop0
If the device could not be mounted, run: losetup -d /dev/loop0 and try again.
Execute the fsck:
fsck.ext3 -f /dev/loop0
After running the fsck, delete the loop device: losetup -d /dev/loop0 and mount the partition like usual.
Older Entries Newer Entries