Linux Learning Note 6

Source: Internet
Author: User

The main function of the router NAT

Dant Destination Geology Conversion

Snat Source Address Translation

Definition of a gateway

The gateway is the IP on the router and our host on the same network segment

Set the Gateway

Systemctl Stop NetworkManager stops NetworkManager

VIM/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-XXX Network card Pretext Gateway
gateway= Gateway Address


VIM/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-XXX Global Gateway

gateway= Gateway IP


SYSTEMCTL Restart Network Restart network

Route-n


1. Local parsing file
Vim/etc/hosts
IP host Name

2.dns server pointing to File
Vim/etc/resolv.conf
NameServer DNS Server IP

Vim/etc/sysconfig/network-scripts/ifcfg-xxx

Dns1=dns Server IP

3. Local resolution of file and DNS read priority tuning

Vim/etc/nsswitch.conf

#hosts: DB Files Nisplus NIS DNS

Hosts:files DNS |dns files (in front of precedence files for local resolution file DNS representative server)


The establishment of DHCPD

Yum Install dhcp-y DHCP

There's no substance in vim/etc/dhcp/dhcpd.conf.

Less/usr/share/doc/dhcp-4.2.5/dhcp.conf.example Viewing sample files

cp/usr/share/doc/dhcp-4.2.5/dhcp.conf.example/etc/dhcp/dhcpd.conf Copying a sample file

vim/etc/dhcp/dhcpg.conf to modify a file

What to modify:

7 option Domain-name "example.com";

8 option Domain-name-servers 172.25.44.254; (Gateway)

Subnet 172.25.44.0 netmask 255.255.255.0{

Range 172.25.44.100 172.25.44.200;

Option routers 172.250.44.254;

33}

Delete all after

Systemctl start DHCPD

Systemctl Enable DHCPD


System Log Default classification

/var/logmessages system services and logs, including service information, error, etc.

/var/log/secure System Certification Information log

/var/log/maillog System Mail Service information

/var/log/cron System Timing Task Information

/var/log/boot.log System Boot Information

Systemd-journald # # #日志分析进程
Journalctl # # #日志分析命令

Journalctl-n 5 # #查看最近生成的5条日志
Journalctl-p Err # #查看系统报错
Journalctl--since--until # # #查看某个时间段生成的日志
Journalctl-o Verbose # # #查看日志能够使用的条件参数
Journalctl _uid= # #进程uid
_pid= # #进程id
_gid= # #进程gid
_hostname= # #进程所在主机
_systemd_unit= # #服务名称
_comm= # #命令名称

RSYSLOGD Service This service is the process used to manage the system log

Service configuration file

Vim/etc/rsyslog.conf


Service.loglevel logfile

*. */var/log/all.log # #所有服务的所有日志都放到/var/log/all.log

Format

Log device (type). (connection symbol) log-level log processing mode (action)

Log device (can be understood as log type)

Auth PAM-generated logs

Verification information of Authpriv SSH,FTP and other login information

Cron Time Task related

Kern kernel

LPR Printing

Mail message

Mark (syslog)-rsyslog service internal information, time identification

News Newsgroups

Related information generated by user program

UUCP Ubix to UNIX copy, related communication between UNIX hosts


Log synchronization

In the log receiver
Vim/etc/rsyslog.conftcp
15$modload IMUDP Log Accept Plugin
16$udpserverrun 514 Log Accept plugin use port
45$template Westos, "%timegenerated%%fromhost-ip%%syslogtag%%msg% \ n"

Time IP File Results
In the log sender
* * @ Log receiver IP via UDP write to I send log to target host (@ for [email protected]@)

Finish configuring the Restart RSYSLOGD service
Close firewall
Systemctl Stop Firewalld


>/var/log/messages on both sides.

Logger test Message Log Sender

Tail-f/var/log/message Log Receiver


Linux Learning Note 6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.