Linux Basic network Settings

Source: Internet
Author: User
Tags nslookup nslookup command traceroute command

Learn to view and test the network

Learn to set network address parameters

View information for network interfaces Ifconfig

    • View specified network interface information

Format: Ifconfig network interface Name

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B2/ Wkiol1vpu1pwtcbyaaeebul4un4508.jpg "width=" 550 "height=" "/>"

    • View Host Name

Hostname command: View or set the current host name

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B6/ Wkiom1vpub7ybm1vaabcpylo3oq734.jpg "width=" 529 "height=" 102 "/>

Bash enables a new shell session

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6D/B2/wKioL1Vpu1WRlYVaAABhXETkZ_ Y900.jpg "width=" 518 "height=" 111 "/>

View Route Entries Route

Route command: View or set the host routing table information

Format: route–n

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B6/ Wkiom1vpucdt3fdiaabyby9e5dk890.jpg "width=" 536 "height=" "/>"

View network Connectivity Netstat

Netstat command: View the connection status, routing table, interface statistics of the system's network

Format: netstat [options]

Common options:

-A: Show all active connections

-N: Displayed in digital form

-P: Show process information

-T: View information about the TCP protocol

-U: View information about UDP protocol

-R: Show routing table information

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B2/ Wkiol1vpu1acxnaeaaamb73jdg8273.jpg "" 519 "height="/>

ping command: Test the connectivity of the network

Format: ping [options] target host

CTRL + C terminating test

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/6D/B6/wKiom1VpucLyGJjHAAEt-H2n_ Be907.jpg "" 516 "height=" 251 "/>

Trace Packet Traceroute

traceroute command: Test the network node that passes between the host and the destination host

Format: traceroute Destination host Address

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B6/ Wkiom1vpucozqqkhaabpqfaj-ke002.jpg "" Height= "/>"

Domain Name Resolution nslookup

nslookup command: Test DNS domain name resolution

Format: nslookup destination host address [DNS server address]

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6D/B6/ Wkiom1vpucotqrbkaadeztepkog461.jpg "" 531 "height=" 231 "/>

How to set network parameters

Temporary configuration--use commands to adjust network parameters

Simple, fast, class directly modify the network parameters in the run

Generally only suitable for use in debugging a network

After the system restarts, the changes will be invalidated.

Fixed settings-Modify network parameters with configuration files

Modifying configuration files for various network parameters

Used when setting fixed parameters on the server

Network Service needs to be overloaded or restarted before it takes effect

Set network interface Parameters Ifconfig

Set the IP address of the network interface, subnet mask

Format: Ifconfig interface name IP address [netmask subnet mask]

Ifconfig Interface Name IP address [/Mask length]

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B6/ Wkiom1vpucpss0qyaaa9wpzu4o4410.jpg "width=" 481 "height="/>

Disable or reactivate the NIC

Ifconfig network interface up

Ifconfig network interface Down

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B2/ Wkiol1vpu1nh4izuaaa3nggdzfy962.jpg "width=" 472 "height="/>

Setting up a virtual network interface

Format: Ifconfig Interface Name: Ordinal IP Address

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B6/ Wkiom1vpucttpao6aaa9qu30fyo824.jpg "width=" 479 "height="/>

Set Route record route

Delete the default gateway record in the routing table

Route del default GW IP address

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B2/ Wkiol1vpu1mxoqusaab5jhjzksa877.jpg "width=" 482 "height=" 104 "/>

Default gateway record added to the routing table

Route add default GW IP address

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B6/ Wkiom1vpucsa34ppaabz4gf2dtu347.jpg "width=" 477 "height=" 101 "/>

Route records added to the specified network segment

Route add–net Network Segment address GW IP address

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B6/ Wkiom1vpucsz7eznaactemhsfmy572.jpg "width=" 476 "height=" 122 "/>

Delete a route record to a specified network segment

Route del–net Network Segment address GW IP address

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B6/ Wkiom1vpucxbtcahaacegqhige0342.jpg "width=" 477 "height=" 118 "/>

Writing shell scripts to add routing records

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6D/B2/ Wkiol1vpu1uxgd8raaaoze0v7oc049.jpg "width=" 368 "height="/>

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B2/ Wkiol1vpu1vgtjjiaabgr9z8avk281.jpg "width=" 479 "height="/>

Add executable permissions to a script

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6D/B6/ Wkiom1vpucag5z3-aabqjuion5w469.jpg "width=" 474 "height="/>

Edit the/etc/rc.local file, and the route record is automatically added after reboot

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B6/wKiom1VpucaiYcWCAAAvP_ 48pfk260.jpg "width=" 463 "height="/>

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B2/ Wkiol1vpu1yjfbvnaaclafad9sy232.jpg "width=" 466 "height="/>

Network Interface configuration file

Under the/etc/sysocnfig/network-scripts/directory

Ifcfg-eth0:1th Ethernet Card configuration file

Ifcfg-eth1:2nd Ethernet Card configuration file

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6D/B2/ Wkiol1vpu1ztwae5aacaxmfizfc857.jpg "width=" 472 "height="/>

Enable, disable network interface configuration

Restart Network: Networking Services

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B2/wKioL1Vpu12QTurSAABdZ_ Z0jvq165.jpg "width=" 482 "height=" "/>

disabling, enabling network interfaces

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B6/ Wkiom1vpucithfdhaaboridf8xy781.jpg "width=" 487 "height=" "/>"

Host name configuration file

/etc/sysconfig/network file

Purpose: To save the global network settings, mainly including the host name information

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B2/ Wkiol1vpu13canduaabczqhfjuu041.jpg "width=" 493 "height=" Wuyi "/>

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6D/B2/ Wkiol1vpu16y4qpwaabenufkapu108.jpg "width=" 491 "height=" "/>"

Domain Name resolution configuration file

/etc/resolv.conf file

Purpose: The IP address of the DNS server to be used to save the machine

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/6D/B2/ Wkiol1vpu16wxzjbaabcqenyz-i679.jpg "width=" 491 "height="/>

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/6D/B2/wKioL1Vpu1_ Rkjjdaadcpfamxqk250.jpg "width=" 505 "height=" "/>"

Local Host mapping file

/etc/hosts file

Purpose: Save the mapping record of host name and IP address

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/6D/B2/ Wkiol1vpu2dbajnmaabvmbv9iwu998.jpg "width=" 502 "height=" "/>"

Hosts file and DNS server comparison

By default, the system first finds parsing records from the Hosts file

The Hosts file is valid only for the current host

Hosts file reduces DNS query process for faster access

Linux Basic network Settings

Related Article

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.