Once a Linux VM is cloned, you need to do the following:
A. Make sure proper NIC card is selected in the VM settings.
B. Login to the VM. cd /etc/sysconfig/network-scripts -> vi ifcfg-eth0 -> Here change the IP address of the cloned VM. Delete hwaddress which is MAC
C. Come out from the directory by issuing cd .. and cd ..
D. cd /etc/syconfig -> vi network -> Here change hostname. Also here you can change Gateway
E. Remove duplicate MAC entry by deleting….
rm -rf /etc/udev/rules.d/70-persistent-net.rules
F. Now reboot the VM by issuing init 6 command
G. Once the VM is up, login and check.
To switch user to root in linux:
1. Assign IP address to eth0 interface (NIC) card
Here we can assign the IP address
to save and close it :wq!
To change the Default gateway
cd/etc/sysconfig/ vi network
2. To enable SSH / Root login
<< To find escape :/Root >>
Service sshd restart
Service network restart
3. Su root – to execute commands
To restart / start / stop service
4. To login via GUI
This will reboot the system and we can login via GUI
5. If you clone a Linux VM, you also need to take care of MAC which usually the parent VM’s MAC will be copied. We need to delete those
> first note down the VM’s MAC by VM -> Edit settings -> Network adapter
> In the VM, go to the below path
Delete MAC entries which are not related to the cloned VM
6. df -h
To get partition size of all drives in human readable format
7. du -sh
To get folder size
8. uname -r
To get Kernel version
Grep command is used to search inside a file
- Open a file vi filename.
- /stringname and press enter.
- Repeat this if you want to search a repeatedly occuring character / word.
Enable SNMP on Linux servers:
Configuring on old linux – RHEL 3
Open Terminal and type
To restart network type
If network is having issues, try giving commands
Configuring Network on Cent OS 7 / Redhat 7
Cent OS / Redhat 7 network configurations are little bit different compared to their old versions. During the setup you will configure the IP address however once the installation is completed and if you type ifconfig command, you will get error as command not found.
Cent OS 7 / RHEL 7 does not has ifcfg-eth0 NIC card. Instead it is ifcfg-ens160. so assign IP to this NIC card.
To rectify this you need to install net-tools through yum command:
yum provides ifconfig
yum install net-tools Once done make sure to issue the following commands: service network restart service sshd restart you may also want to stop Firewall (iptables) service iptables stop
service command – list running services
The syntax is as follows for CentOS/RHEL 6.x and older (pre systemd):
service --status-all | more
service --status-all | grep ntpd
service --status-all | less
Print the status of any service
To print the status of apache (httpd) service:
service httpd status
List all known services (configured via SysV)
List service and their open ports
Turn on / off service
chkconfig service off
chkconfig service on
chkconfig httpd off
chkconfig ntpd on