2016年5月22日日曜日

Setting of CentOS7 (service, enable or disable switching, etc. of the firewall

change point

  • Adoption of the kernel 3.10 system
  • Installation that has been selected by default has become "minimal installation". Continuing to install, (substitute pets in ip a) ifconfig command does not even enter.
  • Desktop GNOME has become the main (KDE can also be selected).
  • Start-up process in the systemd adoption has become faster (replaced such as sysvinit or upstart)
  • firewall settings are firewall-cmd, became a firewall-config. iptables is set in the back of these commands.
  • Old hardware is out of support. Old RAID card, and the like of 100Mbps of NIC and 3ware. Since smartarray P400, etc. also goes out of support, I do not think can also be used to buy cheaply in the Yahoo auction.
  • The default file system has become XFS. ext4 and Btrfs can also be selected.
  • Boot loader to GRUB2. Directly rewrite is ruining /boot/grub/menu.conf.
  • Around virtualization is replaced by the latest one.
  • ruby2.0, python2.7.5, openjdk7, gcc-4.8.x
  • samba4.1 (because samba love you or be able to participate in wrote .AD.)
  • Apache2.4, MariaDB5.5, PostgreSQL9.2 (although MySQL Server has been replaced in MariaDB, programs written for mysql is available.

Confirmation of service

  • chkconfig has already become a thing of the past. The future is correct to use a systemctl command.
  • systemctl list-unit-files
    # UNIT FILE                                   STATE
    # proc-sys-fs-binfmt_misc.automount           static
    # dev-hugepages.mount                         static
    # dev-mqueue.mount                            static
    .....
    .....
    # list-dependenciesだとツリー状に見れる。
    systemctl list-dependencies
    # default.target
    # ├─accounts-daemon.service
    # ├─gdm.service
    # ├─iprdump.service
    # ├─iprinit.service
    # ├─iprupdate.service
    # ├─network.service
    # ├─rtkit-daemon.service
    # ├─systemd-readahead-collect.service
    # ├─systemd-readahead-replay.service
    # ├─systemd-update-utmp-runlevel.service
    # └─multi-user.target
    #   ├─abrt-ccpp.service
    #   ├─abrt-oops.service
    #   ├─abrt-vmcore.service
    #   ├─abrt-xorg.service
    #   ├─abrtd.service
    #   ├─atd.service
    .....
    .....

Disabling the firewall
Please go below disable the firewall.
# First, look for the firewall service.
systemctl list-unit-files | grep firewall
# firewalld.service                           enabled
# Since it was found that it "firewalld.service", to disable.
systemctl disable firewalld.service
# rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
# rm '/etc/systemd/system/basic.target.wants/firewalld.service'
# ステータス確認。disabledになった。
systemctl list-unit-files | grep firewall
# firewalld.service                           disabled
# 再起動してファイアウォールの状態を確認する。
reboot

After the restart, check the status of the firewall in the iptables command.

sudo iptables -L -n
# Chain INPUT (policy ACCEPT)
# target     prot opt source               destination
# ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
# ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53
# ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:67
# ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:67
# Chain FORWARD (policy ACCEPT)
# target     prot opt source               destination
# ACCEPT     all  --  0.0.0.0/0            192.168.122.0/24     ctstate RELATED,ESTABLISHED
# ACCEPT     all  --  192.168.122.0/24     0.0.0.0/0
# ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
# REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
# REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
# Chain OUTPUT (policy ACCEPT)
# target     prot opt source               destination

Start-up of services and stop

You can use the systemctl command.

# インストールされていなければ先にインストールします。
sudo yum install httpd.x86_64
# apacheの起動
sudo systemctl start httpd.service
# ステータス表示
sudo systemctl status httpd.service
# 停止
sudo systemctl stop httpd.service
# apacheの有効化
sudo systemctl enable httpd.service
# apacheの無効化
sudo systemctl disable httpd.service

Network Settings
"/etc/sysconfig/network-scripts/" following "ifcfg-***" of the file is a network configuration file.
The BOOTPROTO was changed to static, to append IPADDR, NETMASK, GATEWAY, the NAMESERVER. In addition, ONBOOT is keep the If YES NO.

# ifcfg-enp0s25のファイル名は環境によって異なります。
sudo vi ifcfg-enp0s25

The contents of fg-enp0s25 (Please correct an example. As appropriate)

HWADDR="00:19:99:xx:xx:xx"
TYPE="Ethernet"
BOOTPROTO="static"
IPADDR=172.20.1.240
NETMASK=255.255.255.0
GATEWAY=172.20.1.1
NAMESERVER=172.20.1.1
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
NAME="enp0s25"
UUID="dfd8b39a-0115-4bd4-8494-e403e5133f04"
ONBOOT="yes"

Restart of network

# ネットワークの設定変更後にサービス再起動
sudo systemctl restart network.service


To disable SELinux (disabled in the restart timing).
sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
# SELinuxの状態確認
getenforce

0 件のコメント:

コメントを投稿