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)