Linux configuration IP Address instance description

Source: Internet
Author: User


Linux configuration IP address method;

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

Ipaddr= "192.168.x.x"
Netmask= "255.255.255.0″
Gateway= "192.168.x.x"
Vi/etc/resolv.conf

NameServer 8.8.8.8

Service Network restart

It feels a little bit messy, I'll rearrange it now.


The process of organizing the configuration is as follows:

Configuration steps:

1, run ifconfig add a ip:192.168.10.22

Command format:: Ifconfig+eth0:x + ip+netmask (subnet mask)

Ifconfig eth0:0 192.168.10.22 netmask 255.255.255.0

Note: If you want to add more, X plus 1 is OK, can support up to 255!

2, in the #cet/sysconfig/network-scripts directory to establish a corresponding eth0:0 directory and the corresponding, and modify the relevant data can!

Here we can use the CP command to do this operation

CP Ifcfg-eth0 ifcfg-eth0:0

Modify the device name, and IP corresponding! Here is a change I have a profile, you can refer to the red for the modified part!

device=eth0:0

Bootproto=static
broadcast=192.168.1.255
Hwaddr=00:00:12:62:45:16
ipaddr=192.168.1.22
netmask=255.255.255.0
network=192.168.1.0
Onboot=yes
Type=ethernet

3. Re-entry into force


Add the way the gateway operates


Modify the default gateway

Immediate effect:

Route add default GW 192.168.1.1

Start in effect:

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

Join

gateway=192.168.1.1
gateway=192.168.1.1

The final results are as follows:

Device=eth0
Bootproto=static
ipaddr=192.168.1.102
netmask=255.255.255.0
geteway=192.168.1.1
Onboot=yes
Type=ethernet

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.