Wednesday, September 23, 2020

How can I configure static IP in Linux CentOS-7/Redhat-7

Static IP configuration

HWADDR=00:A8:A2:0A:BA:B8
TYPE=Ethernet
BOOTPROTO=none
# Server IP #
IPADDR=192.168.1.200
# Subnet #
PREFIX=24
# Set default gateway IP #
GATEWAY=192.168.2.254
# Set dns servers #
DNS1=192.168.2.254
DNS2=192.168.254.254
DNS3=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
# Disable ipv6 #
IPV6INIT=no
NAME=eth0
UUID=41171a6f-bce1-44de-8a6e-cf5e782f8bd6
DEVICE=eth0
ONBOOT=yes

Thursday, February 5, 2015

How to Huawei router configuration

How to Huawei router configuration


Huawei router configuretion is very easy. Any people can do it esely. I have giv the simple command below:
Huawei router configuration
<Huawei>
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]

[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip address 10.12.12.1 24
[R1-GigabitEthernet0/0/0]

[R1-GigabitEthernet0/0/0]quit
[R1]

[R1]interface GigabitEthernet 0/0/1

[R1-GigabitEthernet0/0/1]ip address 10.12.13.1 24
[R1-GigabitEthernet0/0/1]quit
[R1]

[R1]interface LoopBack 0

[R1-LoopBack0]ip address 10.12.1.1 24

[R1-LoopBack0]qui

[R1]quit

<R1>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Feb  6 2015 12:15:06-08:00 R1 %%01CFM/4/SAVE(l)[0]:The user chose Y when deciding
 whether to save the configuration to the device.
Now saving the current configuration to the slot 17.
Save the configuration successfully.

How to Huawei router IP configuration

How to Huawei router IP configuration:

Huawei router IP configuretion is very easy. Any people can do it esely. I have giv the simple command below:
Huawei router IP configuration
Huawei Router IP configuration.
At first we will get user view.
<Huawei>
then we have to enter system view by simple command "system-view"
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
 Now we will give the router name Like as R1.
[Huawei]sysname R1
[R1]

[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.10.12.1 24
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]quit

[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.10.13.1 24
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]quit
 
[R1]interface LoopBack 0
 [R1-LoopBack0]ip address 10.10.1.1 24
[R1-LoopBack0]

I think it work fine.

Wednesday, February 4, 2015

Find Command



Find Command:



# find /usr/share/icons -name .png (only .png search)

# find /usr/share/icons -name *.png (regular expression is used)

# find -user liton -not -group liton (user liton but group is not liton)

# find /home -user liton -o -user user2 (user liton or user user2)

# find /home -not \( -user liton -o -user user2 \) (not user liton or user  user2,must be space before - and after user name)

# find / -name "*.png" -not user root ( find those png file whose user is not root)

# find / -name "*.png" -user root -mtime 12

# find -perm 744 (Exact Match)

# find -perm +222 (Matches if anyone can write)

# find -perm -222 (Matches if everyone can write)

# find /usr -size 1024k (Exact 1024)

# find /usr -size +1024k (Greater than 1024)

# find /usr -size -1024k (Less than size 1024)

# find -size +102400k -ok gzip {} \; (find 100M file or Folder and then compress those file/folder)

# find -name "*.conf" -exec cp {} \mnt \;

Mysqladmin flush commands

  All mysqladmin flush commands.

# mysqladmin -u root -ptmppassword flush-hosts 
 
# mysqladmin -u root -ptmppassword flush-logs 
 
# mysqladmin -u root -ptmppassword flush-privileges 
 
# mysqladmin -u root -ptmppassword flush-status 
 
# mysqladmin -u root -ptmppassword flush-tables 
 
# mysqladmin -u root -ptmppassword flush-threads

  • flush-hosts: Flush all information in the host cache.
  • flush-privileges: Reload the grant tables (same as reload).
  • flush-status: Clear status variables.
  • flush-threads: Flush the thread cache.

How to set MySQL root password?



How to set MySQL root password?


To set MySQL server root user password,

start the server, then issue the following commands:

# /usr/bin/mysqladmin -u root password 'new-password'

# /usr/bin/mysqladmin -u root -h www.example.net password 'new-password'

Alternatively you can run:

# /usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

How to create a MySQL Database in Linux ?



How to create a MySQL Database in Linux?


First login to your mysql server with your root credential


# mysql -u root –p
 Enter password:      (now type your root passwort)

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 705
Server version: 5.1.25-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Now create database testdb1

mysql> create database testdb1;

Now show all databases.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test           |
| testdb1             |
+--------------------+
4 rows in set (0.00 sec)