Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, February 23, 2012

how to assignig ip on linux


Assigning IP Address on Linux:

To check IP address:
# ifconfig              >> to see all interfaces
# ifconfig eth0      >> to see specific interface

Required File to Edit:
#vi  /etc/sysconfig/network-scripts/ifcfg-eth0   >> edit ifcfg-eth0 file to add IP detail
#Vi  etc/resolv.conf  >> to add NameServer or dns
# vi /etc/sysconfig/network  >> add GATEWAY & Hostname etc
#vi /etc/hosts    >> To Name Resolv
 
To up/down interfaces:
# ifconfig eth0 up       >> to up eth0
#ifconfig eth0 down  >> to down eth0

Assigning IP Address Temporary on interface: (After restarting this IP address will gone)
# ifconfig eth0 172.16.2.21 netmask 255.255.255.0 up  >> set IP on eth0 interface
# route add default gw 172.16.2.1 eth0  >> set getaway on eth0 interface

Assigning IP Address Permanently on interface:  (For this situation you have to edit mamually and also using netconfig command)

Using netconfig command:
# netconfig   >>(Press Enter Key, Now you get an interface, where you configure IP address). Then
# service network restart (Press Enter Key, that will done)
(N.B. As soon as possible i provide more details screen shot)

Manually Assigning IP address:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0   >> just view the configuration file
#  vi  /etc/sysconfig/network-scripts/ifcfg-eth0   >> edit ifcfg-eth0 file to add IP detail
 
To add default gateway (location - /etc/sysconfig/network)
# vi /etc/sysconfig/network  >> add GATEWAY


To Add NameServer ( /etc/resolv.conf)
Vi  etc/resolv.conf  >> to add NameServer

# services network restart  >> run this command to enable changes .

Now you see the change of "ifcfg-eth0" file. # cat /etc/sysconfig/network-scripts/ifcfg-eth0

 Add Virtual interface address permanently:
#  vi  /etc/sysconfig/network-scripts/ifcfg-eth0:1      >> to create new virtual interface and assign IP
check out the created virtual interface

# services network restart  >> run this command to enable changes .

# cat   /etc/sysconfig/network-scripts/ifcfg-eth0:1      >> to view interface

Some other Ping commands:
#ping 4.2.2.2 -s 2048   >> to ping load
#ping 4.2.2.2 -c 5        >> number of time to ping
#ping 172.168.1.0 -b  >> Broadcast ping 


Monday, February 20, 2012

How to reset centos password


CentOS Password Resetting (GRUB):

 
Step 1: The first step is to reboot your Server/PC
Step 2:  At during rebooting, you see the following screen. Press any key to hold booting
 
Step 3:  After pressing key, you get the screen. (Cause I have GRUB Password)
  Step 4: Now you press “P” for entering GRUB Password
 
Step 5: After entering GRUB Password, you get the screen, now you press “e” for edit
 Step 6: You get 3 options. You select “Kernel /vmlinez” line and press “e” again.
Step 7: you get the screen…
Step 8: On the screen you type “single” keyword with “Space” (Make sure the space before “single” keyword), don’t wary see the screen….
Step 9:  After typing “Single” keyword, you press Enter. Then you get the screen again. Now you press “b” to boot the system into single user mode.
Step 10: After complete booting you get the screen. Now you can able to change the password.
Step 11: On the screen you just type “password” keyword and press enter to type your new password.
Step 12: After changing password you just type “reboot” to reboot your system. You can login with your system with new password. .  I hope that will be fine….