Linux Configuration IP Address

Source: Internet
Author: User

The Linux configuration IP URL can be configured using Neat,netconfig,ifconfig and so on, where the first two have a user interface, the third command is just a temporary IP setting, and the configuration will be lost after the machine restarts.

Sometimes the graphical user interface program is difficult to obtain, here is a more straightforward way, is to modify the network configuration file.

The general network configuration file name is: ifcfg-eth[x], this x can be 0,1,2, etc., because you can set up multiple networks, if only one, the configuration file name is Ifcfg-eth0, file location:

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

1. Modify the network configuration file

#vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0 #设定网卡的名称, corresponding to the file name #
Onboot=yes #是否在开机的的时候启动网卡 #
bootproto=static #启动的时候的 IP protocol, this is fixed, if it is a dynamic host, it should be changed to DHCP line #
ipaddr=192.168.1.2 #IP Address #
netmask=255.255.255.0 #子网掩码 #
network=192.168.1.0 #该网段的第一个 ip#
broadcast=192.168.1.255 #最后一个同网段的广播地址 #
gateway=192.168.1.2 #网关地址 #
#GATEWAYDEV =eth0

When the Linux host has just been installed, the default value for the Onboot property is no and needs to be modified to yes,boorproto default to DHCP, which needs to be modified to static.

Then set the IP address, netmask, gateway and so on.

2. Restart Network Service

When set up, use:

Service Network restart

Make the network settings effective.

Red Hat Linux test passed.


Note: If Onboot is set to No, the service network restart startup error is caused.



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.