----------Switch network network, etc.-----------------
Turn off the network card:
ifdown eth1
ifconfig eth1 down
ip link set eth1 down
Turn on the network card:
ifup eth1
ifconfig eth1 up
ip link set eth1 up
Close the virtual network card
virsh net-destroy default && virsh net-undefine default && systemctl restart libvirtd.service
Description:
net-destroy destroy (stop) a network
net-undefine undefine a persistent network
If the virsh command is not prompted exist:
ansible xx:\!xx_k8s -m yum -a 'name=libvirt'
关闭docker0网卡
systemctl stop docker
systemctl disable docker
ifconfig docker0 down
brctl delbr docker0
Close the proxy
unset http_proxy to
see if there is a proxy: env|grep proxy
Delete ip:
ip addr del 172.20.0.1/16 dev br-xxxxxxxxx
-------------route-------------------
add route
Network routing:
route add -net 10.0.0.0 netmask 255.255.255.0 gw 172.17.1.100
or: route add -net 10.0.0.0/24 gw 172.17.1.100 dev eth0 (The mask can be in short format, and the network card may not be written)
Host routing:
route add -host 10.0.0.1 gw 172.17.1.100
Default route:
route add default gw 172.17.1.1
View route:
route -n
-n, --numeric don't resolve names
Static routing configuration
vi /etc/sysconfig/static-routes
format:
any net 100.0.0.0/8 gw 10.0.0.1 #网络
any host 100.0.0.1 gw 10.0.0.1 #Host
needs to restart the network:
systemctl restart network
Other:
ip route
format: ip route add network via gateway [dev network card]
Example:
ip route add default via 1.2.3.1 dev eth3 #add default route
ip route add 10.0.0.0/8 via 172.17.0.1
#add network segment route ip route add 10.2.3.4/32 via 172.17.0.1 dev eth0 #Add host route
win:
route delete 192.168.0.0
route add 192.168.0.0 mask 255.255.0.0 172.17.0.1 -p
-p permanent route
---------Floating ip-----------------
add
ifconfig eth0:1 172.17.1.2 netmask 255.255.255.0 broadcast 172.17.1.255
ip addr add 172.17.1.2 /24 dev eth0 label eth0:1
Close:
ifconfig eth0:1 down
ip addr del 172.17.1.2/24 dev eth0