Linux Network configuration

Source: Internet
Author: User

One: Configure network address:

1. Configuration file:

/etc/sysconfig/network//Global configuration file, you can define hostname=; gateway=; Networking=yes;


2. Network card configuration file:/etc/sysconfig/network-scripts/ifcfg-eno16777736

Configuration single address: an interface one address;

[email protected] sysconfig]# cat network-scripts/ifcfg-eno16777736

Type=ethernet//define network type

BOOTPROTO=DHCP//define startup mode and can be none | static | DHCP | BootP

Defroute=yes

Ipv4_failure_fatal=no

Ipv6init=yes

Ipv6_autoconf=yes

Ipv6_defroute=yes

Ipv6_failure_fatal=no

name=eno16777736//network interface name is generally the string after ifcfg-;

Uuid=23a16dd1-5f74-438e-b1ef-16a0101a66eb

device=eno16777736//network interface name is generally the string after ifcfg-;

Onboot=yes//boot on or off; Value range: No | Yes

Peerdns=yes//When DHCP is enabled, whether to disable access to DNS; Value range: No | Yes

Peerroutes=yes

Ipv6_peerdns=yes

Ipv6_peerroutes=yes

Userctl=no//Normal user can enable or disable the network card; Value range: yes | No

GATEWAY=IP//Configure Gateway

Eth_opts= ""//Configure hardware Properties

[Email protected] sysconfig]#


#ethtool//commands for configuring NIC hardware properties


Configure multi-Address: One interface multiple addresses:

Configuration via command line:

#ifconfig eth0:0 IP netmask MASK

Configured with configuration files:

/etc/sysconfig/network-scripts/ifcfg-eno16777736:#//Inside the configuration is basically the same, #表示子地址;

device=eno16777736:#//network interface name is generally the string after ifcfg-;

Bootproto=static//When there is a sub-interface, can only be statically configured;






3. Configure Routing:

#route Add-host | -net network/mask GW GATEWAY//reboot will fail

To make the route added by the route permanent, you need to create the file:

By creating a file:/etc/sysconfig/network-scripts/route-eth#

Method One: Enter Inside: DESTINATION via GATEWAY

For example: Inside Input: 10.0.0.0/8 via 172.16.0.1

Method Two: In the inside input:

address#=

netmask#=

gateway#=

The # number above represents the group number, a group of group numbers should be the same; #=0,1,2, ...

For example:

address0=10.0.0.0

netmask0=255.0.0.0

gateway0=172.16.0.1

Note: The two methods can not be mixed with each other;


4. Help document:/usr/share/doc/initscripts-9.49.30/sysconfig.txt//9.49.30 version number, may be the same;


5. Network Service Script Location:

/etc/init.d/

/etc/rc.d/init.d/

Equivalent to: Service Network (Start | restart | stop)

Note: All network services are configured to take effect by restarting the service


6. View routes:

Route-n










Linux Network configuration

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.