The Linux dynamic network and the static network and the cloned network configuration are introduced in detail _linux

Source: Internet
Author: User
Tags uuid

It is recommended that you set the network card NAT mode

Dynamic Network configuration:

1, be sure to open the local DHCP service

2. Select the NAT mode in the Virtual network editor to select the DHCP entry as shown below

3, Ifup eth0
Static network configuration:

Note: Ifcfg-eth0 part parameter description

device=eth0# describes the device alias corresponding to the network card
hwaddr=00:0c:29:42:dd:51# the corresponding physical address
type=ethernet# network type (usually Ethemet)
uuid= 514fda06-1fc6-4d19-8a74-74030ed83956
The network interface is valid when the onboot=yes# system starts (yes/no) 
Nm_controlled=yes
Bootproto=static# set up the network card to obtain IP address, possible options for STATIC,DHCP or BOOTP, respectively, corresponding to the static specified IP address, IP address obtained through the DHCP protocol, IP address

obtained through the BOOTP protocol ipaddr=192.168.0.3# If you set up a network card to obtain an IP address as a static designation, this field specifies the IP address of the network adapter
netmask=255.255.255.0# the network mask corresponding to the NIC
gateway= 192.168.0.2# Gateway

1. Edit file Vi/etc/sysconfig/network-scripts/ifcfg-eth0 (take yourself as an example)

Before editing:

Edit:

onboot=yes# the network interface is valid when the system is started (yes/no) 
bootproto=static# How to set the network card to obtain the IP address

Increase:

 ipaddr=192.168.0.3# If you set up a network card to obtain an IP address as a static designation, this field specifies the IP address of the network adapter
netmask=255.255.255.0# the network mask corresponding to the NIC
gateway= 192.168.0.2# Gateway

After editing:

2: Restart the network:

Service Network restart

3: Check:

Ping 192.168.0.2 (Gateway)

4: Setting up the DNS service

Vi/etc/resolv.conf

Edit:

 NameServer 114.114.114.114

After cloning network settings: (after cloning from Eth0 to eth1, their own habit of eht0, to change it to eth0).

View information at this time:

View information at this time:

1, after cloning the operating system needs to reassign the physical address

A, remove the UUID and physical address in the/etc/sysconfig/network-scripts/ifcfg-eth0 file to set a new IP address

B, Vi/etc/udev/rules.d/70-persistent-net.rules
Because of the physical address that was reassigned after cloning, delete the eht0 information and modify the following eht1 to Eth0

2, modify the host name

Vi/etc/sysconfig/network (host name Centosbak modified to CentOSBAK1 before cloning) (change according to your needs)

3. Restart Linux

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.