Linux Fourth Week Lesson notes (1) gateway, DNS,DHCP, log

Source: Internet
Author: User
Tags system log rsyslog

We are aware that by default the user-created UID is starting from 1000, how should we set the UID to start at 2000?

A: Here we need to modify a configuration file:

under Super User access,vim/etc/loglin.defs this configuration file

find the corresponding parameter, save and exit after modifying, then restart, so the system default UID is starting from 2000.

two . Gateways

Introduction: In the Internet, there are a lot of IP addresses, we can only realize the computer in the same network segment to achieve interconnection, then how to achieve different network segments of the computer to achieve interconnection? --Gateway

Brief working principle: the computer and the router are connected, the router has a routing table, can find a and own host belongs to the same network segment IP (this IP is the gateway), its own IP through packaging, through the router into the transmission target host can recognize the IP address, The target host is giving back to the router, and the router transmits the same principle to its own host, thus realizing the interaction between the hosts of different network segments.

Related concepts:

Router: The main function is to make NAT (Net Address translation)

Gateway: The router is routed from the table to its own IP on the same network segment .

To set the gateway:

A, view your IP address and the IP address of the destination host

b, try the ping command under different network segments. See if it makes sense. The normal situation is not working.

C, enter on one of the virtual machines

Vim/etc/sysconfig/network

at the end of the file insert: gateway= the gateway IP, and then save the exit

Restart Network:systemctl restart

Query Gateway:route-n

Finally, try the ping command on the host

three . dns*

Overview:DNS is a single server

This server provides the ability to answer client names and IP correspondence

setting up DNS

To enter the configuration file:

Vim/etc/resolv.conf

add:nameserver <dns Server ip> (this IP is consistent with the gateway IP above)

vim/etc/sysconfig/network-scripts/ifcfg-Network card configuration file (network card name such as eth0)

Dns1=dns Server IP

Parsing files locally

Vim/etc/host

The IP host name, if there is no gateway. It is not possible to ping the same. Need to be set on the same network segment)

Local parse file and DNS read priority tuning

Vim/etc/nsswitch.conf

Adjust the priority of files and DNS on line 38th

(who listens to who in front of)

Four. DHCP Service

A. Download DHCP

Yum Install Dhcp-y

B. Installation

C. Viewing the configuration file

Less/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example

D. Copying a configuration file

Cp/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example/etc/dhcp/dhcpd.conf

E. Modifying a configuration file

Vim/etc/dhcp/dhcpd.conf

Delete after option Domain-name-servers on Line 9, and modify the IP for yourself

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/89/1A/wKiom1gHb5CCRDe0AAHNFraXfZk427.png-wh_500x0-wm_3 -wmp_4-s_1779875978.png "title=" 2016-10-19 15_33_30 screenshot. png "alt=" wkiom1ghb5ccrde0aahnfraxfzk427.png-wh_50 "/>

27 Line Content Delete, so that only one subnet in the configuration file, such as IP information

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/89/17/wKioL1gHb7DiY7PLAAHBRwWVvLk925.png-wh_500x0-wm_3 -wmp_4-s_201572658.png "title=" 2016-10-19 15_33_38 screenshot. png "alt=" wkiol1ghb7diy7plaahbrwwvvlk925.png-wh_50 "/>

Subnet own host network segment the last set of numbers is 0. Netmask 255.255.255.0

Range itself sets the IP range (ip1 ip2) that is on the same network segment as the host

Option Route Gateway IP

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/89/1A/wKiom1gHb87hxR9dAAGmJZpe3j8622.png-wh_500x0-wm_3 -wmp_4-s_2227992181.png "title=" 2016-10-19 15_33_43 screenshot. png "alt=" wkiom1ghb87hxr9daagmjzpe3j8622.png-wh_50 "/>

F. Restart DHCP

Systemctl start DHCPD

G. Purging log files:

>/var/log/messages

H. Re-start the DHCPD service

Systemctl Restart Dhcpd.service

I. Setting up a dynamic acquisition IP on another virtual machine

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

J. Restarting the Network

Systemctl Restart Network

last ifconfig. View your own dynamically acquired IP

Five. System log

/var/log/messages 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

Log Management Service Rsyslog

1.rsyslog is responsible for collecting logs and classifying storage logs

2.rsyslog Log Classification

vim/etc/rsyslog.conf N Master configuration file

Within the file,

service . Log level/storage file

* */var/log/westos

Log level

Debug//debugging information, maximum log information

Info//General information log, most commonly used

Notice //information of the most important general conditions

Warning //Warning level

Err //Error level. Information that prevents a feature or module from working

Crit//severity level, information that prevents the entire system or the entire software from working properly

Alert //information that needs to be changed immediately

Emerg //kernel crashes and other critical records

None //God horse does not record

Note: From top to bottom, levels are low to high, and Sue Records less information

Instance:

1. Record to normal file or device file

*. */var/log/file.log (the path here is the absolute path, because this is the only way to find the file location exactly in any case)

2. Log synchronization (emphasis)

A. First, close the firewall for both hosts

Systemctl Stop Firewalld

B. Opening a configuration file: Vim/etc/rsyslog.conf Modifying the contents of a configuration file

on the sender of the log: *. * @ The destination host IP/through the UDP protocol, send logs to the host. The premise is to ping the ha (in 55 line position)

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/89/17/wKioL1gHcEPTDeWoAADs_ET9kCg582.png-wh_500x0-wm_3 -wmp_4-s_3827885955.png "title=" screenshot from 2016-10-19 08_21_32.png "alt=" Wkiol1ghceptdewoaads_et9kcg582.png-wh _50 "/>

on the receiving side of the log: also open the above configuration file, "# $ModLoad IMUDP" in lines 15 and 16, "# $UDPServerRun 514" before "#" Delete again: Wq

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/89/1A/wKiom1gHcGKi9JYcAAE3xhLRsfc628.png-wh_500x0-wm_3 -wmp_4-s_634223101.png "title=" screenshot from 2016-10-19 08_21_57.png "alt=" Wkiom1ghcgki9jycaae3xhlrsfc628.png-wh_ "/>

# $ModLoad IMUDP//log Receive Plugin

# $UDPServerRun 514//Port accepted by log

C. Restart Service: Systemctl restart Rsyslog

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/89/17/wKioL1gHcJWyw9mwAACSqLnmHsA490.png-wh_500x0-wm_3 -wmp_4-s_52757117.png "title=" screenshot from 2016-10-19 08_24_49.png "alt=" Wkiol1ghcjwyw9mwaacsqlnmhsa490.png-wh_ "/>

D. Testing: Monitoring at the receiving party,

Tail-f/var/log/message

On the sending side;

Input:logger test message

This will allow you to observe the synchronization

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/89/17/wKioL1gHb_7BBb-NAAg8cZ8qi4c889.png-wh_500x0-wm_3 -wmp_4-s_2432642556.png "title=" 2016-10-19 20_28_42 screenshot. png "alt=" wkiol1ghb_7bbb-naag8cz8qi4c889.png-wh_50 "/>


Linux Fourth Week Lesson notes (1) gateway, DNS,DHCP, log

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.