Getting started with Linux: network configuration and troubleshooting

Source: Internet
Author: User

Getting started with Linux: network configuration and troubleshooting

When I was in touch with Linux, The first thing was to connect my computer to the Internet first, but that was a simple thing that had plagued me for a long time, all kinds of brain-and-hand problems have appeared. However, this is a headache for new users. Why can't I connect my computer to the Internet? Why can I ping others but cannot access the Internet. We will solve these problems one by one.

In this section, we understand three topics:

1. Network Configuration File
2. Basic troubleshooting errors
3. network troubleshooting Toolkit

1. Understand the network configuration file

Network Interface Name
Based on the interface type, the Linux kernel uses a specific prefix to name the interface. For example, no matter which hardware supplier is, all Ethernet interfaces start with eth. The number following the prefix. Are you familiar with this. Use the ifconfig command to view our Nic information. For example, eth0 and eth1 refer to the first and second Ethernet interfaces respectively. There are also several other types, such as the first wireless device wlan0, the internal bridge virbr0 set for the virtual machine, and the first network device bond0.


Network Interface Configuration
/Sbin/bin is used to display or temporarily modify devices, routes, policy routes, and tunnels.


Host name resolution)
The stub parser is used to convert host names to IP addresses.
The ing between the host name and ip address is under/etc/hosts.

If the/etc/hosts does not have this ing relationship, the stub parser will find it on the DNS server, and the DNS server settings file is in/etc/resolv. conf. This can be changed to specify other DNS servers.

/Etc/sysconfig/network is used to specify the Host Name and can specify the default route
There is one thing to mention about the network configuration file:/etc/sysconfig/network-scripts/ifcfg-eh0

In the figure, our configuration is very simple, but this is enough:

DEVICE is the DEVICE name, eth0 is consistent with the external ifcfg-eth0;
BOOTPROTO here we use dhcp instead of static or none. After the network service is enabled, IPADDR, DNS, and gateway will automatically apply for it for us. However, please note that, you must have a dncp server in the network environment. If you want static settings, change the value to static or none. Then, IPADDR, GATEWAY, DNS1, and NETMASK are recommended to match the current environment. I set it to dhcp for convenience, but I need to restart the network service in every new environment and obtain the above information again.
ONBOOT: determines whether our network service is enabled at startup.
BRIDGE is definitely worth setting. It is a BRIDGE between our real machine and virtual machine to communicate with each other. It is a parameter set for bridging.

Well, after our eth0 settings, we need to write ifcfg-br0 in the same directory, this is to bridge with the virtual machine settings, you need to write it yourself, the content is as follows:


Similar to the previous ifcfg-eth0, also has DEVICE, ONBOOT, BOOTPROTO, but there is a TYPE option TYPE, you need to pay attention to the Bridge at the beginning of the capital, no amount of failure.

After these two files are set, restart the network service.


View Our NIC information:


We can see that we have a br0 device, if in the RedHat system to select the virtual machine and the real machine connection method for bridging, and then configure the Virtual Machine ifcfg-eth0 file, then the virtual machine can access the Internet. Appropriate. That is the option.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.