Wednesday, January 2, 2013
Linux Rename Eth0/Eth1 Network Interface Card Name [ Udev ]
We can use udev to change these settings.
Step #1: Find out the MAC address of the Ethernet device
Type the following command:
# ifconfig -a | grep -i --color hwaddr
Sample outputs:
#ifconfig -a | grep -i --color hwaddr
eth1 Link encap:Ethernet HWaddr 00:0C:29:CD:5A:7F
virbr0 Link encap:Ethernet HWaddr 52:54:00:7F:E6:58
virbr0-nic Link encap:Ethernet HWaddr 52:54:00:7F:E6:58
Note down the MAC address.
Step #2: Rename eth0 as wan0
To rename eth0 as wan0, edit a file called 70-persistent-net.rules in /etc/udev/rules.d/ directory, enter:
# vi /etc/udev/rules.d/70-persistent-net.rules
The names of the Ethernet devices are listed in this file as follows:
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:cd:5a:7f", ATTR{type}=="1", KERNEL=="eth*", NAME
="eth1"
Locate and identify the line with the NIC from step 1 (look for the MAC address). It may look like above. In this example, the interface eth1 will be renamed to wan0 (change NAME="eth1" to NAME="wan0"):
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:cd:5a:7f", ATTR{type}=="1", KERNEL=="eth*", NAME
="wan0"
Save and close the file. Reboot the system to test changes:
# reboot
Verify new settings:
# ifconfig -a
# ifconfig wan0
Friday, December 21, 2012
Automation - System Administration.
System administrator writes scripts that the system can execute at a particular time each day,week or month. Tasks that are common and often repeated,tedious are best performed through automation. Two question came in our mind when think about automation which are "What can be automated?" and "What should be automated?". Following are few tasks that can be performed through automation.
1) Adding new users
2) Process monitoring
3) File search and removal.
4) Configuration changes on servers.
5) Getting servers information.( Big environment)
6) Software Installation.
7) Remote administration tasks.
The above tasks can be performed by writing scripts. Scripts are program that can interact with the operating system using OS commands.There are many scripting language that can be used to write scripts like shell(Korn,bash),Perl,Python and others.
Tasks can be automated with cron services where we can execute certain scripts at a particular time,day,week or month.
1) Adding new users
2) Process monitoring
3) File search and removal.
4) Configuration changes on servers.
5) Getting servers information.( Big environment)
6) Software Installation.
7) Remote administration tasks.
The above tasks can be performed by writing scripts. Scripts are program that can interact with the operating system using OS commands.There are many scripting language that can be used to write scripts like shell(Korn,bash),Perl,Python and others.
Tasks can be automated with cron services where we can execute certain scripts at a particular time,day,week or month.
Tuesday, December 18, 2012
5 Useful Linux Touch command
1) Create an empty file
Below will create 0 bytes file called 'test123'. It will change the modification/access timestamp.
#touch test123
Touch -c avoid creating non-existence file.
2)Create new file's timestamp
#touch -t 05070915 test123
3)Change modification time
# touch -m test123
4) Change access time
# touch -a test123
5)Copy other file's timestamp.
#touch try123 -r test123
Below will create 0 bytes file called 'test123'. It will change the modification/access timestamp.
#touch test123
Touch -c avoid creating non-existence file.
2)Create new file's timestamp
#touch -t 05070915 test123
3)Change modification time
# touch -m test123
4) Change access time
# touch -a test123
5)Copy other file's timestamp.
#touch try123 -r test123
Friday, June 15, 2012
$PATH
To export
export PATH=$PATH:/home/velayuts/Desktop
To delete
del=':/home/velayuts/Desktop';export PATH="${PATH//$del}"
export PATH=$PATH:/home/velayuts/Desktop
To delete
del=':/home/velayuts/Desktop';export PATH="${PATH//$del}"
Tuesday, November 22, 2011
SSH Trust:SSHv2 to SSHv2
Steps To configure as follows:
FSecure SSH v2 --> FSecure SSH v2Case Study: ssh trust for user kumar from Sun to Moon
1) sun:-->ssh-keygen2 -t dsa (Key will be generated at user's home - /home/kumar/.ssh2)
2) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a kumar@sun. (This step is done to give some useful name and to avoid confusion.)
3) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a.pub kumar@sun.pub (This step is done to give some useful name and to avoid confusion.)
4) sun:/home/kumar/.ssh2-->echo 'IdKey kumar@sun' > identification ('Identification' file will be created)
5) Copy kumar@sun.pub to remote host's(moon) /export/home/kumar/.ssh
6) moon#:/home/kumar/.ssh2-->echo 'Key mathamsv@oktstcl1.okla.seagate.com.pub' > authorization
7)Done.Now user 'kumar' can ssh without password from Sun to Moon.
FSecure SSH v2 --> FSecure SSH v2Case Study: ssh trust for user kumar from Sun to Moon
1) sun:-->ssh-keygen2 -t dsa (Key will be generated at user's home - /home/kumar/.ssh2)
2) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a kumar@sun. (This step is done to give some useful name and to avoid confusion.)
3) sun:/home/kumar/.ssh2-->cp id_dsa_1024_sun_a.pub kumar@sun.pub (This step is done to give some useful name and to avoid confusion.)
4) sun:/home/kumar/.ssh2-->echo 'IdKey kumar@sun' > identification ('Identification' file will be created)
5) Copy kumar@sun.pub to remote host's(moon) /export/home/kumar/.ssh
6) moon#:/home/kumar/.ssh2-->echo 'Key mathamsv@oktstcl1.okla.seagate.com.pub' > authorization
7)Done.Now user 'kumar' can ssh without password from Sun to Moon.
Wednesday, October 12, 2011
To Capture/Record Unix command
There is way to record/capture what ever commands executed in Unix. You can use 'script' command where all the command dumped to a file that we specify and this process executed at the background. This is very useful when we do some software installation and we are able to capture all the steps and commands that we used.
#script ApacheInstallationSteps.txt
Script started, file is ApacheInstallationSteps.txt
#
#exit
Script done, file is ApacheInstallationSteps.txt
#
#script ApacheInstallationSteps.txt
Script started, file is ApacheInstallationSteps.txt
#
#exit
Script done, file is ApacheInstallationSteps.txt
#
Friday, October 7, 2011
Linux:Steps to change root password
Steps to change root password:
1)When GRUB is started press any key followed by 'a' to modify the kernel arguments before booting.
2) Add 1 or single at the end of line and press 'b' to boot to the single user mode.
3) Once single user mode started you can run 'passwd' command to set new password for 'root'.
4) Exit or reboot the server once password has been reset.
1)When GRUB is started press any key followed by 'a' to modify the kernel arguments before booting.
2) Add 1 or single at the end of line and press 'b' to boot to the single user mode.
3) Once single user mode started you can run 'passwd' command to set new password for 'root'.
4) Exit or reboot the server once password has been reset.
Subscribe to:
Posts (Atom)