I often get confused with the for loop
its always the ` and not the ' . For eg
for i in `ls *.log.*`; do gzip $i; done
Thursday, May 24, 2007
Thursday, May 03, 2007
Kickstarts
I was doing a kickstart installation on one of my servers and it seemed to always get stuck at the first language prompt. Obviously that meant the ks.cfg was not accessible since thats the first entry in a kickstart file. so hunting down the reasons, I arrived at a DNS error , the hostname of the server was not properly added to the dns server. Once that was done , it was still not working.
Finally the nscd of the server where the requests for ks.cgi co was cleared of its hosts table and the kickstart finally got off to a nice start :)
Btw I cleared an RHCA paper for the RH401 exam . Now for the rest .........
NB: My earlier post about Rconnect wifi works with airtel too , just the difference that the no. to be dialled is *99#
Thats all for now!
Finally the nscd of the server where the requests for ks.cgi co was cleared of its hosts table and the kickstart finally got off to a nice start :)
Btw I cleared an RHCA paper for the RH401 exam . Now for the rest .........
NB: My earlier post about Rconnect wifi works with airtel too , just the difference that the no. to be dialled is *99#
Thats all for now!
Wednesday, February 21, 2007
Adobe Reader on FC6
I suppose many others too might have faced this problem of Adobe Reader not working in FC 6. so here's a workaround
Edit the file/bin/acroread and replace the following line:
check_gtk_ver_and_set_lib_path "$MIN_GTK_VERSION"
with
# check_gtk_ver_and_set_lib_path "$MIN_GTK_VERSION"
(i.e. comment the line).
It worked for me. Thanks to AshutoshJSharma on Adobeforums.
Edit the file
check_gtk_ver_and_set_lib_path "$MIN_GTK_VERSION"
with
# check_gtk_ver_and_set_lib_path "$MIN_GTK_VERSION"
(i.e. comment the line).
It worked for me. Thanks to AshutoshJSharma on Adobeforums.
Wednesday, February 14, 2007
Reset the binary screen
Sometimes it gets really irritating if you mistakenly do a cat of some binary file and you end up with a command prompt that shows up with binary characters and everything you type on screen echoes as binary characters. the remedy is simple
just type "reset" and press enter.
just type "reset" and press enter.
Tuesday, February 13, 2007
Youtube downloads
I normally used to use the site vixy.net for converting youtube flv videos to avi and download it to my system, but it seems to be down for some time now . So looking for alternatives I happened to find these two cools scripts that download videos from the youtube site and then convert them to avi.
Just copy this script for downloads..
http://www.arrakis.es/~rggi3/youtube-dl/youtube-dl
Details about the script are available at http://www.arrakis.es/~rggi3/youtube-dl/
-------------------------------------------------------------------------------------------------------------
Thats the script . Thanks a lot Ricardo.. Just pass the url of the youtube video as its argument and execute it and the file gets saved on to your system as a .flv file.
Then you can use this script to convert it to avi.You'll need the mencoder package for this to work.
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 {-divx|-xvid} list_of_flv_files"
exit 1
fi
# video encoding bit rate
V_BITRATE=1000
while [ "$1" ]; do
case "$1" in
-divx)
MENC_OPTS="-ovc lavc -lavcopts \
vcodec=mpeg4:vbitrate=$V_BITRATE:mbd=2:v4mv:autoaspect"
;;
-xvid)
MENC_OPTS="-ovc xvid -xvidencopts bitrate=$V_BITRATE:autoaspect"
;;
*)
if file "$1" | grep -q "Macromedia Flash Video"; then
mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame \
-lameopts fast:preset=standard -o \
"`basename $1 .flv`.avi"
else
echo "$1 is not Flash Video. Skipping"
fi
;;
esac
shift
done
-----------------------------------------------------------------------------------------------------
To run this , just set the executable permission on the script and use the -divx option or whatever you choose as the compression format and pass the flv file as the argument. You can also pass multiple files in the same command.
Just copy this script for downloads..
http://www.arrakis.es/~rggi3/youtube-dl/youtube-dl
Details about the script are available at http://www.arrakis.es/~rggi3/youtube-dl/
-------------------------------------------------------------------------------------------------------------
Thats the script . Thanks a lot Ricardo.. Just pass the url of the youtube video as its argument and execute it and the file gets saved on to your system as a .flv file.
Then you can use this script to convert it to avi.You'll need the mencoder package for this to work.
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 {-divx|-xvid} list_of_flv_files"
exit 1
fi
# video encoding bit rate
V_BITRATE=1000
while [ "$1" ]; do
case "$1" in
-divx)
MENC_OPTS="-ovc lavc -lavcopts \
vcodec=mpeg4:vbitrate=$V_BITRATE:mbd=2:v4mv:autoaspect"
;;
-xvid)
MENC_OPTS="-ovc xvid -xvidencopts bitrate=$V_BITRATE:autoaspect"
;;
*)
if file "$1" | grep -q "Macromedia Flash Video"; then
mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame \
-lameopts fast:preset=standard -o \
"`basename $1 .flv`.avi"
else
echo "$1 is not Flash Video. Skipping"
fi
;;
esac
shift
done
-----------------------------------------------------------------------------------------------------
To run this , just set the executable permission on the script and use the -divx option or whatever you choose as the compression format and pass the flv file as the argument. You can also pass multiple files in the same command.
Friday, December 29, 2006
Getting an Rconnect card working in linux
Well I thought this would be pretty difficult but turned out a lot simpler though.
First the specs
I am using a Dell D620 laptop with the Rconnect card in my PCMCI slot. I specifically told the Reliance guys to get me a card that works for Linux and they gave me a Huawei one . The normal ZTE cards they give don't work with linux AFAIK. Nevertheless the drivers you get with the Huawei card are still for Windoze. But don't worry, if you are using the latest kernel it will get detected automatically. For the record, mine is 2.6.9-42.13 thats RHEL 4.
Now su as root. open vi and create this small script file say rconnect in your directory.
[root@nmoidu ~]# cat rconnect
sudo modprobe usbserial vendor=0x12d1 product=0x1001
mknod /dev/ttyUSB0 c 188 0
mknod /dev/ttyUSB1 c 188 1
Then set permissions for this to be executable.
Now for the modem properties and details of the dialup parameters, configure this file as below :
[root@nmoidu sysconfig]# cat /etc/wvdial.conf
[Modem0]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
Init3 = ATM0
FlowControl = NOFLOW
[Dialer Rconnect]
Username = 93293292323
Password = 932939392323
Phone = #777
Stupid Mode = 1
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Inherits = Modem0
[root@nmoidu sysconfig]#
Then add this file to setup the network parameters of the Rconnect interface.
[root@nmoidu ~]# cat /etc/sysconfig/network-scripts/ifcfg-Rconnect
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
ONBOOT=no
USERCTL=yes
PEERDNS=yes
TYPE=Modem
DEVICE=ppp0
BOOTPROTO=dialup
AC=off
BSDCOMP=off
VJCCOMP=off
CCP=off
PC=off
VJ=off
LINESPEED=115200
MODEMPORT=/dev/ttyUSB0
PROVIDER=Rconnect
DEFROUTE=yes
PERSIST=no
PAPNAME=93293293293# Change this no...:)
WVDIALSECT=Rconnect
MODEMNAME=Modem0
DEMAND=no
IPV6INIT=no
IDLETIMEOUT=600
[root@nmoidu ~]#
Customize each script and file according to the specifics in your machine like the device name and your phone no. etc. Run a dmesg to see under what device name your card is detected .
Now Run the script rconnect twice. Then do an ifup Rconnect.
Btw you'll have to call up Reliance and ask them to activate the card first and then the first connection will have to be done from a Windoze machine using the Rconnect software. Thats the unavoidable world of Windows . You have to live with it ;) .
Now once you are connected, browse , enjoy........
Alternately you can do it using the GUI too.
Create the rconnect script, run it.
Then open system-config-network . Add a new modem connection. Set the provider name to Reliance. Give no. to be dialled as #777. Enter your mob. no and password . Leave the other parameters as it is.
Follow the wizard and create the the new connection. Activate the new device from the GUI. Thats it.
In case of issues, Pls let me know. Leave a comment or mail me.
First the specs
I am using a Dell D620 laptop with the Rconnect card in my PCMCI slot. I specifically told the Reliance guys to get me a card that works for Linux and they gave me a Huawei one . The normal ZTE cards they give don't work with linux AFAIK. Nevertheless the drivers you get with the Huawei card are still for Windoze. But don't worry, if you are using the latest kernel it will get detected automatically. For the record, mine is 2.6.9-42.13 thats RHEL 4.
Now su as root. open vi and create this small script file say rconnect in your directory.
[root@nmoidu ~]# cat rconnect
sudo modprobe usbserial vendor=0x12d1 product=0x1001
mknod /dev/ttyUSB0 c 188 0
mknod /dev/ttyUSB1 c 188 1
Then set permissions for this to be executable.
Now for the modem properties and details of the dialup parameters, configure this file as below :
[root@nmoidu sysconfig]# cat /etc/wvdial.conf
[Modem0]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
Init3 = ATM0
FlowControl = NOFLOW
[Dialer Rconnect]
Username = 93293292323
Password = 932939392323
Phone = #777
Stupid Mode = 1
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Inherits = Modem0
[root@nmoidu sysconfig]#
Then add this file to setup the network parameters of the Rconnect interface.
[root@nmoidu ~]# cat /etc/sysconfig/network-scripts/ifcfg-Rconnect
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
ONBOOT=no
USERCTL=yes
PEERDNS=yes
TYPE=Modem
DEVICE=ppp0
BOOTPROTO=dialup
AC=off
BSDCOMP=off
VJCCOMP=off
CCP=off
PC=off
VJ=off
LINESPEED=115200
MODEMPORT=/dev/ttyUSB0
PROVIDER=Rconnect
DEFROUTE=yes
PERSIST=no
PAPNAME=93293293293# Change this no...:)
WVDIALSECT=Rconnect
MODEMNAME=Modem0
DEMAND=no
IPV6INIT=no
IDLETIMEOUT=600
[root@nmoidu ~]#
Customize each script and file according to the specifics in your machine like the device name and your phone no. etc. Run a dmesg to see under what device name your card is detected .
Now Run the script rconnect twice. Then do an ifup Rconnect.
Btw you'll have to call up Reliance and ask them to activate the card first and then the first connection will have to be done from a Windoze machine using the Rconnect software. Thats the unavoidable world of Windows . You have to live with it ;) .
Now once you are connected, browse , enjoy........
Alternately you can do it using the GUI too.
Create the rconnect script, run it.
Then open system-config-network . Add a new modem connection. Set the provider name to Reliance. Give no. to be dialled as #777. Enter your mob. no and password . Leave the other parameters as it is.
Follow the wizard and create the the new connection. Activate the new device from the GUI. Thats it.
In case of issues, Pls let me know. Leave a comment or mail me.
Wednesday, December 06, 2006
Setting up an SMS gateway
I am writing this little howto for setting up an email2sms gateway which basically sends a mail to your mobile , like any alerts etc.
Hardware/software requirements are:
1) A GSM modem (or a phone which can act as one). The key point is it should be able to talk to Linux as a modem. A lot of the modern CDMA/GSM phones have modems that need proprietary drivers to access the modem. These generally are not available for Linux.Choose one with support for linux.
Put your SIM into the modem, connect the serial cable to a serial-to-USB converter and connect to the system via USB port.( Nowadays I've seen the modems coming directly with a USB interface).
2) Linux , we used FC 5 since the modem drivers had some issues on RHEL.
3) The SMS software. We use here smstools ( http://smstools.meinemullemaus.de/)
Download the tar.gz file and do the normal installation - unzip , make , make install.
Go to the configuration file /etc/smsd.conf . Configure as follows
[root@smsgw]# cat /etc/smsd.conf
# Example smsd.conf. Read the manual for a description
devices = GSM1 # Put in any name here for the modem to be identified.
logfile = /var/log/smsd.log # Set the log file here so that you can use it for debugging
loglevel = 7 # Check out the http://smstools.meinemullemaus.de/configure.html for details
outgoing = /var/spool/sms/outgoing # Define directory where the mails will come
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed # Failed sms , for reasons like say - nil balance in SIM
incoming = /var/spool/sms/incoming # Define directory where incoming sms will be stored
sent = /var/spool/sms/sent # Mails sent out as sms
[GSM1] # Define each modem you named above , eg GSM1 , GSM2 etc.
device = /dev/ttyUSB0 # Define the device name of the modem
incoming = yes
We had used a serial-to-USB converter to connect the modem to the system. The modem hence appears to the system as a SUB device. So we define the GSM modem device as /dev/ttyUSB0. The mails that come into the outgoing folder should have the To field as the mobile no. of the person to whom the sms should be sent to. For automatically setting it to change the names of the mail id in the To field of the mail to the phone no. you will have to configure a filter like procmail to automatically change this.
[root@odin sent]# cat /etc/procmailrc
SHELL=/bin/sh
LOGFILE=/var/log/Proctest.log
LOG="--- Logging for ${LOGNAME}, "
#First, a few environment variables are included.
#Troubleshooting:
VERBOSE=yes
LOGABSTRACT=all
:0
* ^TO_ .*@company.com
| /usr/local/bin/extract-headers.sh
This calls for execution of the script extract-headers.sh for all mails coming to @ company.com domain.
The extract-headers.sh is just a script to extract the required headers only from the mail body and replace it with the phone no.s of the persons concerned in the To field , since the smsd sends the message to the number given in the To field of the message. See http://smstools.meinemullemaus.de/fileformat.html for more details on the sms format to be followed.
[root@smsgw]# cat /usr/local/bin/extract-headers.sh
#!/bin/bash
TMPFILE=$(mktemp)
FILE=$(mktemp -p /var/spool/sms/outgoing/)
formail -k -XFrom: -XSubject: -XTo: >> $TMPFILE # From, To and Subject headers copied to TMPFILE
rcptad=$(grep ^To: $TMPFILE | gawk '{print $2}') # search To field, output only mail-id part
perl -pi -e 's/To.*/To: 91999999999/' $TMPFILE;; # Replace mail id with mobile no.
FROM=$(grep From: $TMPFILE |gawk -F":" '{print $2}') # Get the From machine name
echo "from $FROM" >> $TMPFILE # Push the line "from sender-name" to the TMPFILE
cp $TMPFILE $FILE # Move the contents of TMPFILE to FILE
rm $TMPFILE # Delete TMPFILE
END of story. Start smsd in your system. put some mail in the /var/spool/outgoing folder , pay your mobile bill ;) and pray for the sms alerts to come :).
Contact me for any doubts.
___________________________________________________________________________
--
Thanks and Regards
Nabeel Moidu
Red Hat Inc.
Pune, India
If we don't believe in freedom of expression for people we despise, we don't believe in it at all. Noam Chomsky
Hardware/software requirements are:
1) A GSM modem (or a phone which can act as one). The key point is it should be able to talk to Linux as a modem. A lot of the modern CDMA/GSM phones have modems that need proprietary drivers to access the modem. These generally are not available for Linux.Choose one with support for linux.
Put your SIM into the modem, connect the serial cable to a serial-to-USB converter and connect to the system via USB port.( Nowadays I've seen the modems coming directly with a USB interface).
2) Linux , we used FC 5 since the modem drivers had some issues on RHEL.
3) The SMS software. We use here smstools ( http://smstools.meinemullemaus.de/)
Download the tar.gz file and do the normal installation - unzip , make , make install.
Go to the configuration file /etc/smsd.conf . Configure as follows
[root@smsgw]# cat /etc/smsd.conf
# Example smsd.conf. Read the manual for a description
devices = GSM1 # Put in any name here for the modem to be identified.
logfile = /var/log/smsd.log # Set the log file here so that you can use it for debugging
loglevel = 7 # Check out the http://smstools.meinemullemaus.de/configure.html for details
outgoing = /var/spool/sms/outgoing # Define directory where the mails will come
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed # Failed sms , for reasons like say - nil balance in SIM
incoming = /var/spool/sms/incoming # Define directory where incoming sms will be stored
sent = /var/spool/sms/sent # Mails sent out as sms
[GSM1] # Define each modem you named above , eg GSM1 , GSM2 etc.
device = /dev/ttyUSB0 # Define the device name of the modem
incoming = yes
We had used a serial-to-USB converter to connect the modem to the system. The modem hence appears to the system as a SUB device. So we define the GSM modem device as /dev/ttyUSB0. The mails that come into the outgoing folder should have the To field as the mobile no. of the person to whom the sms should be sent to. For automatically setting it to change the names of the mail id in the To field of the mail to the phone no. you will have to configure a filter like procmail to automatically change this.
[root@odin sent]# cat /etc/procmailrc
SHELL=/bin/sh
LOGFILE=/var/log/Proctest.log
LOG="--- Logging for ${LOGNAME}, "
#First, a few environment variables are included.
#Troubleshooting:
VERBOSE=yes
LOGABSTRACT=all
:0
* ^TO_ .*@company.com
| /usr/local/bin/extract-headers.sh
This calls for execution of the script extract-headers.sh for all mails coming to @ company.com domain.
The extract-headers.sh is just a script to extract the required headers only from the mail body and replace it with the phone no.s of the persons concerned in the To field , since the smsd sends the message to the number given in the To field of the message. See http://smstools.meinemullemaus.de/fileformat.html for more details on the sms format to be followed.
[root@smsgw]# cat /usr/local/bin/extract-headers.sh
#!/bin/bash
TMPFILE=$(mktemp)
FILE=$(mktemp -p /var/spool/sms/outgoing/)
formail -k -XFrom: -XSubject: -XTo: >> $TMPFILE # From, To and Subject headers copied to TMPFILE
rcptad=$(grep ^To: $TMPFILE | gawk '{print $2}') # search To field, output only mail-id part
perl -pi -e 's/To.*/To: 91999999999/' $TMPFILE;; # Replace mail id with mobile no.
FROM=$(grep From: $TMPFILE |gawk -F":" '{print $2}') # Get the From machine name
echo "from $FROM" >> $TMPFILE # Push the line "from sender-name" to the TMPFILE
cp $TMPFILE $FILE # Move the contents of TMPFILE to FILE
rm $TMPFILE # Delete TMPFILE
END of story. Start smsd in your system. put some mail in the /var/spool/outgoing folder , pay your mobile bill ;) and pray for the sms alerts to come :).
Contact me for any doubts.
___________________________________________________________________________
--
Thanks and Regards
Nabeel Moidu
Red Hat Inc.
Pune, India
If we don't believe in freedom of expression for people we despise, we don't believe in it at all. Noam Chomsky
Tuesday, August 08, 2006
Xen configuration
For those who have trouble on installing a CentOS VM on xen on Debian or Ubuntu , this page has a few helpful hints
http://www.tapodi.net/~jda/blog/archive/2006_05_01_index.html
http://www.tapodi.net/~jda/blog/archive/2006_05_01_index.html
Friday, August 04, 2006
Xen and virtualization
I have been working on Xen and virtualization for some time now and its been really impressive. Although it was a bit tough to get started and the concepts really took some time to get into my head , now it looks fine . I have got an FC3 xen kernel as a Guest OS (DomU) on an FC5 xen kernel. Things were pretty straight forward in FC5 . The networking and virtual disk concepts are a bit complicated for a starter , but finally what you get is an impressively efficient virtual OS running on top of your Host OS and you can hardly notice the performance difference.Nice work from Cambridge University. I'd certainly like to go deeper into the technology.
By the way I recently came across a good pasting site that you can use to paste large text that you would want to avoid directly pasting on a yahoo chat or IRC forum. http://rafb.net/paste/
By the way I recently came across a good pasting site that you can use to paste large text that you would want to avoid directly pasting on a yahoo chat or IRC forum. http://rafb.net/paste/
Friday, June 23, 2006
Anti virus plays villain
I recently had a bad time with my CEO's laptop(Its on M$ XP.As of now I can't even dream about having it on linux.But at least I am happy he admires Mozilla Thunderbird after using it).
It was showing a strange behaviour. The wireless network gets connected for a few seconds and then it immediately gets off from the network. When I try reconnecting it, it again repeats this same behaviour.I start a ping and the first few packets , say 12 or 15 of them give a response even if I try www.google.com if its done immediately after a reconnect to the wireless network , but then after a few seconds it even stops pinging to the gateway ( the wireless AP). I couldn't think of any firewall that would block any pattern of traffic only after a few seconds .
Well, finally it turned out to be an issue with the anti virus software installed , or rather a virus in the machine. The explanation I can think of is like this.
There's a virus in the system which the anti-virus seems to detect only after the network comes up and there's some regular interval when the anti virus software polls something to detect it and the moment it identifies the virus , it's inbuilt firewall cuts off the machine from the network.
If anyone has any better ideas , please suggest.
It was showing a strange behaviour. The wireless network gets connected for a few seconds and then it immediately gets off from the network. When I try reconnecting it, it again repeats this same behaviour.I start a ping and the first few packets , say 12 or 15 of them give a response even if I try www.google.com if its done immediately after a reconnect to the wireless network , but then after a few seconds it even stops pinging to the gateway ( the wireless AP). I couldn't think of any firewall that would block any pattern of traffic only after a few seconds .
Well, finally it turned out to be an issue with the anti virus software installed , or rather a virus in the machine. The explanation I can think of is like this.
There's a virus in the system which the anti-virus seems to detect only after the network comes up and there's some regular interval when the anti virus software polls something to detect it and the moment it identifies the virus , it's inbuilt firewall cuts off the machine from the network.
If anyone has any better ideas , please suggest.
Wednesday, June 21, 2006
Working on command line tools with proxy settings
In situations where you have a proxy and you need to use command line tools like wget going through the proxy , add the following commands
export http_proxy="http://192.168.1.10:3128"
export ftp_proxy="http://192.168.1.10:3128"
If you need authentication on it in wget,add
wget --proxy-user "Domain\username" --proxy-passwd "pass123" http://mirror.kernel.org/linux.iso
Altenatively, you may encode the username/password in the http_proxy variable:
export http_proxy="http://username:password@192.168.1.10:3128"
export ftp_proxy="http://username:password@192.168.1.10:3128"
export http_proxy="http://192.168.1.10:3128"
export ftp_proxy="http://192.168.1.10:3128"
If you need authentication on it in wget,add
wget --proxy-user "Domain\username" --proxy-passwd "pass123" http://mirror.kernel.org/linux.iso
Altenatively, you may encode the username/password in the http_proxy variable:
export http_proxy="http://username:password@192.168.1.10:3128"
export ftp_proxy="http://username:password@192.168.1.10:3128"
Monday, June 12, 2006
Linux Netfilter is better than PIX
Well, in some aspects.........
The other day I was trying to migrate a Linux Netfilter based firewall onto a Cisco PIX device.
I really felt pity for PIX. The GUI was very ill designed , many things were just so bad in the GUI that I decided to switch over to its CLI. I tried adding a new NAT rule , it went wrong and then when I tried to delete it it started giving errors.When I did the same with the CLI , it worked well.When I tried to change the interface IP of the mgmt interface , it said the dhcp server is in a different range so you cant change it.Vice versa it the dhcp said the interface ip was on a diff subnet. Finally the CLI worked.
Then to the rules .I don't know why Cisco doesn't feel that two external IPs should not be mapped to an internal IP. Iptables just flawlessly allows it.I've really lost the big impression I had about PIX.Though its better than the Checkpoint Firewall-1 that I have used on Nortel Contivity boxes it still doesn't have many feature that Netfilter has. Well it does have a few that Netfilter doesn't have too...But then PIX is supposed to be best in the market ....
Well , it didn't convince me.............
The other day I was trying to migrate a Linux Netfilter based firewall onto a Cisco PIX device.
I really felt pity for PIX. The GUI was very ill designed , many things were just so bad in the GUI that I decided to switch over to its CLI. I tried adding a new NAT rule , it went wrong and then when I tried to delete it it started giving errors.When I did the same with the CLI , it worked well.When I tried to change the interface IP of the mgmt interface , it said the dhcp server is in a different range so you cant change it.Vice versa it the dhcp said the interface ip was on a diff subnet. Finally the CLI worked.
Then to the rules .I don't know why Cisco doesn't feel that two external IPs should not be mapped to an internal IP. Iptables just flawlessly allows it.I've really lost the big impression I had about PIX.Though its better than the Checkpoint Firewall-1 that I have used on Nortel Contivity boxes it still doesn't have many feature that Netfilter has. Well it does have a few that Netfilter doesn't have too...But then PIX is supposed to be best in the market ....
Well , it didn't convince me.............
Sunday, May 28, 2006
Dragging windows in linux
On many occasions in linux , I have come across the situation where the window size is bigger thatn the screen size so in effect , i can't see the ok or apply buttons at the bottom .
In such cases , you can use the alt + mouse left click combination and press the arrow keys to drag the window up and down .
Hope it helps
In such cases , you can use the alt + mouse left click combination and press the arrow keys to drag the window up and down .
Hope it helps
Monday, May 22, 2006
Brainbench Job role
I didn't notice till recently that Brainbench had job role certifications that was given if a selected set of papers was cleared.Well, I set my sights on three of the available ones.
Network Administrator, Linux Administrator, Unix Administrator.
Finally cleared Network Administrator.The other two are still pending.Need to clear an elective from C , Bash , Perl , Python .
I think Bash or C might be my choice.
If that is also cleared , I will get the latter two job roles also.
I hope I can do it before the Games ends this 31st.
Network Administrator, Linux Administrator, Unix Administrator.
Finally cleared Network Administrator.The other two are still pending.Need to clear an elective from C , Bash , Perl , Python .
I think Bash or C might be my choice.
If that is also cleared , I will get the latter two job roles also.
I hope I can do it before the Games ends this 31st.
Wednesday, May 17, 2006
Some more games with Awk
To rename all files in current directory (append .bak to all of them):
ls -l | awk '{print "mv "$1" "$1".new"}' | sh
Thats doing an ls of all files , passing each name to awk as argument , renaming the awk input and passing the whole formatted output to shell
1. Renaming within the name:
ls -1 *name1* | awk '{print "mv "$1" "$1}' | sed s/name1/name2/2 | sh
2. remove only files:
ls -l * | grep -v drwx | awk '{print "rm "$9}' | sh
or with awk alone:
ls -l|awk '$1!~/^drwx/{print $9}'|xargs rm
Be careful when trying this out in your home directory. We remove files!
3. remove only directories
ls -l | grep '^d' | awk '{print "rm -r "$9}' | sh
or
ls -p | grep /$ | wk '{print "rm -r "$1}'
or with awk alone:
ls -l|awk '$1~/^d.*x/{print $9}'|xargs rm -r
Be careful when trying this out in your home directory. We remove things!
4. killing processes by name (in this example we kill the process called netscape):
kill `ps auxww | grep netscape | egrep -v grep | awk '{print $2}'`
or with awk alone:
ps auxww | awk '$0~/netscape/&&$0!~/awk/{print $2}' |xargs kill
It has to be adjusted to fit the ps command on whatever unix system you are on. Basically it is: "If the process is called netscape and it is not called 'grep netscape' (or awk) then print the pid"
ls -l | awk '{print "mv "$1" "$1".new"}' | sh
Thats doing an ls of all files , passing each name to awk as argument , renaming the awk input and passing the whole formatted output to shell
1. Renaming within the name:
ls -1 *name1* | awk '{print "mv "$1" "$1}' | sed s/name1/name2/2 | sh
2. remove only files:
ls -l * | grep -v drwx | awk '{print "rm "$9}' | sh
or with awk alone:
ls -l|awk '$1!~/^drwx/{print $9}'|xargs rm
Be careful when trying this out in your home directory. We remove files!
3. remove only directories
ls -l | grep '^d' | awk '{print "rm -r "$9}' | sh
or
ls -p | grep /$ | wk '{print "rm -r "$1}'
or with awk alone:
ls -l|awk '$1~/^d.*x/{print $9}'|xargs rm -r
Be careful when trying this out in your home directory. We remove things!
4. killing processes by name (in this example we kill the process called netscape):
kill `ps auxww | grep netscape | egrep -v grep | awk '{print $2}'`
or with awk alone:
ps auxww | awk '$0~/netscape/&&$0!~/awk/{print $2}' |xargs kill
It has to be adjusted to fit the ps command on whatever unix system you are on. Basically it is: "If the process is called netscape and it is not called 'grep netscape' (or awk) then print the pid"
Tuesday, May 16, 2006
Today's catch
I was busy most of the day with some networking issue at office. But I took some time out later at night to write at least one exam .So the catch of the day is
Networking Concepts.
I have set my sights on few others.Will have to wait till tomorrow for that.....
Networking Concepts.
I have set my sights on few others.Will have to wait till tomorrow for that.....
Monday, May 15, 2006
Brainbench games
Well ,Happy news for those who are looking out for a certification to add to your resume...
the famous online certification site Brainbench.com has started their brainbench games for this year.Its the best opportunity to write their exams for free online.Normally you get to write only a few for free and for the rest you need to pay.
I attempted the following today and cleared them
1)Information Technology Security Fundamentals
2)Network Technical Support
3)Internet Technology Fundamentals
4)Linux Administration - Redhat
That takes my Brainbench tally to 8 certifications.
Well it seems there is a prize for each country that has the most no. of certificate earners.
Check out www.brainbench.com for more...........
the famous online certification site Brainbench.com has started their brainbench games for this year.Its the best opportunity to write their exams for free online.Normally you get to write only a few for free and for the rest you need to pay.
I attempted the following today and cleared them
1)Information Technology Security Fundamentals
2)Network Technical Support
3)Internet Technology Fundamentals
4)Linux Administration - Redhat
That takes my Brainbench tally to 8 certifications.
Well it seems there is a prize for each country that has the most no. of certificate earners.
Check out www.brainbench.com for more...........
Pronouncing "Linux"
I've seen many people pronouncing Linux in many different ways.
Some say it with li as in liar
some with the li as in limit
some with the nu as in nook
Well going by what Torvalds says
http://www.paul.sladen.org/pronunciation/torvalds-says-linux.wav
I'll go by that
Some say it with li as in liar
some with the li as in limit
some with the nu as in nook
Well going by what Torvalds says
http://www.paul.sladen.org/pronunciation/torvalds-says-linux.wav
I'll go by that
Thursday, May 11, 2006
What Shorewall could and Nortel Contivity couldn't
I happened to have a strange issue.I had an IP to which I had done a layer of NATting so that an IP w.x.y.z would see to my network users as a.b.c.d. I used Nortel Contivity CSF/NAT software for this.
But whenever we did an FTP to the natted IP , the initial connection got established but after that the data connection was never established.It dropped connection whenever a data connection or passive mode was requested.I checked the rules at my end thoroughly , opened up the required ports , ensured that at the other end also everything was open.But nothing worked.Finally I decided to do a packet capture and set an ethereal capture with the filter on ftp port alone.
To my wonder the PORT raw FTP command was giving the ip a.b.c.d to the ftp server at w.x.y.z which the server was not aware since I was doing a NAT.
The problem was detected, but earlier this used to work when I did the same using Shorewall.
I read the documentation of Shorewall and understood that Linux was aware of this issue and hence there was a kernel module ip_nat_ftp which took care of modifying PORT and PASV commands in case of a nat.Shorewall automatically loads this module .Thats why it used to work earlier.
When contacted Nortel said its a known bug with their firmware version which they will fix in their next update.
Perhaps if their code was open, it might have got noticed a long back .................
Am I right????????
But whenever we did an FTP to the natted IP , the initial connection got established but after that the data connection was never established.It dropped connection whenever a data connection or passive mode was requested.I checked the rules at my end thoroughly , opened up the required ports , ensured that at the other end also everything was open.But nothing worked.Finally I decided to do a packet capture and set an ethereal capture with the filter on ftp port alone.
To my wonder the PORT raw FTP command was giving the ip a.b.c.d to the ftp server at w.x.y.z which the server was not aware since I was doing a NAT.
The problem was detected, but earlier this used to work when I did the same using Shorewall.
I read the documentation of Shorewall and understood that Linux was aware of this issue and hence there was a kernel module ip_nat_ftp which took care of modifying PORT and PASV commands in case of a nat.Shorewall automatically loads this module .Thats why it used to work earlier.
When contacted Nortel said its a known bug with their firmware version which they will fix in their next update.
Perhaps if their code was open, it might have got noticed a long back .................
Am I right????????
Subscribe to:
Posts (Atom)
