Search rpm package name by command name using Yum

Sometimes I’ve situation that I know command name but I don’t know which package provides that command. Then use yum provides command.

# yum provides <commamd_name>
# i.e. lsusb
# yum provides lsusb
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
base/7/x86_64/filelists_db                                             | 7.1 MB  00:00:06     
extras/7/x86_64/filelists_db                                           | 243 kB  00:00:00     
updates/7/x86_64/filelists_db                                          | 3.7 MB  00:00:03     
usbutils-007-5.el7.x86_64 : Linux USB utilities
Repo        : base
Matched from:
Filename    : /usr/bin/lsusb

With the result of yum, now I know usbutils package will provides lsusb command.

How to manage server services startup using systemctl

Use systemctl to manage server services startup in CentOS7.

## To enable auto startup
systemctl enable SERVICENAME.service

## To disable auto startup
systemctl disable SERVICENAME.service

## To list all services registered to systemctl
systemctl list-unit-files -t service

## Ask status of a service
systemctl is-enabled SERVICENAME.service

How to drop connection using firewalld

This is about how to drop incoming connection using firewalld on centos7.

First, check what zones your firewalld provides.

# firewall-cmd --get-zones
block dmz drop external home internal public trusted work

This time I need drop zone and it is listed.
Now to list IP address which want to be dropped, run command:

# firewall-cmd --zone=drop --permanent --add-source=192.168.0.0/24
# firewall-cmd --reload

Do not forget to reload or the rule will not be loaded.

To confirm current setting, run command:

# firewall-cmd --get-active-zones
dmz
 interfaces: eth1
drop
 sources: 192.168.0.0/24
public
 interfaces: eth0

And, to remove rules from drop zone, run command:

# firewall-cmd --zone=drop --permanent --remove-source=192.168.0.0/24
# firewall-cmd --reload