Linux Configuration network detailed analysis, Sisu network

Source: Internet
Author: User

Note: Detailed analysis of specific operations see: http://www.wtoutiao.com/a/2362248.html Brief steps:
first, in the virtual machine selection bridge mode; Second, the preparation of networks, so that virtual machines and hosts, virtual machines and virtual machines can be network interoperability between;
1, using the Setup tool for configuration; 2, or select Edit Text to configure;
    
  
    1. vi /etc/sysconfig/network-scripts/ifcfg-eth0

    2. Service network restart; After the configuration is complete, the network must be restarted to take effect;

    1. [Email protected] ~]$ cat/etc/sysconfig/network-scripts/ifcfg-eth0# Broadcom Corporation netxtreme II BCM5709 Gigabit E thernetdevice=eth0bootproto=staticbroadcast=10.151.18.255hwaddr=00:26:b9:3f:2a:9fipaddr=10.151.18.26netmask= 255.255.255.0network=10.151.18.0onboot=yesgateway=10.151.18.28type=ethernetuserctl=noipv6init=nopeerdns=yes


//Configure the network according to the actual situation, after the configuration completes the host and the virtual function communicates with each other, tries to ping the virtual machine in the host;    
     
   
  1. [[email protected] /]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
  2. DEVICE="eth0"
  3. HWADDR="00:0C:29:EC:1D:DE"
  4. NM_CONTROLLED="yes"
  5. ONBOOT=YES
  6. IPADDR=192.168.0.22 //ip地址
  7. NETWORK=192.168.0.1 //
  8. NETMASK=255.255.255.0 //掩码
  9. BROADCAST=192.168.0.255 //广播地址
  10. DNS1=172.16.99.25 //按照主机的DNS配置
  11. DNS2=172.16.99.26
  12. GATEWAY=192.168.0.1 //网关


Example :
Third, configure DNS         VI/etc/Sysconfig/Network-Scripts/ifcfg-eth0        in the network card configuration file Ifcfg-eth0, add the DNS provisioning, directly follow the host's DNS information to configure the line.     after configuration, perform service network restart, make the net effective, test ping www.baidu.com;
        
Four, if the configuration of DNS, can not access the external network, the problem is also the need to configure the default gateway;

The discovery or ping does not pass. What's going on?

To configure the gateway:

DNS settings Yes, or ping does not pass www.baidu.com

Check that it is now possible to ping the host, the virtual machine, and the gateway. And DNS is also formulated correctly, supposedly, should be able to access the outside network AH.

But there is a critical step: the configuration of the default gateway, not done. How to communicate with the outside world without the configuration of the default gateways?

Okay, let's do it now. To configure a gateway: There are two ways

The first method: temporary configuration via the command line:

Add a default gateway to the command line:

Route add Defalult GW 192.168.1.1

The default gateway, which is the case where the corresponding route is not found, takes this route (the default gateway), which is the setting necessary to set up access to the extranet.

In order not to affect the following steps, first delete the command line prepared gateway

To delete the default gateway:

Route del default GW 192.168.1.1

The second method: in the network card configuration file for permanent configuration, pay attention to the Red label section. This is done, and you need to restart the network.





From for notes (Wiz)

Linux Configuration network detailed analysis, Sisu network

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.