Linux basic network configuration

Source: Internet
Author: User
Linux basic network configuration-Linux Enterprise Application-Linux server application information. For details, refer to the following section. 1. Basic configuration file:
1. Simple text file that associates the IP address with the Host Name
/Etc/hosts
Example:
# Do not remove the following line, or various programs
# That require network functionality will fail.
127.0.0.1 localhost. localdomain localhost
192.168.0.2 xf1.xf.edu.cn xf1
In this Host file, the IP address 192.168.0.2 is mapped to Host .xf1.xf.edu.cn.
And assign it a backup Host Name (alias), which can be used to access 192.168.0.2
2. Correspondence between port numbers and standard services. This table exists on each host.
/Etc/services
Example:
Ssh 22/udp
Telnet 23/tcp
Telnet 23/tcp
Smtp 25/tcp mail
Service port number/alias of the Protocol Service
3./etc/sysconfig/network is used to specify all network configuration information.
This file can contain one or more of the following keyword/value pairs:
NETWORKING = YES | NO
HOSTNAME = hostname
GATEWAY = gw-ip
GATWAYDEV = gw-dev
NISDOMAIN = dom-name
Example:
NETWORKING = yes
HOSTNAME = localhost. localdomain
2. executable scripts and commands:
1./etc/rc. d/init. d/network start | restart = service network start | restart
2./etc/sysconfig/network-scripts/ifup &/Etc/sysconfig/network-scripts/ifdown
3. ifconfig
Ifconfig eth0 up
Ifconfig eth0 192.168.0.199 netmask 255.255.255.0
Ifconfig eth0 down
Ifconfig | more
3. Nic configuration file:
1,/etc/sysconfig/network-scripts/ifcfg-interface-name

DEVICE = name
IPADDR = addr
NETMASK = mask
NETWORK = addr
BROADCAST = addr
GATEWAY = addr
When ONBOOT = answer/answer is yes, the device is activated during boot. If no, the device is not activated during boot.
USERCTL = answer
BOOTPROTO = proto
4. Nic configuration command:
Netconfig
Connectivity test:
Ping
Management:
Route
Add route information:
Route add-net 192.168.0.199 netmask 255.255.255.0 dev eth0
Delete route information:
Route del-net 192.168.0.199 netmask 255.255.255.0
Route test:
Traceroute www.baidu.com

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.