Red Antigua Logo slogan
Ads by Goooooogle
Search this site (by Google)
Menu
Home
About
Tools
Perl modules
Perl tutorials
C tutorials
Server configurations
UNIX on Windows
Misc. FreeBSD/UNIX
Redirect a web page
JavaScript
Virus list
Old stuff
Off topic

Tools    (top)
Your IP
Check a site for broken links
(W3C)

Perl modules    (top)
Tree::Numbered::Tools
(CPAN)
Perl tutorials    (top)
Perl modules
HTML::Template
CGI::Application
Mail::POP3Client
Mail::Send
MIME::Tools
Cookies with CGI::Application
Upload files with CGI::Application
Download files with CGI::Application
Redirect with CGI::Application
CPAN shell
Install DBD::mysql from the CPAN shell
Perl trim function
Validate an IP with Perl
Run suid Perl scripts under Apache
Perl taint mode
Perl date functions with Date::Calc

In Spanish
Curso de Perl

C tutorials    (top)
C - Introduction
C - Absolute beginner's Emacs
C - Examples for beginners
C - Makefile examples
C - Autotools examples
Server configurations    (top)
DNS
Apache
Apache Authentication and Access Control
mod_perl on FreeBSD
MySQL
MySQL add account
phpMyAdmin
Squid
DHCP

UNIX on Windows    (top)
Apache setup on Windows
MySQL setup on Windows
PHP setup on Windows
Perl setup on Windows
Emacs setup on Windows
UnxUtils
PuTTY
WinSCP
GIMP on Windows
MinGW - gcc on Windows
MSYS - make-in-a-shell on Windows
msysDTK - autotools on Windows
GDB for MinGW on Windows

Misc. FreeBSD/UNIX    (top)
CD and DVD creation on FreeBSD using 'k3b' on FreeBSD
'ipf' on FreeBSD
'pf' on FreeBSD
'su' on FreeBSD
Mount an ISO image under FreeBSD
Load the correct sound driver under FreeBSD without knowing what sound card you are using
Simultaneous sound channels on FreeBSD
Boot floppies for FreeBSD
Problems with old disks/controllers and the 'ata' driver
FreeBSD network stuff
DOS-to-UNIX file conversion
favicon.ico on UNIX
Emacs tips
Sendmail tips
GKrellm
Command Line Calculator
Save multimedia streams with 'mplayer'
xargs - solution to 'Argument list too long'
Process multiple images from the command line using 'ImageMagick'
Turn the system bell off under X Windows
Process each line in an input file from the command line (or in a shell script)
How to keep a program running in the background using 'nohup'
How to remove symbolic links in the current directory using 'find' and 'rm'
How to remove Emacs backup files in the current directory and all subdirectories using 'find' and 'rm'
How to execute .profile without logging in

Redirect a web page    (top)
Redirect to another web page
Apache redirect
C redirect
Perl redirect
PHP redirect
HTML redirect
JavaScript redirect

Javascript    (top)
Trim function
Login form
Register form
Popup window

Virus list    (top)
Latest viruses - Computer Virus HQ (external)
Latest 10 viruses - Sophos

Links    (top)
HTML and PHP Scripts - Html Web Template

Old stuff    (top)
POP3 server setup
About AnyMail
AnyMail downloads

Off topic    (top)
Personal links

Validated by
Valid HTML 4.01!
Valid CSS!
Powered by
apache.org
FreeBSD network stuff
FreeBSD network stuff        
I will list any network related stuff here. First out is a simple script to get your current default gateway from the 'route' command:
#!/bin/sh
route -n get default|grep gateway||awk '{print $2}'
Save it for example as '/usr/local/sbin/default_gateway.sh', chmod 755, and you will always get the default gateway by just typing
default_gateway.sh
Not so exciting for your LAN, as the default gateway probably (almost) never will change, but useful when you access many different WLANs.

Another simple script to print the current IP (if any) for a NIC:
#!/bin/sh
# Check for at least one argument
if [ -z $1 ]; then
    echo "Usage:"
    echo "$0 nic_interface"
    echo "where 'nic_interface' is one of the following interfaces:"
    echo `ifconfig -l`
    exit 1
fi
NIC=$1
ifconfig $NIC |grep inet|grep -v inet6| awk '{print $2}'
Save it for example as '/usr/local/sbin/ip_nic.sh', chmod 755, and you will get a NICs IP by typing
ip_nic.sh 'nic_interface'
Here are some tricks to change IP, DNS, and default gateway 'on the fly' when you switch between WLANs frequently, or when you are in the middle of two or more Access Points and the strongest signal becomes the weakest. Backup your current IP for the WLAN NIC, DNS and default gateway settings, and then remove the current default route.
In my case the NIC is called 'ath0' (check with 'ifconfig' if you aren't sure about yours):
cp /etc/resolv.conf /etc/resolv.conf~
default_gateway.sh > /etc/default_gateway~
ip_nic.sh ath0 > /etc/ip_nic~
route delete default
It is necessary to delete the current default route before getting the new network settings by DHCP.
Otherwise, you will only obtain a new IP and DNS settings, but continuing with the same old default route, which isn't what you want.
Then you run 'dhclient' with the name of your wireless NIC as argument.
dhclient ath0
If everything is OK, you will obtain new network settings from the new DHCP server.
Check using 'ifconfig' (IP), 'cat /etc/resolv.conf' (DNS), and 'netstat -nr' (default gateway).
When you want to disconnect from the WLAN, just kill the 'dhclient' program:
kill `cat /var/run/dhclient.pid`
Then restore your previous network settings:
cp /etc/resolv.conf~ /etc/resolv.conf
ifconfig ath0 down
ifconfig ath0 `cat /etc/ip_nic~` up
route delete default
route add default `cat /etc/default_gateway~`
I learned most of the above from http://caia.swin.edu.au/reports/041221A/ where you can find even more tricks and scripts.
Last modified: Wed Apr 28 21:36:56 CST 2004