GOOGLE Search

Google
 

Thursday, February 14, 2008

Linux Tip No. 17: Enable/Disable interface

[root@jepoy]# ifdown eth0
[root@jepoy]# ifup eth0

Wednesday, February 13, 2008

Linux Tip No. 16 IP Address Aliasing - Permanent

IP Address Aliasing - Permanent

Edit you config file


Config file: /etc/sysconfig/network-scripts/ifcfg-eth0:0

DEVICE=eth0:0
ONBOOT=yes
BOOTPROTO=static
BROADCAST=192.168.10.255
IPADDR=192.168.10.12
NETMASK=255.255.255.0
NETWORK=192.168.10.0
ONBOOT=yes

Tuesday, February 12, 2008

Linux Tip No.15: IP Address Aliasing - Temporary

Network IP aliasing

ifconfig eth0 XXX.XXX.XXX.XXX netmask 255.255.255.0 broadcast XXX.XXX.XXX.255

route add -host XXX.XXX.XXX.XXX dev eth0

ifconfig eth0:0 192.168.10.12 netmask 255.255.255.0 broadcast 192.168.10.255
ifconfig eth0:1 192.168.10.14 netmask 255.255.255.0 broadcast 192.168.10.255

route add -host 192.168.10.12 dev eth0
route add -host 192.168.10.14 dev eth0

Monday, February 11, 2008

Linux Tip No.14: Locally resolve hosts

Locally resolve hosts

File: /etc/hosts

[root@proxy etc]# more hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost

203.189.xxx.xxx proxy.jepoy.net

192.168.0.254 proxy

192.168.0.36 winxp

[root@proxy etc]# ping winxp

PING winxp (192.168.0.36) 56(84) bytes of data.

[root@proxy etc]# ping proxy

PING proxy (192.168.0.254) 56(84) bytes of data.

64 bytes from proxy (192.168.0.254): icmp_seq=0 ttl=64 time=0.092 ms

Sunday, February 10, 2008

Linux Tip No.13: Setting your resolver

Setting your resolver – DNS Entries

File: /etc/resolv.conf

search name-of-domain.com - Name of your domain or ISP's domain if using their name server

nameserver XXX.XXX.XXX.XXX - IP address of primary name server

nameserver XXX.XXX.XXX.XXX - IP address of secondary name server

Example:

search jepoy.net

nameserver 203.189.xxx.xxx

nameserver 203.189.xxx.xxx

Thursday, February 7, 2008

Linux Tip No. 12: DHCP client configuration

DHCP client configuration
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0

ONBOOT=yes

BOOTPROTO=dhcp

Tuesday, February 5, 2008

Linux Tip No. 11: Changing your IP Address - Permanent

Changing your IP Address – Permanent

Files: /etc/sysconfig/network-scripts/

[root@proxy network-scripts]# ls -l

total 360

-rw-r--r-- 3 root root 190 Feb 28 2007 ifcfg-eth0

-rw-r--r-- 3 root root 191 Nov 8 2005 ifcfg-eth1

-rw-r--r-- 1 root root 254 Jun 21 2001 ifcfg-lo

Pattern:
DEVICE=eth0/eth1/eth3
ONBOOT=yes/no
BOOTPROTO=static/none

IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx.
GATEWAY=xxx.xxx.xxx
 
Edit ifcfg-eth0:
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.10.10.10
NETMASK=255.255.255.0
GATEWAY=10.10.10.1

Monday, February 4, 2008

Linux Tip No. 10: Changing your IP Address - Temporary

Changing your IP Address - Temporary

Syntax:

Ifconfig netmask

[root@bigboy tmp]# ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up

The ifconfig command does NOT store this information permanently. Upon reboot this information is lost. (Manually add the commands to the end of the file /etc/rc.d/rc.local to execute them upon boot.)

Thursday, January 31, 2008

Linux Tip No. 9: Setting your hostname

Setting your hostname

File: /etc/sysconfig/network

[root@proxy sysconfig]# more network

NETWORKING=yes

HOSTNAME=localhost.localdomain

Example:

Edit the file

[root@proxy docadmin]# cat /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=proxy.jepoy.net

[root@proxy docadmin]# /sbin/service network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0
[ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1: [ OK ]

[root@proxy docadmin]# hostname

proxy.jepoy.net

Tuesday, January 15, 2008

Linux Tip No. 8: Tcpdump to capture traffic

Using tcpdump to capture the traffic

[root@proxy /]# /usr/sbin/tcpdump -i eth0 port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
09:17:49.575590 IP proxy.jepoy.ph.56790 > nxdomain.guide.opendns.com.http: S 583111147:583111147(0) win 5840
09:17:49.755526 IP nxdomain.guide.opendns.com.http > proxy.jepoy.ph.56790: S 1378975104:1378975104(0) ack 583111148 win 16384
09:17:49.755592 IP proxy.jepoy.ph.56790 > nxdomain.guide.opendns.com.http: . ack 1 win 1460
09:17:49.756126 IP proxy.jepoy.ph.56790 > nxdomain.guide.opendns.com.http: P 1:248(247) ack 1 win 1460

Monday, January 7, 2008

Linux Tip No. 7: Print System Info

uname - print system info

Example:
[admin@proxy ~]$ uname -a
Linux proxy 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux

Sunday, January 6, 2008

Linux Tip No. 6: Creating a Logical Link

Create a File as a Logical Link to Another File

[root@mail admin]#ln -s existingFile newFile

Example:
Link the maillog to your home directory

[root@mail admin]#ln -fs /var/log/maillog .
[root@mail admin]#ls -al
lrwxrwxrwx 1 root root 16 Jan 7 14:48 maillog -> /var/log/maillog

Wednesday, January 2, 2008

Linux Tip No. 5: Determining the uptime

[root@mail admin]# uptime
10:45:52 up 89 days, 10:26, 1 user, load average: 0.00, 0.02, 0.00

Wednesday, December 26, 2007

Linux Tip No. 4: Sorting the Biggest Directory

This command will show the biggest directory.

[root@nuxmachine admin]# du -Sh | sort -n
4.0K ./backup
9.8M ./backup/web
11G ./backup/home
16K ./.ssh
28K ./backup/Dovecot
28K ./backup/users/last-full
36K .
36K ./backup/users
40K ./backup-sh
328K ./backup/Postfix
628K ./backup/MailScanner

Monday, December 17, 2007

Linux Tip No. 3: How to Check NIC Settings in Tru64

How to Check NIC Speed and Negotiation

#hwmgr get attr -cat network | grep -E "name|speed|duplex"

Thursday, December 13, 2007

Linux Tip No. 2: Combining Tail and Awk

- you can use this command to provide a nice output of logs.

Command:
>tail -f logs.log | grep -e "word" | awk '{ print $12 "\t" $13' }'

"word" - any line containing "word" will be captured
$12 - column 12
"\t" - space

Tuesday, December 11, 2007

How To: Foward Tape Content in Tru64

How To: Forward Tape Content in Tru64

root@machine01:/home/data/backup/databases# mt fsf 1
root@machine01:/home/data/backup/databases# vrestore -t -f /dev/ntape/tape0
vrestore: Date of the vdump save-set: Mon Nov 5 22:22:07 2007
vrestore: Save-set source directory : /home/data/backup/
vrestore: Target directory : /usr1/data/backup/

Tuesday, December 4, 2007

Devices on AIX

Devices on AIX

Devices Information on AIX

1.List all devices on a system
lsdev
Device states are: Undefined; Supported Device, Defined; Not usable
(once seen), Available; Usable

2.List all disk devices on a system (Some other devices are: adapter,
driver, logical volume, processor)
lsdev -Cc disk

3.List all customized (existing) device classes (-P for complete list)
lsdev -C -r class

4.Remove hdisk5
rmdev -dl hdisk5

5.Get device address of hdisk1
getconf DISK DEVNAME hdisk1 or bootinfo -o hdisk1

6.Get the size (in MB) of hdisk1
getconf DISK SIZE hdisk1 or bootinfo -s hdisk1

7.Find the slot of a PCI Ethernet adapter
lsslot -c pci -l ent0

8.Find the (virtual) location of an Ethernet adapter
lscfg -l ent1

9.Find the location codes of all devices in the system
lscfg

10.List all MPIO paths for hdisk0
lspath -l hdisk0

11.Find the WWN of the fcs0 HBA adapter
lscfg -vl fcs0 | grep Network

12.Temporarily change console output to /console.out
swcons /console.out (Use swcons to change back.)

Monday, December 3, 2007

Router: Traffic Shaping

Traffic Shaping

class-map match-any IB-11.70
match access-group name IB-11.70
!
class-map match-any OB-11.70
match access-group name OB-11.70
!
!
policy-map To-Public
class OB-11.70
shape average 256000
!
policy-map To-Lan
class IB-11.70
shape average 256000
!
!
interface FastEthernet0
description ***LAN side***
ip address 20.18.11.65 255.255.255.224
service-policy output To-Lan
speed auto
!
interface Serial0
description *** To Public Serial 2/1 ***
bandwidth 2000000
ip address 20.18.11.98 255.255.255.252
service-policy output To-Public
load-interval 30
clockrate 2000000
!
ip route 0.0.0.0 0.0.0.0 20.18.11.97
!
!
ip access-list extended IB-11.70
permit ip any host 20.18.11.70
ip access-list extended OB-11.70
permit ip host 20.18.11.70 any

Note:
The service is always in the OUTPUT policy.
Service Policy To-LAN is inbound of LAN.
Service Pplicy To-Public is outbound of LAN.

Linux Tip No. 1: Change Timezone

Change Timezone on AIX
chtz (timezone eg GMT0BST) - Changes the timezone in /etc/environment file