Linux Network Infrastructure configuration

Source: Internet
Author: User
Tags echo 7 traceroute command

1. TCP/IP network configuration file

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

/etc/sysconfig/network

/etc/host.conf

/etc/hosts

/etc/resolv.conf

/etc/services

(1)/etc/sysconfig/network-scripts/ifcfg-eth0

Startup scripts for network interfaces

Content instance:

Device=eth0

Onboot=yes

Bootproto=static

ipaddr=192.168.1.10

netmask=255.255.255.0

gateway=192.168.1.1

network=192.168.1.0

broadcast=192.168.1.255

(2)/etc/sysconfig/network

Network basic Information configuration

Content instance:

Networking=yes

hostname=linux.jnrp.cn

gateway=192.168.1.1

(3)/etc/hosts

/etc/hosts file is the local hostname resolution database for the system

Content instance:

#Do not remove the following line, or various programs

#that require network functionality would fail.

127.0.0.1 localhost.localdomain localhost

192.168.1.2 CentOS5

(4)/etc/host.conf

The/etc/host.conf file is used to specify how host names are resolved, and the available options are:

Order: Sets the available methods and order of host name resolution, including the hosts (parsing with the/etc/hosts file), bind (using DNS server Resolution), NIS (using Network Information Service NIS resolution)

Multi: Sets whether to return multiple IP addresses of the host from the/etc/hosts file, with a value of on/off

(5)/etc/resolv.conf

/etc/resolv.conf file is a client configuration file for the DNS domain name service

Content instance:

NameServer 218.30.19.40

nameserver61.134.1.4

Search jnrp.cn

Domain jnrp.cn

(6)/etc/services

Set the TCP or UDP port used by the network service by default

File Content instance:

# each Linedescribes one service, and is of the form:

#

#service-name Port/protocol [aliases ...] [# Comment]

Tcpmux 1/tcp # TCP port Servicemultiplexer

Tcpmux 1/UDP # TCP Port Servicemultiplexer

Rje 5/tcp # Remote Job Entry

Rje 5/udp # Remote Job Entry

Echo 7/tcp

Echo 7/UDP

Discard 9/tcp sink NULL

Discard 9/udp sink NULL

Systat 11/TCP Users

Systat 11/UDP Users

2. Configure the network with command-line tools

Basic Network Configuration commands:

Ifconfig

Ifup

Ifdown

Hostname

(1) Ifconfig command

The Ifconfig command is used to view and configure TCP/IP networks

Command instance:

#ifconfig eth0

Eth0 Link encap:ethernet HWaddr 00:0c:29:fb:e4:89

inet addr:192.168. 1.3 bcast:192.168. 1.255 mask:255.255.255.0

Inet6 ADDR:FE80::20C:29FF:FEFB:E489/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:36 errors:0 dropped:0 overruns:0 frame:0

TX packets:139 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:4321 (4.2 KiB) txbytes:13153 (12.8 KiB)

Interrupt:10 Base address:0x1400

#ifconfig eth0 192.168.1.3 netmask 255.255.255.0

(2) Route command

The route command is used to set routing information for a Linux system

To view routing information:

Route-n

Add a static route entry

Route add-net netaddr netmask GW ipaddr Dev

Set the default gateway

Route add default GW ipaddr

Delete a route entry

Route del-net netaddr netmask GW ipaddr Dev

Ping Commands network connectivity testing over the ICMP protocol

The traceroute command tracks the path through which a destination is reached

The netstat command is used to view various network-related status information, including: Network connection status, interface statistics, view routing table, port monitoring, etc.

(3) Ping command

The basic usage of the ping command is:

Ping option Destination Address

Common options include:

-C: Specifies the number of ICMP messages emitted by the ping command, if not specified, will be sent continuously until the user presses the "CTRL + C" Abort command

-I: Specifies the time interval between each ICMP message that the ping command emits, with a default value of 1 seconds. For security reasons, only super users can set this value to less than 0.2 seconds

-S: Sets the packet size for each ICMP message emitted, which defaults to 64 bytes and a maximum value of 65507

-T: Set TTL (Time to Live)

(4) Traceroute command

(5) Netstat command

Common options for the netstat command include:

-A: Displays all listening and non-listening sockets

-I: Display statistics for interfaces

-N: Displays IP addresses and ports in digital form instead of names

-P: Shows the PID and program name of the process using the port

-R: Show kernel routing table

-S: Display statistics for each protocol

Linux Network Infrastructure configuration

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.