目录
Linux的三种网络连接方式
VMnet0:这是VMware用于虚拟桥接网络下的虚拟交换机;
VMnet1:这是VMware用于虚拟Host-Only网络下的虚拟交换机;
VMnet8:这是VMware用于虚拟NAT网络下的虚拟交换机;
VMware Network Adapter VMnet1:这是Host用于与Host-Only虚拟网络进行通信的虚拟网卡;
VMware Network Adapter VMnet8:这是Host用于与NAT虚拟网络进行通信的虚拟网卡;
仅主机:
建立虚拟机与主机之间的通信
NAT:
建立虚拟机与外网的通信
桥接:
将虚拟机的网络独立出来与主机平起平坐,共同连接在同一台交换机上,这样虚拟机对物理机的直接影响较小
Linux上的ens33网络信息说明
[root@xuegod63 ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.63 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::c09d:975d:89cd:fd3f prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:02:83:db txqueuelen 1000 (Ethernet)
RX packets 3255 bytes 4458479 (4.2 MiB)
RX errors 0 dropped 26 overruns 0 frame 0
TX packets 1130 bytes 81645 (79.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
上图信息大概说明:
第一行:up-->网卡开启状态
RUNNING-->网线处理连接状态
MULTICAST-->支持组播
mtu 1500-->(Maximum Transmission Unit)最大传输单元大小为1500字节
第二行:该网卡的IP地址,子网掩码,广播地址
第三行:IPV6的配置信息
第四行:网卡的MAC地址
ether表示连接类型为以太网
txqueuelen 1000 --》传输队列的长度
第五六行:网卡接收数据包的统计信息和接收错误的统计信息
第七八行:网卡发送数据包的统计信息和发送错误的统计信息
Linux上修改临时ip地址的操作
ifconfig //看当前网络ip地址
ifconfig ens33 192.168.39.110 netmask 255.255.255.0
//添加临时ip
ifconfig ens33:0 del 192.168.1.110
//删除临时ip
systemctl restart network
//CentOS7网卡重启的方法
Linux上改临时ip地址
[root@localhost chen]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.39.129 netmask 255.255.255.0 broadcast 192.168.39.255
inet6 fe80::5566:ba43:5af8:3853 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:38:ec:30 txqueuelen 1000 (Ethernet)
RX packets 1183 bytes 842885 (823.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 419 bytes 41660 (40.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.146.129 netmask 255.255.255.0 broadcast 192.168.146.255
inet6 fe80::be6f:2dc3:488f:9984 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:38:ec:3a txqueuelen 1000 (Ethernet)
RX packets 53 bytes 5711 (5.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 93 bytes 13888 (13.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens35: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:38:ec:44 txqueuelen 1000 (Ethernet)
RX packets 3 bytes 747 (747.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 64 bytes 5568 (5.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 64 bytes 5568 (5.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:d6:40:7b txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost chen]# ifconfig ens33 192.168.39.110 netmask 255.255.255.0
[root@localhost chen]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.39.110 netmask 255.255.255.0 broadcast 192.168.39.255
inet6 fe80::5566:ba43:5af8:3853 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:38:ec:30 txqueuelen 1000 (Ethernet)
RX packets 1193 bytes 843485 (823.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 434 bytes 45124 (44.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost chen]# systemctl restart network
[root@localhost chen]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.39.129 netmask 255.255.255.0 broadcast 192.168.39.255
inet6 fe80::5566:ba43:5af8:3853 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:38:ec:30 txqueuelen 1000 (Ethernet)
RX packets 1208 bytes 845228 (825.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 468 bytes 50252 (49.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0