Linux Network Management

Source: Internet
Author: User
Tags traceroute command

Objective

Only a bald head can become stronger.

Review Front:

    • After reading this Linux basic operation will be
    • Linux User and Rights Management look, you're going to use it.
    • Linux Process Management

This article mainly explains the management of the network under Linux .

Then let's start, if the article has the wrong place please forgive me, not hesitate to comment on the area Oh ~

Disclaimer: Based on Centos6.9

One, the network under Linux

Linux supports various protocol types of networks

    • TCP/IP, Netbios/netbeui, ipx/spx, Appletake, etc.
    • Network protocols such as Ethernet, Token Ring, ATM, PPP (PPPoE), FDDI, Frame relay are also supported at the bottom of the network.
    • These network protocols are the functionality provided by the Linux kernel , and the specific support conditions are determined by the kernel compilation parameters.

There are two ways of Configuring network parameters:

    • Temporary network configuration
      • The implementation of the network-related parameters in the current kernel is modified by the command , which takes effect immediately after re-booting.
    • Permanent Network configuration
      • By directly modifying the network-related configuration file Implementation, you need to restart the service , and then keep all the configuration after rebooting

When configuring the network under Linux, there is always the concept of bridging and NAT mode , here I briefly excerpt:

    • Bridge mode virtual machine, like a router "Civil Affairs bureau" there "on the account" of adults, have their own separate residential address, although and host live in the same compound, but at least there are accounts of people, can swagger directly and outside communication.
    • Nat mode virtual machine, is purely a Heihu account, the router "Civil Affairs Bureau" does not know that there is such a person, nature will not actively communicate with it. Even if the virtual machine occasionally to send the point of the letter to the host to be forwarded to the host in the name of the forwarding out, the host also specifically invited a NAT called the grandfather to specifically responsible for these virtual machine's letter, receiving letters.
    • Host-only virtual machine, purely a thorough bottom of the black slaves, not only have no account, router "Civil Affairs Bureau" do not know so people, but also by the main organs in the small black House, even the letter is not allowed outward.

Resources:

    • Https://zhuanlan.zhihu.com/p/32948325--VMware Network Connection mode-detailed introduction and differences between bridging, NAT, and host-only mode (software Compass)
1.1 Common Management Network commands

network interface related :

    • To view the network interface configuration:ifconfig [ethX]
    • Enable and disable a network interface: Use the ifup ethX command to enable the specified interface, and use the ifdown ethX command to disable the specified interface

temporary configuration related :

    • ifconfigcommand can temporarily set the IP parameters of the network interface
    • routecommand can temporarily set the kernel routing table
    • Use the hostname command to temporarily modify the host name
    • Use sysctl the command to temporarily turn on the kernel's packet forwarding

Use the command to do the temporary configuration of the network, to do a permanent configuration will need to directly modify the way the file!

Common tools for network detection:

    • Ifconfig Detecting Network Interface Configuration
    • Route Detection Routing Configuration
    • Ping detects network connectivity
    • Netstat Viewing network status
    • Lsof viewing the current operation of the specified IP and/or port processes
    • Host/dig/nslookup Detection DNS resolution
    • Traceroute the router that the destination host was detected in
    • tcpdump display the status of native network traffic
1.1 Configuring the Linux network Exercises

Check if Windows VirtualBox virtual network card is disabled, if disabled, start, log in as root account, check current network configuration with Ifconfig, then start eth0 network card and eth1 network card with ifup command, observe the result and record the IP address of NIC binding , recorded in part fifth. Turn off check the status of the firewall, if the firewall is started, shut down the Linux system firewall,

Start Putty, enter the current IP address of the eth1 NIC in the Host name input box, connection type select Ssh,port to 22, press the "open" button to prompt the Putty Security Alert dialog box, select OK To log in as root account, Jkxx account, respectively.

On the root account login Putty terminal to view (PS AU) The current user running process, find the JK08 account running the shell program PID, and in the fifth part of the record. On the putty terminal where the root account is logged in, kill the shell program just logged with the KILL command;

What are the conditions required to kill a process? If it's a Peter account, can you kill the process that Jason's account is running on?

A: To kill a process, you should have the right to control the process, such as access to the account that the process belongs to, or access to the super account. If it's a Peter account, you don't have access to Jason's account, so the process of killing Jason's account is banned.

Use the routing command to view the current network routing status, and use the ping command to test if the external Web site address is connected;

Use Ifconfig to view the current IP address of the eth0, modify the IP address, the last paragraph of the address is 1 larger than the original, the view is successful, with the ifconfig to modify the eth0 address, the need to specify a mask and broadcast address, where the mask is a Class B address mask, the routing command to observe the change of the routing table;

Add a host route on the Eth1 NIC, The host IP address is required to be 192.168.3.3; Add a network route on the Eth0 NIC, the network address is 10.20.0.0, the mask is 255.255.0.0; Observe the default route in the routing table, restore the default gateway route according to the default route observed by step (2), and test the connectivity of the network to the external website;

Set the alias Eth1:0,ip address to the NIC Eth1 1 greater than the last digit of the eth1 IP address; From the Windows side, test eth1 and eth1:0 connectivity with the ping command; Stop eth1:0 work, observe the results, and

Repair the host name is Serverxx (xx for the student number two), quit the shell to log in again, observe the value of the kernel parameter net.ipv4.ip_forward, and modify it to 1;

Why is the default route record missing, possibly the reason?

A: The IP address of the NIC Eth0 that the default route passes through is modified, which has a large impact on the original route, so the system automatically deletes the default route.

What are the benefits of having multiple IP addresses for a network card?

A: The advantage is that it is advantageous to bind multiple identical network services on a network card, for example, multiple websites can be bound.

Edit the network interface files of eth0 and eth1, request to be modified to start the device automatically at startup, and require the address of the eth1 to be 192.168.56.121, the network prefix is 26, the system restarts, verify that the network card is automatically started, and its IP address;

Edit the local domain name resolution configuration file, required to add 10.0.2.2 address, the corresponding domain name is Gatexx (where xx is the student number of the last two), save the exit; ping command, the parameter is Gatexx, check whether the domain name can be connected to the corresponding IP address;

Edit the file so that the system supports IP packet forwarding; Use the sysctl-p command to make the result of the modification effective;

To test the website www.qq.com with the ping command, request only 10 ICMP test packets, observe the network interface information with the netstat command, observe the routing table information with the netstat command, observe the TCP port being monitored with the netstat command, and observe the UDP port being monitored with the netstat command;

Does sysctl-p see data in the configuration file or in-memory?

A: What you see is both the data in the configuration file and the data in memory. Because the-p parameter means to update the data in the configuration file into memory.

Second, install the software

In general, our CentOS installation software can be installed directly using the Yum command , which is very convenient. There is also a RPM before yum to see the difference:

    • RPM is a package management method developed by Red Hat, which allows us to install, query, uninstall and upgrade the software conveniently. However, the dependencies between RPM packages are often cumbersome, especially when the software is made up of multiple RPM packages.
    • Yum (full name Yellow dog Updater, Modified) is a shell front-end package manager in Fedora and Redhat and SuSE. Based on RPM package management, the ability to automatically download the RPM package from the specified server and install, can automatically handle dependency relationships , and install all dependent software packages at once, without the tedious download and installation.
2.1yum use
yum  [全局参数] 命令 [命令参数]

Common Global Parameters:

    • -y: Answer "yes" to the Yum Command's question
    • -C: Use only local cache, not download files from remote repository
    • --enablerepo=REPO: Temporarily enable the specified warehouse named repo
    • --disablerepo=REPO: Temporarily disables the specified warehouse named repo
    • --installlroot=PATH: Specifies the root directory at which the software is installed, primarily for installing software for the chroot environment

2.2 Common Network Tools

2.3 Practice Yum install software and use

Find packages Tree,lsof,traceroute with Yum, observe the results, find basic information about the tree package, install Tree,lsof,traceroute three packages

Run the command tree to view subdirectories in/etc directory, run lsof to see which application is using TCP port 22 on the network, and use the traceroute command to observe how many routes a site has gone through

Open Web site http://www.rpmfind.net with a browser, find packages System-config-network-tui, tree, NTSYSV, find packages, copy download links, and download links in Linux using wget After a successful download, list the file in a long format

Use the RPM tool to view all installed packages and output the results to the file InstallXX.txt, where (xx is the last two students); Use RPM to view Bash's package information, and to view the digital signature information of the installation package file with RPM;

Use RPM to install the three software packages downloaded in step 2nd, are they all installed smoothly? Why it's wrong; observation results,

Which package does not install properly, why? How should the software be installed?

A: The SYSTEM-CONFIG-NETWORK-TUI-1.6.0.EL6.3-4.EL6.NOARCH.RPM package does not install successfully because the package relies on other packages and the dependent packages should be installed before the package can be installed. It can be installed with the Yum tool, which automatically installs dependent packages.

Iv. Summary

This article mainly summarizes the Linux network and the installation of software knowledge ~ ~ ~ These two points of knowledge in Linux is also very important, is to learn the foundation of Linux ~

continue to refine your last thought map :

If the article is wrong, welcome to correct, we communicate with each other. Accustomed to looking at technical articles, want to get more Java resources of students, can pay attention to the public number: Java3y. For everyone's convenience, just new QQ Group: 742919422, we can also go to exchange. Thanks for the support! I hope to introduce more to other needy friends.

Directory navigation for articles :

    • Https://zhongfucheng.bitcron.com/post/shou-ji/wen-zhang-dao-hang

Linux Network Management

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.