Configuration of virtual network adapters for Linux networks (RedHat)

Source: Internet
Author: User

How to view the current network status, here is not the emphasis on the description, with the Ifconfig command. We go directly to the subject.

The network card in the Red Hat system is configured in this directory:/etc/sysconfig/network-scripts

1. Enter the directory of the NIC configuration

cd/etc/sysconfig/network-scripts/

Red Hat and Ubuntu have different NIC configurations, and all of the configurations in Ubuntu are written in the same file, and Red Hat is a separate file for each NIC.

So here are the two files that can be seen in the catalogue, Ifcfg-eth0 and Ifcfg-lo,eth0 are our network card profiles (Ens33 in Ubuntu), and Lo is the loopback test.

2. Modify the NIC configuration

The network card configuration here and Ubuntu is not quite the same, the order of internal and external network can be arbitrary.

Modify the contents of the Ifcfg-eth0 configuration file to read as follows:

Device=eth0 # nic name Bootproto=Static # Iphwaddr= Geneva: 0c: in: 3b:8f: +Ipv6init=No # does not set ipv6ipv6_autoconf=nonm_controlled=No # not managed by Network assistant Onboot=Yes # boot start type=Ethernet UUID=cb28153c-586a-2044-9b5a-952476543aeaIPADDR=192.168.8.95 # IP Address, mask, GatewayNETMASK=255.255.255.0GATEWAY=192.168.8.1

3. Increase the Virtual network card

CP Ifcfg-eth0 ifcfg-eth0:1

Modify the contents of Ifcfg-eth0:1, modify the content as follows:

 device=eth0:1 # NIC name must be modified  bootproto  =< Span style= "COLOR: #000000" >statichwaddr  =02 : 0c: 29 : 3b:8f:78  onboot  =yestype  = ethernetipaddr  =172.16 . 2.95 # IP address, mask, gateway  netmask  = 255.255 . 0.0  gateway  =172.16 . 254.254  dns  =172.16 . 254.254  # Add a DNS  

And so on, can increase ifcfg-eth0:2 ifcfg-eth0:3 and so on

4. Set the default gateway

Open the default gateway configuration file

Vim/etc/resolv.conf

Add the following content

192.168. 8.1  172.16. 254.254

5, close the network of small assistants, this is very important

If the network assistant is not turned off, some of the above modified configuration files will be re-modified, and only one network can be accessed, not both intranet.

Temporarily shut down, restart the network card does not affect, after the boot restart, the service restarts. So the general choice is permanently closed

/etc/init.d/networkmanager stop

Permanently closed

 NetworkManager off

6. Restart the network card

Red Hat can be configured to take effect by restarting the network card, no need to restart the computer, this is a better place than Ubuntu.

/etc/init.d/Network Restart or service network restart

After the network card restarts, you can access the intranet at the same time.

Configuration of virtual network adapters for Linux networks (RedHat)

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.