This is the seventh day of my participation in the August Challenge. For details, see:August is more challenging
There are three network configuration modes
The bridge model
The virtual system and host system share the same network segment. Users on the same LAN can find the VM. This facilitates communication. However, the IP addresses in a network segment are limited. Too many virtual systems may duplicate IP addresses.
NAT mode
The host will have two addresses, and the virtual system will not occupy the network segment of the peripheral LAN, but will network with the newly generated address. The external user cannot find the virtual system, but the virtual system can find the external user address.
Host mode
Linux is an independent host and cannot access the Internet.
Linux automatically obtains the IP address
The Linux click system — — — – > preferences – > network connections – > edit – > automatic connection.
Linux Specifies a fixed IP address
Edit the file
vim /etc/sysconfig/network-scripts/ifcfg-eth0
Copy the code
-
Added: ipaddr= set to be consistent with the network segment in the network editor
-
Gateway = (viewed through the network editor)
-
Dns1 = The value must be the same as the gateway
-
Change onboot to yes
-
Change bootProto to static
Then run the service network restart command to restart the network service.
Nothing can be installed after Linux is installed
Sed -i "s | | enabled = 1 enabled = 0 | g"/etc/yum/pluginconf d/fastestmirror. Conf/etc/mv. Yum repos. D/CentOS - Base. Repo /etc/yum.repos.d/CentOS-Base.repo.backup curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo yum clean all yum makecacheCopy the code
In centos6, the default firewall used is iptables.
Add A port to vim /etc/sysconfig/iptables, and add -a INPUT -m state –state NEW -m TCP -p TCP –dport 80 -j ACCEPT
And then:
service iptables stop
service restart iptables restart
service iptables enable
centos 7
Ah! There is no graphical interface by default.
By default, no network connection needs to be configured. The configuration is similar to that of Centos6
BOOTPROTO=static# Enable static IP addressesONBOOT=yesEnable Automatically enable network connectionsIPADDR = 192.168.1.73Set gatewayGATEWAY = 192.168.1.1 NETMASK = 255.255.255.0 DNS1 = 114.114.114.114 DNS2 = 8.8.8.8Copy the code
1. Change the host name
#hostnamectl set-hostname compute1
2. Change the NIC name
In CentOS 7. X, the nic naming rule is redefined, which may be “ifcfg-ens33”, etc. Now we change the NIC to ifcfg-eth0.
1, CD/etc/sysconfig/network – scripts /
Mv ifcfg-ens33 ifcfg-eth0
Vi ifcfg-eth0 # edit
NAME = eth0 # modified
DEVICE eth0 = # modified
Centos7 right-click copy and paste function plug-in
Yum install GPM *
Run the service GPM start command
Install the GUI
Start the system and log in as the root user
Install X(X Window System) by running the following command: yum groupinstall “X Window System” 1 With the words. Then install the graphical interface software, GNOME(GNOME Desktop), and run the following command: yum groupinstall “GNOME Desktop” 1 Because this software group is much larger than the first one (containing about 800 pieces of software), the installation process is slow. When the installation is complete, complete! With the words. After the installation is complete, you can run the startx command to enter the GUI
The graphical user interface (GUI) is displayed
First, use CTRL + Alt + F2 to switch to the command line mode. If the command line mode is the command line mode, go to the following steps and enter the following command to view the current startup mode systemctl get-default
Target indicates the GRAPHICAL user interface (GUI) for startup upon startup. Multi-user. Target indicates the DOS interface for startup upon startup
Finally, run the following command to set the graphical user interface (GUI) for startup: systemctl set-default graphical
Similarly, if you want to start the DOS interface, run the systemctl set-default multi-user.target command
Switching shortcut keys between the DOS interface and the GUI Graphics to DOS: CTRL + Alt + F2 DOS to GRAPHICS: Enter startx or init 3 command to switch to the DOS interface, enter init 5 command to switch to the GUI