Linux Network related
Ifconfig View network card IP (need to install Net-tools package) IP Add can also view network card IP
yum install -y net-tools
When your network card does not have an IP, it is not displayed, but plus-a can be viewed.
ifconfig -a
Turn off the specified network card (if you are connecting this network card using this command will disconnect, so do not use this command to close the network card in use) (Ens33 is the network card name, based on the current server network card name)
ifdown ens33
Start the specified NIC
ifup ens33
Specifies that the network adapter being used is restarted
ifdown ens33 && ifup ens33
To set the virtual network card method:
First to the NIC directory
cd /etc/sysconfig/network-scripts/
Copy the network card (plus backslash \ is to drag the meaning:, ens33:0 for the new NIC name)
cp ifcfg-ens33 ifcfg-ens33\:0
Then edit it, change the red part, and the green section can not. (This place ens33:0 does not need to add anti-slash drag meaning)
vi ifcfg-ens33:0
Save exit, and then restart the NIC
ifdown ens33:0 && ifup ens33:0
Then use Ifconfig to see the virtual network card.
ifconfig
Then we can try to ping.
Check whether the network card is connected (Ens33 is the name of the network card, if the end is link OK is connected, no link is not connected, sometimes will not show support)
mii-tool ens33
If not, we can use Ethtool Ens33 (Ens33 as the NIC name) (and then look at the last line link detected if yes is connected, no is no connection.) )
ethtool ens33
Change host name (Shuaiyangyang is the modified host name)
hostnamectl set-hostname shuaiyangyang
You can use hostname to view it, but you need to log back in to change it, or you can use the Bash command to enter the child shell as well.
hostname
Host Name Master profile location
cat /etc/hostname
DNS配置文件位置(该配置文件只能临时修改,重启网卡后失效)
cat /etc/resolv.conf
Custom domain name, change resolution address, ping URL specified IP (only valid on this computer)
cat /etc/hosts
For example, we visit www.baidu.com, (we use ping) to access the IP is Baidu's IP, but we now want to let him access to 192.168.71.134 this IP, we will modify this configuration file
Vim opens this configuration file
vim /etc/hosts
Under another line, make the following edits
Save the exit, we will ping the Baidu can see, it has automatically jumped to 192.168.71.134 this IP came up
Support for more domain names after one IP, split with spaces. If a domain name sets multiple IPs, it will take effect with the last IP setting
Firewalld and NetFilter
SELinux Shutdown method (General enterprise is closed)
Temporarily closed
setenforce 0
Permanently closed, you need to go to the configuration file to close
Enter configuration file
vi /etc/selinux/config
Change the red position of the word enforcing to the green part of the word disabled
After saving the reboot, we can use Getenforce to see if SELinux is off
The enforcing is on, permissive is off state. (Because a reboot is required to take effect, I do not restart)
NetFilter Firewall and FIREWALLD firewall
Linux network related, FIREWALLD and netfilter, NETFILTER5 table 5 chain Introduction, IPTA